]
Diego del Río updated HHH-3230:
-------------------------------
Attachment: NarrowingProxyTestCase.zip
TestCase, based on the class {{org.hibernate.junit.functional.FunctionalTestCase}}
belonging to the package hibernate-testing, that reproduces the exception
{{org.hibernate.TransientObjectException}} thrown in the method
{{Session.getEntityName(String)}}. Included in the file there are also the entity classes
and the mapping files.
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: