Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Update entity with relation to persistent entity
Update entity with relation to persistent entity [message #1219768] Thu, 05 December 2013 17:12 Go to next message
Risto HQ is currently offline Risto HQFriend
Messages: 2
Registered: July 2013
Junior Member
Hello,
i'm digging in to JPA-RS but i don't fully understand the way relations are managed.
Let's say i create an Employee entity, as provided below.

@Entity
public class Employee {

  @Id
  @GeneratedValue
  private Long id;

  @ManyToOne
  @JoinColumn(name = "MANAGER_ID")
  private Employee manager;
}


First i would create an entity without an manager (boss: id 1), and then create another one (staff member), whose manager would be the boss:
POST http:// ... /entity/Employee
{
  "manager": {
    "_link": {
      "href": "http:// ... /entity/Employee/1"
      "method": "GET",
      "rel": "self"
    }
  }  
}

But this creates an additional Employee entity, which is set up as the manager for the intended employee.

Am i missing something very important here?
Thanks in advance
Re: Update entity with relation to persistent entity [message #1220924 is a reply to message #1219768] Mon, 16 December 2013 08:09 Go to previous message
Risto HQ is currently offline Risto HQFriend
Messages: 2
Registered: July 2013
Junior Member
I'm somehow desperate for an answer on this? It's driving me nuts.
Previous Topic:MappedSuperclass methods not getting weaved
Next Topic:Configuring TimestampLockingPolicy via JPA Persistence Unit Property
Goto Forum:
  


Current Time: Thu Jan 23 04:33:31 GMT 2025

Powered by FUDForum. Page generated in 0.03679 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top