Use of UpdateManager and SchemaFactory together may not yield expected results.
-------------------------------------------------------------------------------
Key: OPENJPA-2064
URL: https://issues.apache.org/jira/browse/OPENJPA-2064
Project: OpenJPA
Issue Type: Bug
Components: jdbc
Affects Versions: 2.2.0
Reporter: Heath Thomann
Assignee: Heath Thomann
Priority: Minor
Take the issue and solutions described
https://issues.apache.org/jira/browse/OPENJPA-1936. The JIRA describes a
situation where a constraint violation can occur. One of the solutions is to
set the following property:
<property name="openjpa.jdbc.SchemaFactory" value="native(ForeignKeys=true)"/>
However, the same constraint violation can reoccur which the above
SchemaFactory property is used in combination with the following UpdateManager
(UM) setting:
<property name="openjpa.jdbc.UpdateManager" value="operation-order"/>
When a user sets
'operation-order' on the UM, it tells the UM to specifically honor the order of the operations (e.g.
inserts, removes). For example, the 'Parent' entity described in OPENJPA-1936
may be removed by the user's app (a remove operation) before the 'Child'
entity. Using just the SchemaFactory setting alone, OpenJPA would detect the
constraint violation and actually order the deletes such that the 'Child'
entity is removed first, then the 'Parent' (even though the user's operations
where the opposite). However, when the above UM property is used, the order in
which the user's code executes the remove operations will be honored. This can
lead to confusion, that is, the user may expect the SchemaFactory to always
detect, and handle, a database constraint.
While there is nothing wrong with the two properties being used together, it
would be helpful for OpenJPA to detect that a user is using the above two
properties and log a warning in the event a constrain violation is detected at
runtime. This JIRA will be used to investigate such a warning. A test will
soon follow which will reproduce a constrain violation when the two properties
are used together.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira