[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3230) getEntityName() throws org.hibernate.TransientObjectException: proxy was not associated with the session

Hernán Chanfreau (JIRA) noreply at atlassian.com
Thu Jan 20 12:57:05 EST 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=39718#action_39718 ] 

Hernán Chanfreau commented on HHH-3230:
---------------------------------------

Hi!
Diego and I work together in the same project.
Just to clarify, the test fails running on 3.6.1-SNAPSHOT.

Regards. Hernán.

> getEntityName() throws org.hibernate.TransientObjectException: proxy was not associated with the session
> --------------------------------------------------------------------------------------------------------
>
>                 Key: HHH-3230
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3230
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.2
>         Environment: Mac OS X, JDK 1.5
>            Reporter: Howard M. Lewis Ship
>         Attachments: Debugging output from IDEA.jpg, NarrowingProxyTestCase.zip
>
>
> I'm retrieving an entity that contains a OneToMany relationship.
> The master entity is retrieved, within a transaction, via Session.get(Class,Serializable).
> @Entity
> public class MapUnitSurvey extends ActiveDO
> {
>        @ManyToOne(fetch = FetchType.LAZY)
>     private VegetationType vegetationType;
> }
> @Entity
> public class VegetationType extends AbstractEnum
> {
> }
> ActiveDO and AbstractEnum are abstract base classes with @MappedSuperclass.
> I retrieve the vegationType:
>    VegetationType type = survey.getVegetationType();
> Then I need the type's entity name
> 	String entityName = session.getEntityName(type);
> 			
> This fails with the TransientObjectException.
> Inspecting with the debugger, I see that type is a CGLIB-enhanced proxy, and that there's a fully initialized bean in the target field of the proxy.  I'll attach a screenshot of some debugging data.
> In summary; the entity was retrieved via a lazy fetch, appears the be correct, seems to be in the session and yet the exception occurs.
> I've tried to resolve this by re-fetching the object from the session, and a few other tries, with no luck.

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