parent
539465915b
commit
3d21604602
|
@ -7,7 +7,6 @@
|
|||
package org.hibernate.test.instrument.buildtime;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.hibernate.bytecode.instrumentation.internal.FieldInterceptionHelper;
|
||||
import org.hibernate.test.instrument.cases.Executable;
|
||||
import org.hibernate.test.instrument.cases.TestCustomColumnReadAndWrite;
|
||||
|
@ -15,6 +14,7 @@ import org.hibernate.test.instrument.cases.TestDirtyCheckExecutable;
|
|||
import org.hibernate.test.instrument.cases.TestFetchAllExecutable;
|
||||
import org.hibernate.test.instrument.cases.TestInjectFieldInterceptorExecutable;
|
||||
import org.hibernate.test.instrument.cases.TestIsPropertyInitializedExecutable;
|
||||
import org.hibernate.test.instrument.cases.TestLazyBasicPropertyUpdateExecutable;
|
||||
import org.hibernate.test.instrument.cases.TestLazyExecutable;
|
||||
import org.hibernate.test.instrument.cases.TestLazyManyToOneExecutable;
|
||||
import org.hibernate.test.instrument.cases.TestLazyPropertyCustomTypeExecutable;
|
||||
|
@ -72,6 +72,11 @@ public class InstrumentTest extends BaseUnitTestCase {
|
|||
execute( new TestLazyPropertyCustomTypeExecutable() );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLazyBasicPropertyUpdate() throws Exception {
|
||||
execute( new TestLazyBasicPropertyUpdateExecutable() );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSharedPKOneToOne() throws Exception {
|
||||
execute( new TestSharedPKOneToOneExecutable() );
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package org.hibernate.test.instrument.cases;
|
||||
import org.junit.Assert;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.test.instrument.domain.Document;
|
||||
import org.hibernate.test.instrument.domain.Folder;
|
||||
import org.hibernate.test.instrument.domain.Owner;
|
||||
|
||||
/**
|
||||
* @author Andrei Ivanov
|
||||
*/
|
||||
public class TestLazyBasicPropertyUpdateExecutable extends AbstractExecutable {
|
||||
public void execute() {
|
||||
Session s = getFactory().openSession();
|
||||
Transaction t = s.beginTransaction();
|
||||
Owner o = new Owner();
|
||||
Document doc = new Document();
|
||||
Folder fol = new Folder();
|
||||
o.setName("gavin");
|
||||
doc.setName("Hibernate in Action");
|
||||
doc.setSummary("blah");
|
||||
doc.updateText("blah blah");
|
||||
fol.setName("books");
|
||||
doc.setOwner(o);
|
||||
doc.setFolder(fol);
|
||||
fol.getDocuments().add(doc);
|
||||
Assert.assertTrue( Hibernate.isPropertyInitialized( doc, "summary" ) );
|
||||
s.persist(o);
|
||||
s.persist(fol);
|
||||
t.commit();
|
||||
|
||||
s.evict(doc);
|
||||
|
||||
doc.setSummary("u");
|
||||
s.merge(doc);
|
||||
|
||||
s.close();
|
||||
}
|
||||
}
|
|
@ -115,6 +115,11 @@ public abstract class AbstractTransformingClassLoaderInstrumentTestCase extends
|
|||
executeExecutable( "org.hibernate.test.instrument.cases.TestLazyPropertyCustomTypeExecutable" );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLazyBasicPropertyUpdate() {
|
||||
executeExecutable( "org.hibernate.test.instrument.cases.TestLazyBasicPropertyUpdateExecutable" );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSharedPKOneToOne() {
|
||||
executeExecutable( "org.hibernate.test.instrument.cases.TestSharedPKOneToOneExecutable" );
|
||||
|
|
Loading…
Reference in New Issue