A fix is available
APAR status
Closed as program error.
Error description
When the SQL for a named query is generated, the "name" attribute of a @JoinColumn is ignored when the "table" attribute is also specified. This issue is specific to JPA 2.x only. The following error may be noted ERROR: DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=T1.OWNER_EMPNO, DRIVER=3.57.82 {prepstmnt 65007978 SELECT t0.hwserial, t0.hwtype, t1.empno, t0.hwname, t2.empno, t2.empname FROM HWASSETS t0 INNER JOIN HWASSETSOWNERSHIP t1 ON t0.hwtype = t1.HWTYPE AND t0.hwserial = t1.HWSERIAL LEFT OUTER JOIN PEOPLE t2 ON t1.OWNER_EMPNO = t2.empno WHERE (t1.empno = ?) [params=?]} [code=-206, state=42703]SQLCA OUTPUT[Errp=SQLNQ075, Errd=-2145779603, 0, 0, 0, -10, 0] DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=T1.OWNER_EMPNO, DRIVER=3.57.82 DB2 SQL Error: SQLCODE=-727, SQLSTATE=56098, SQLERRMC=2;-206;42703;T1.OWNER_EMPNO, DRIVER=3.57.82 DB2 SQL Error: SQLCODE=-727, SQLSTATE=56098, SQLERRMC=2;-206;42703;T1.OWNER_EMPNO, DRIVER=3.57.82
Local fix
try adding the following line to the preperties section of the persistence.xml file <property name="openjpa.Compatibility" value="NonDefaultMappingAllowed=false"/>
Problem summary
**************************************************************** * USERS AFFECTED: All users of IBM WebSphere Application * * Server Liberty Profile * **************************************************************** * PROBLEM DESCRIPTION: JoinColumn annotation is ignored when * * mapping a unidirectional owned OneToOne * * that is in a SecondaryTable. * **************************************************************** * RECOMMENDATION: * **************************************************************** The OpenJPA runtime incorrectly ignores @JoinColumn name when mapping a unidirectional owned OneToOne that is in a SecondaryTable. This problem only exists when running with a persistence.xml that is set to 2.0 (version="2.0">). For example: @Entity @SecondaryTable(name = "ParentSecondaryTable", pkJoinColumns = { @PrimaryKeyJoinColumn(name = "idParent", referencedColumnName = "idParent") }) public class Parent { @Id @GeneratedValue int idParent; String child_ref; @OneToOne @JoinColumn(name = "CHILD_REF", table = "ParentSecondaryTable", referencedColumnName = "idChild") PChild child; } The column "CHILD_REF" will be ignored and the runtime will look for the Foreign Key in non-existent column ParentSecondaryTable.CHILD_IDCHILD.
Problem conclusion
With this fix, code has been added to OpenJPA to ensure the JoinColumn annotation's name field is not ignored in a unidirectional OneToOne mapping that is in a SecondaryTable The fix for this APAR is currently targeted for inclusion in fix pack 8.5.0.2. Please refer to the Recommended Updates page for delivery information: http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980
Temporary fix
Comments
APAR Information
APAR number
PM80441
Reported component name
LIBERTY PROFILE
Reported component ID
5724J0814
Reported release
850
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2013-01-11
Closed date
2013-03-08
Last modified date
2013-03-08
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
LIBERTY PROFILE
Fixed component ID
5724J0814
Applicable component levels
R850 PSY
UP
[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"850","Line of Business":{"code":"LOB45","label":"Automation"}}]
Document Information
Modified date:
29 October 2021