Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Cannot Reproduce
-
2.1.1
-
None
-
None
Description
I have business object model with below structure
Class A
{ private B b; }Class B {
private String joinKey;
private List<C> c;
}
Class C {
private String joinKey;
private String str1;
private String str2;
}
In the ORM.xml,I have specified mapping like this
<entity class="xxx.xxx.A">
<table name="table1"/>
<attributes>
<one-to-one name="name1" target-entity="xxx.xxx.B">
<join-column name='"column1"' referenced-column-name='"column1"'/>
</one-to-one>
</attributes>
</entity>
<entity class="xxx.xxx.B">
<table name="table2"/>
<attributes>
<basic name="joinKey">
<column name="column1"/>
</basic>
<one-to-many name="name1" target-entity="xxx.xxx.C">
<join-column name='"column1"' referenced-column-name='"column1"'/>
</one-to-many>
</attributes>
</entity>
<entity class="xxx.xxx.C">
<attributes>
<basic name="joinKey">
<column name="column1"/>
</basic>
<basic name="str1">
<column name="str1Column"/>
</basic>
<basic name="str2">
<column name="str2Column"/>
</basic>
</attributes>
</entity>
The one-to-many mapping specified in the entity C does not work by both approach 1) JoinColumn 2) JoinTable. My code skips this mapping while generating SQL query.
But instead of one-to-many mapping If I specify one-to-one mapping and change class B to replace "private List<C> c;" with "private C c;" then the one-to-one mapping works fine.
I am using OPENJpa 2.1.1, as per the documentation one-to-many mapping should work but it seems OPENJpa 2.1.1 API is working as expected. It seems there is bug in API.
Can you please advise to fix this issue?