]
Gail Badner commented on HHH-3798:
----------------------------------
This may be related to HHH-4991.
Can you try increasing max_fetch_depth to see if that works?
failure to lazy load a manyToOne and oneToMany mapped entity
------------------------------------------------------------
Key: HHH-3798
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3798
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.1, 3.5.0.Beta-1
Environment: hibernate annotations test case, maven profile hsqldb, svn rev
16079
hibernate-core 3.3.1.GA, JBoss 4.2.3, SQLServer 2000
Reporter: Ronald Kurz
Attachments: test-case.tar.gz, test-case2.tar.gz
Following situtation: an entity Data has Revision entities (oneToMany). Each Revision
entity belongs to a Data entity. The Data entity has one manyToOne mapping to the current
Revision. The mappings from Data to Revision are all lazy.
When loading a Data entity, which has two Revisions, the Revision entity which is also
mapped as manyToOne (the current Revision for that Data entity), does not get loaded. It
will be an uninitialized proxy, which is also resistent to
Hibernate.initialize(<Data>.revision). The same proxy is also in the oneToMany
mapped list.
@Entity
public class Data {
@Id @GeneratedValue
public int id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "revisionId")
public Revision revision;
@OneToMany(mappedBy = "data")
public List<Revision> revisions = new ArrayList<Revision>();
}
@Entity
public class Revision {
@Id @GeneratedValue
public int id;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "dataId", nullable = false, updatable = false)
public Data data;
public Integer number;
}
The test case is written for the hibernate-annotations project (simply because I never
wrote a mapping using xml)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: