Issue Type: Bug Bug
Affects Versions: 4.1.9
Assignee: Unassigned
Attachments: ClassMetadataTest.java, CompositionItem.java, Composition.java
Components: metamodel
Created: 28/Feb/13 6:35 AM
Description:

http://stackoverflow.com/questions/15133569/empty-collection-being-returned-by-classmetadata-getpropertyvalueinitializedpro

I have an entity A which has a Lazy List. I load a proxy of A, and initialize it. I get sessionFactory.getClassMetadata(A.class). I use this metadata to load the list property on the initialized proxy of A. The list property is mappedBy the @ManyToOne on B, and there are values of B which point to that particular instance of A.

The result of getPropertyValue is an empty collection. Trying to initialize it via Hibernate.initialize does nothing.

Assuming you have all necessary dependencies in your classpath (Spring, HSQLDB etc), the attached files should provide a failing JUnit test for this problem.

Interesting fact: If I remove the initialization of the variable items in Composition, I'll have a NullPointerException instead of an AssertionError at the last line of the test. It seems the mappedBy is not being taken into account.

Environment: HSQL, Postgres
Project: Hibernate ORM
Labels: metamodel
Priority: Minor Minor
Reporter: Tiago Rinck Caveden
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira