[hibernate-issues] [Hibernate-JIRA] Updated: (EJB-221) TransientObjectException with FetchType.LAZY on @ManyToOne and field access on target entity

Emmanuel Bernard (JIRA) noreply at atlassian.com
Wed Sep 6 16:35:24 EDT 2006


     [ http://opensource.atlassian.com/projects/hibernate/browse/EJB-221?page=all ]

Emmanuel Bernard updated EJB-221:
---------------------------------

    Fix Version:     (was: 3.2.0.cr1)
        Version: 3.2.0.cr1

> 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.cr2
>  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