[hibernate-issues] [Hibernate-JIRA] Created: (EJB-221) TransientObjectException with FetchType.LAZY on @ManyToOne and field access on target entity
Christian Bauer (JIRA)
noreply at atlassian.com
Fri Sep 1 12:56:24 EDT 2006
TransientObjectException with FetchType.LAZY on @ManyToOne and field access on target entity
--------------------------------------------------------------------------------------------
Key: EJB-221
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-221
Project: Hibernate Entity Manager
Type: Bug
Components: EntityManager
Reporter: Christian Bauer
Priority: Blocker
Attachments: fetchtest.jar
Latest SVN of everything:
em = factory.createEntityManager();
em.getTransaction().begin();
Soldier2 soldier = em.find(Soldier2.class, mickey.getId());
System.out.println("### TRYING TO ACCESS PROXY ID...");
// This triggers a SELECT, it shouldn't
System.out.println("### PROXY ID : " + soldier.getTroop().getId());
// This throws a TransientObjectException
em.flush();
The @ManyToOne troop in Soldier2.java has only FetchType.LAZY, the CascadeType.PERSIST is removed.
I expect the problem to be in CascadingAction PERSIST_ON_FLUSH.noCascade() somewhere, apparently the proxy has no Id anymore during flush-time and is considered transient (how can a proxy be transient?).
The problems appear as soon as I move the annotations from getters to fields in Troop2.java.
The attached tests are for HEM.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list