Oops I somehow managed to hit the submit without the full question...
Apologies...Let me start again
I have 2 entities UserDepartment and User, which are defined as
follows
@Entity
public class UserDepartment extends DomainObject<Long,
UserDepartment>
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long departmentId;
@OneToMany(mappedBy = "userDepartment", cascade =
CascadeType.ALL, fetch=FetchType.EAGER)
private Set<User> users = new HashSet<User>();
and
@Entity
public class User extends DomainObject<Long, User> {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Extension(vendorName = "datanucleus", key = "gae.encoded-pk",
value = "true")
private String encodedKey;
@Extension(vendorName = "datanucleus", key = "gae.pk-id",
value = "true")
private Long userId;
private String username;
@ManyToOne(fetch = FetchType.EAGER)
private UserDepartment userDepartment;
As you would notice that UserDepartment is the parent of the User. Now
once I persist the entity group, i want to modify the user so that it
belongs to a different department now.
What is the best way to do that?
If i remove the UserDepartment from the User and then assign a new
UserDepartment to it then I get into the issue of trying to access
multiple entity groups in the same transaction.
Regards | Vikas
www.inphina.com
On Aug 3, 6:05 pm, Vikas Hazrati <[email protected]> wrote:
> I have 2 entities UserDepartment and User, which are defined as
> follows
>
> @Entity
> public class UserDepartment extends DomainObject<Long, UserDepartment>
> {
>
> @Id
> @GeneratedValue(strategy = GenerationType.IDENTITY)
> private Long departmentId;
>
> and
>
> @Entity
> public class User extends DomainObject<Long, User> {
>
> @Id
> @GeneratedValue(strategy = GenerationType.IDENTITY)
> @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value
> = "true")
> private String encodedKey;
>
> @Extension(vendorName = "datanucleus", key = "gae.pk-id", value =
> "true")
> private Long userId;
>
> private String username;
> @ManyToOne(fetch = FetchType.EAGER)
> private UserDepartment userDepartment;
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.