[hibernate-issues] [Hibernate-JIRA] Resolved: (EJB-221) TransientObjectException with FetchType.LAZY on @ManyToOne and field access on target entity
Emmanuel Bernard (JIRA)
noreply at atlassian.com
Wed Oct 4 19:23:24 EDT 2006
[ http://opensource.atlassian.com/projects/hibernate/browse/EJB-221?page=all ]
Emmanuel Bernard resolved EJB-221:
----------------------------------
Resolution: Fixed
> 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
> Versions: 3.2.0.cr1
> Reporter: Christian Bauer
> Assignee: Emmanuel Bernard
> Priority: Blocker
> Fix For: 3.2.0.cr3
> 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