From 412d5d6fca676afdc536909d4befda1d4ca5e536 Mon Sep 17 00:00:00 2001 From: Gail Badner Date: Wed, 20 Nov 2013 04:18:22 -0800 Subject: [PATCH] HHH-8662 : Deprecate functionality for initialized many-to-many collections of proxies --- .../java/org/hibernate/cfg/HbmBinder.java | 38 ++++++++++++++----- .../hibernate/internal/CoreMessageLogger.java | 8 ++++ .../org/hibernate/test/legacy/FooBarTest.java | 6 +-- 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/HbmBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/HbmBinder.java index 15f4ad1fea..92022c865e 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/HbmBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/HbmBinder.java @@ -2095,21 +2095,41 @@ public final class HbmBinder { } } else { - // use old (HB 2.1) defaults if outer-join is specified - String eoj = jfNode.getValue(); - if ( "auto".equals( eoj ) ) { - fetchStyle = FetchMode.DEFAULT; + if ( "many-to-many".equals( node.getName() ) ) { + //NOTE , , , , or , which will only initialize entities (not as a proxy) as needed.", id = 454) + void deprecatedManyToManyOuterJoin(); + + @LogMessage(level = WARN) + @Message(value = "The fetch attribute on has been deprecated. Instead of fetch=\"select\", use lazy=\"extra\" with , , , , or , which will only initialize entities (not as a proxy) as needed.", id = 455) + void deprecatedManyToManyFetch(); + } diff --git a/hibernate-core/src/test/java/org/hibernate/test/legacy/FooBarTest.java b/hibernate-core/src/test/java/org/hibernate/test/legacy/FooBarTest.java index 7a5fc29cc0..c56710181b 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/legacy/FooBarTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/legacy/FooBarTest.java @@ -4808,8 +4808,7 @@ public class FooBarTest extends LegacyTestCase { s.close(); } - @Test - @FailureExpected( jiraKey = "HHH-8662") + @TestForIssue( jiraKey = "HHH-8662" ) public void testProxiesInCollections() throws Exception { Session s = openSession(); s.beginTransaction(); @@ -4847,7 +4846,8 @@ public class FooBarTest extends LegacyTestCase { BarProxy b1 = (BarProxy) i.next(); BarProxy b2 = (BarProxy) i.next(); assertTrue( ( b1==barprox && !(b2 instanceof HibernateProxy) ) || ( b2==barprox && !(b1 instanceof HibernateProxy) ) ); //one-to-many - assertTrue( baz.getFooArray()[0] instanceof HibernateProxy ); //many-to-many + //