mirror of https://github.com/apache/openjpa.git
OPENJPA-715. Committing the testcase provided by Ekin Sokmen and the patch provided by Fay Wang. Committing the change for both the 1.2.x service stream and 1.3.0 snapshot (trunk).
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@693282 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
52a0f63097
commit
8e6db6cb65
|
@ -356,7 +356,7 @@ public class TableJDBCSeq
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the primary key value for the given class.
|
* Return the primary key value for the sequence table for the given class.
|
||||||
*/
|
*/
|
||||||
protected Object getPrimaryKey(ClassMapping mapping) {
|
protected Object getPrimaryKey(ClassMapping mapping) {
|
||||||
return Numbers.valueOf(0);
|
return Numbers.valueOf(0);
|
||||||
|
|
|
@ -755,8 +755,12 @@ class SingleFieldManager
|
||||||
.setFailedObject(obj);
|
.setFailedObject(obj);
|
||||||
} else {
|
} else {
|
||||||
sm = _broker.getStateManager(obj);
|
sm = _broker.getStateManager(obj);
|
||||||
if (sm == null || !sm.isProvisional())
|
if (sm == null || !sm.isProvisional()) {
|
||||||
sm = _broker.persist(obj, null, true, call);
|
sm = _broker.persist(obj, null, true, call);
|
||||||
|
// ensure generated IDs get assigned properly
|
||||||
|
if (!logical)
|
||||||
|
((StateManagerImpl)sm).assignObjectId(false, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sm != null) {
|
if (sm != null) {
|
||||||
|
|
|
@ -512,7 +512,7 @@ public class StateManagerImpl
|
||||||
* Ask store manager to assign our oid, optionally flushing and
|
* Ask store manager to assign our oid, optionally flushing and
|
||||||
* optionally recaching on the new oid.
|
* optionally recaching on the new oid.
|
||||||
*/
|
*/
|
||||||
private boolean assignObjectId(boolean flush, boolean preFlushing) {
|
boolean assignObjectId(boolean flush, boolean preFlushing) {
|
||||||
if (_oid != null || isEmbedded() || !isPersistent())
|
if (_oid != null || isEmbedded() || !isPersistent())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue