HHH-7831 - no-proxy attribute should be lazy instead of throwing exception

This commit is contained in:
Strong Liu 2012-11-28 18:17:45 +08:00
parent 9b3e6a3714
commit 7c48f03874
5 changed files with 15 additions and 22 deletions

View File

@ -178,7 +178,7 @@ class ManyToOneAttributeSourceImpl extends AbstractHbmSourceNode implements ToOn
else if ( "extra".equals( lazySelection ) ) {
return FetchTiming.EXTRA_DELAYED;
}
else if ( "true".equals( lazySelection ) || "proxy".equals( lazySelection ) ) {
else if ( "true".equals( lazySelection ) || "proxy".equals( lazySelection ) || "no-proxy".equals( lazySelection )) {
return FetchTiming.DELAYED;
}
else if ( "false".equals( lazySelection ) ) {

View File

@ -38,7 +38,6 @@ import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.proxy.LazyInitializer;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@ -52,7 +51,6 @@ import static org.junit.Assert.fail;
*
* @author Gail Badner
*/
@FailureExpectedWithNewMetamodel
public class ReadOnlyProxyTest extends AbstractReadOnlyTest {
@Override
public String[] getMappings() {

View File

@ -67,7 +67,6 @@ import static org.junit.Assert.assertTrue;
*
* @author Gail Badner
*/
@FailureExpectedWithNewMetamodel
public class ReadOnlySessionLazyNonLazyTest extends AbstractReadOnlyTest {
@Override
public String[] getMappings() {
@ -76,6 +75,7 @@ public class ReadOnlySessionLazyNonLazyTest extends AbstractReadOnlyTest {
@Test
@SuppressWarnings( {"unchecked"})
@FailureExpectedWithNewMetamodel
public void testExistingModifiableAfterSetSessionReadOnly() {
Container cOrig = createContainer();
Set expectedInitializedObjects = new HashSet(
@ -170,7 +170,7 @@ public class ReadOnlySessionLazyNonLazyTest extends AbstractReadOnlyTest {
s.close();
}
@FailureExpectedWithNewMetamodel
@Test
@SuppressWarnings( {"unchecked"})
public void testExistingReadOnlyAfterSetSessionModifiable() {
@ -260,7 +260,7 @@ public class ReadOnlySessionLazyNonLazyTest extends AbstractReadOnlyTest {
s.close();
}
@FailureExpectedWithNewMetamodel
@Test
@SuppressWarnings( {"unchecked"})
public void testExistingReadOnlyAfterSetSessionModifiableExisting() {
@ -351,7 +351,7 @@ public class ReadOnlySessionLazyNonLazyTest extends AbstractReadOnlyTest {
s.close();
}
@FailureExpectedWithNewMetamodel
@SuppressWarnings( {"unchecked"})
@Test
public void testExistingReadOnlyAfterSetSessionModifiableExistingEntityReadOnly() {
@ -445,7 +445,7 @@ public class ReadOnlySessionLazyNonLazyTest extends AbstractReadOnlyTest {
s.close();
}
@FailureExpectedWithNewMetamodel
@SuppressWarnings( {"unchecked"})
@Test
public void testExistingReadOnlyAfterSetSessionModifiableProxyExisting() {
@ -536,7 +536,7 @@ public class ReadOnlySessionLazyNonLazyTest extends AbstractReadOnlyTest {
s.close();
}
@FailureExpectedWithNewMetamodel
@SuppressWarnings( {"unchecked"})
@Test
public void testExistingReadOnlyAfterSetSessionModifiableExistingProxyReadOnly() {
@ -629,7 +629,7 @@ public class ReadOnlySessionLazyNonLazyTest extends AbstractReadOnlyTest {
t.commit();
s.close();
}
@FailureExpectedWithNewMetamodel
@SuppressWarnings( {"unchecked"})
@Test
public void testDefaultModifiableWithReadOnlyQueryForEntity() {
@ -716,7 +716,7 @@ public class ReadOnlySessionLazyNonLazyTest extends AbstractReadOnlyTest {
t.commit();
s.close();
}
@FailureExpectedWithNewMetamodel
@SuppressWarnings( {"unchecked"})
@Test
public void testDefaultReadOnlyWithModifiableQueryForEntity() {
@ -791,7 +791,7 @@ public class ReadOnlySessionLazyNonLazyTest extends AbstractReadOnlyTest {
t.commit();
s.close();
}
@FailureExpectedWithNewMetamodel
@SuppressWarnings( {"unchecked"})
@Test
public void testDefaultReadOnlyWithQueryForEntity() {
@ -879,7 +879,7 @@ public class ReadOnlySessionLazyNonLazyTest extends AbstractReadOnlyTest {
t.commit();
s.close();
}
@FailureExpectedWithNewMetamodel
@SuppressWarnings( {"unchecked"})
@Test
public void testDefaultModifiableWithQueryForEntity() {
@ -953,7 +953,6 @@ public class ReadOnlySessionLazyNonLazyTest extends AbstractReadOnlyTest {
t.commit();
s.close();
}
@SuppressWarnings( {"unchecked"})
@Test
public void testDefaultModifiableWithReadOnlyQueryForCollectionEntities() {
@ -1002,7 +1001,7 @@ public class ReadOnlySessionLazyNonLazyTest extends AbstractReadOnlyTest {
t.commit();
s.close();
}
@FailureExpectedWithNewMetamodel
@Test
@SuppressWarnings( {"unchecked"})
public void testDefaultReadOnlyWithModifiableFilterCollectionEntities() {
@ -1094,7 +1093,7 @@ public class ReadOnlySessionLazyNonLazyTest extends AbstractReadOnlyTest {
t.commit();
s.close();
}
@FailureExpectedWithNewMetamodel
@SuppressWarnings( {"unchecked"})
@Test
public void testDefaultModifiableWithReadOnlyFilterCollectionEntities() {
@ -1172,7 +1171,7 @@ public class ReadOnlySessionLazyNonLazyTest extends AbstractReadOnlyTest {
t.commit();
s.close();
}
@FailureExpectedWithNewMetamodel
@SuppressWarnings( {"unchecked"})
@Test
public void testDefaultReadOnlyWithFilterCollectionEntities() {
@ -1261,7 +1260,7 @@ public class ReadOnlySessionLazyNonLazyTest extends AbstractReadOnlyTest {
t.commit();
s.close();
}
@FailureExpectedWithNewMetamodel
@SuppressWarnings( {"unchecked"})
@Test
public void testDefaultModifiableWithFilterCollectionEntities() {

View File

@ -37,7 +37,6 @@ import org.hibernate.ScrollableResults;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@ -48,7 +47,6 @@ import static org.junit.Assert.assertTrue;
/**
* @author Gail Badner
*/
@FailureExpectedWithNewMetamodel
public class ReadOnlySessionTest extends AbstractReadOnlyTest {
@Override
public String[] getMappings() {

View File

@ -33,7 +33,6 @@ import org.hibernate.ScrollMode;
import org.hibernate.ScrollableResults;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.testing.FailureExpectedWithNewMetamodel;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@ -46,7 +45,6 @@ import static org.junit.Assert.assertTrue;
* @author Gavin King
* @author Gail Badner
*/
@FailureExpectedWithNewMetamodel
public class ReadOnlyTest extends AbstractReadOnlyTest {
@Override
public String[] getMappings() {