HHH-9189 HHH-9189 : Initial value for sequence in HBM mapping

This commit is contained in:
Gail Badner 2014-05-14 16:47:08 -07:00
parent e4426c9249
commit 483bfdb74d
3 changed files with 9 additions and 7 deletions

View File

@ -63,8 +63,7 @@ public class EntityLoader extends AbstractLoadPlanBasedEntityLoader {
private final OuterJoinLoadable persister; private final OuterJoinLoadable persister;
private int batchSize = 1; private int batchSize = 1;
private LoadQueryInfluencers influencers = LoadQueryInfluencers.NONE; private LoadQueryInfluencers influencers = LoadQueryInfluencers.NONE;
private LockMode lockMode = LockMode.NONE; private LockOptions lockOptions = new LockOptions( LockMode.NONE );
private LockOptions lockOptions;
public Builder(OuterJoinLoadable persister) { public Builder(OuterJoinLoadable persister) {
this.persister = persister; this.persister = persister;
@ -81,7 +80,7 @@ public class EntityLoader extends AbstractLoadPlanBasedEntityLoader {
} }
public Builder withLockMode(LockMode lockMode) { public Builder withLockMode(LockMode lockMode) {
this.lockMode = lockMode; this.lockOptions.setLockMode( lockMode );
return this; return this;
} }
@ -113,7 +112,7 @@ public class EntityLoader extends AbstractLoadPlanBasedEntityLoader {
@Override @Override
public LockMode getLockMode() { public LockMode getLockMode() {
return lockMode; return lockOptions.getLockMode();
} }
@Override @Override

View File

@ -4,8 +4,10 @@ import static org.junit.Assert.assertTrue;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.Transaction; import org.hibernate.Transaction;
import org.hibernate.dialect.H2Dialect;
import org.hibernate.dialect.SQLServer2012Dialect; import org.hibernate.dialect.SQLServer2012Dialect;
import org.hibernate.testing.DialectChecks; import org.hibernate.testing.DialectChecks;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.RequiresDialectFeature; import org.hibernate.testing.RequiresDialectFeature;
import org.hibernate.testing.SkipForDialect; import org.hibernate.testing.SkipForDialect;
@ -13,11 +15,11 @@ import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test; import org.junit.Test;
public class SQLServer2012SequenceGeneratorTest extends BaseCoreFunctionalTestCase { public class SequenceGeneratorWithInitialValueTest extends BaseCoreFunctionalTestCase {
@Override @Override
public String[] getMappings() { public String[] getMappings() {
return new String[] { "id/SQLServer2012Person.hbm.xml" }; return new String[] { "id/PersonWithSequenceInitialValue.hbm.xml" };
} }
/** /**
@ -27,7 +29,8 @@ public class SQLServer2012SequenceGeneratorTest extends BaseCoreFunctionalTestCa
*/ */
@Test @Test
@TestForIssue(jiraKey = "HHH-8814") @TestForIssue(jiraKey = "HHH-8814")
@RequiresDialect(value=SQLServer2012Dialect.class) @FailureExpectedWithNewMetamodel(jiraKey = "HHH-9189")
@RequiresDialect(value={SQLServer2012Dialect.class, H2Dialect.class})
public void testStartOfSequence() throws Exception { public void testStartOfSequence() throws Exception {
Session s = openSession(); Session s = openSession();
Transaction tx = s.beginTransaction(); Transaction tx = s.beginTransaction();