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:
Kevin W. Sutter 2008-09-08 21:32:17 +00:00
parent 52a0f63097
commit 8e6db6cb65
3 changed files with 7 additions and 3 deletions

View File

@ -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) {
return Numbers.valueOf(0);

View File

@ -755,8 +755,12 @@ class SingleFieldManager
.setFailedObject(obj);
} else {
sm = _broker.getStateManager(obj);
if (sm == null || !sm.isProvisional())
if (sm == null || !sm.isProvisional()) {
sm = _broker.persist(obj, null, true, call);
// ensure generated IDs get assigned properly
if (!logical)
((StateManagerImpl)sm).assignObjectId(false, true);
}
}
if (sm != null) {

View File

@ -512,7 +512,7 @@ public class StateManagerImpl
* Ask store manager to assign our oid, optionally flushing and
* optionally recaching on the new oid.
*/
private boolean assignObjectId(boolean flush, boolean preFlushing) {
boolean assignObjectId(boolean flush, boolean preFlushing) {
if (_oid != null || isEmbedded() || !isPersistent())
return true;