Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HHH-5255 Fix merging of lazy basic properties (4.3) #891

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -173,6 +173,10 @@ else if ( row[i] == LazyPropertyInitializer.UNFETCHED_PROPERTY || row[i] == Back
|| original[i] == BackrefPropertyAccessor.UNKNOWN ) {
copied[i] = target[i];
}
else if (target[i] == LazyPropertyInitializer.UNFETCHED_PROPERTY
|| target[i] == BackrefPropertyAccessor.UNKNOWN) {
copied[i] = original[i];
}
else {
copied[i] = types[i].replace( original[i], target[i], session, owner, copyCache );
}
@@ -24,14 +24,14 @@
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;
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;
@@ -89,6 +89,11 @@ public void testLazyPropertyCustomTypeExecutable() throws Exception {
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();
}
}
@@ -123,6 +123,11 @@ public void testLazyPropertyCustomType() {
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" );
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.