Hi all,
I'm new in JPA / JDO and I'm totally sure I'm doing something wrong. I
don't know why I can't see children objects in the same transactions using
the same PM
____________________________________________________________________
// Here I got the DatastoreEntityManager (id=92)
DAO dao = DAO.getInstance(DAO.JPA, requestor);
// Here I got the DatastoreEntityTransactionImpl (id=94)
dao.startTransaction()
// Then I create and maker persistent a new Department (id=114)
// It uses the same DatastoreEntityManager (id=92) and
DatastoreEntityTransactionImpl (id=94)
Department department = new Department()
department.setName("New department");
dao.persist(department);
dao.refresh(department);
// Then I create and make persistent a new Account (id=224)
Account account = new Account();
account.setNumber(12345);
account.setDepartment(department); // Owned relationship working fine
dao.persist(account);
dao.refresh(account);
// Now I'm testing it
department.getId() // returns Department(22)
account.getId() // returns Department(22)/Account(24)
department.getAccounts(); // Returns an empty list
__________________________________________________________
At some point down the line I gotta get the accounts in the same
transaction to use in another entity. I've tried to add manually the new
Account to the* Department.accounts* field but when I tried to do it I get
*javax.jdo.JDODetachedFieldAccessException:* You have just attempted to
access property "accounts" yet this property was not detached when you
detached the object. Either dont access this property, or detach it when
detaching the object.
Does someone faced the same?? I'm loosing my hair with this!!
Thanks guys!
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-appengine-java/-/ukeIAZZOS0MJ.
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.