openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Heath Thomann (Updated) (JIRA)" <>
Subject [jira] [Updated] (OPENJPA-2064) Use of UpdateManager and SchemaFactory together may not yield expected results.
Date Tue, 25 Oct 2011 16:38:32 GMT


Heath Thomann updated OPENJPA-2064:


I have a test I created and ran on 1.2.x and 2.0.x.  I'm attaching two files.  One is named which is an Eclipse/Maven test case which demonstrates a 'constraint violation'
exception with different UpdateManager and SchemaFactory settings.  The other file is named
createDB.sql which is the sql (for DB2) needed for the test.  The SQL adds a foreign key constrain
between the two tables.
> Use of UpdateManager and SchemaFactory together may not yield expected results.
> -------------------------------------------------------------------------------
>                 Key: OPENJPA-2064
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jdbc
>    Affects Versions: 1.2.2, 2.0.0
>            Reporter: Heath Thomann
>            Assignee: Heath Thomann
>            Priority: Minor
>         Attachments:, createDB2.sql
> Take the issue and solutions described
 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:!default.jspa
For more information on JIRA, see:


View raw message