[hibernate-issues] [Hibernate-JIRA] Created: (HHH-4923) EnitityManager returning lazy proxy
Billy Bob (JIRA)
noreply at atlassian.com
Tue Feb 16 15:23:47 EST 2010
EnitityManager returning lazy proxy
-----------------------------------
Key: HHH-4923
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4923
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.2
Environment: JBoss - MySQL 5.1 - JDK6
Reporter: Billy Bob
Depending on the order I read entities, sometimes an em.find() returns a javassist proxy. I have the following simplified entity mapping:
class A {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
}
class B extends A {
}
class C extends A {
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(nullable=false)
private A ref;
}
For both scenarios, I have an entity of type B stored with id 20 and an entity of type C stored with id 30 with a reference to the first object with id 20.
Scenario - 1:
em.find(A.class, 30); // Returns type C, lazy reference of B is loaded into session
em.find(A.class, 20); // Error: Returns javassist proxy instead of type B
Scenario - 2:
em.find(A.class, 20); // Returns type B, since not loaded by C lazy reference
em.find(A.class, 30); // Returns type C
Should a call to EntityManager.find() ever return a lazy proxy?
--
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