24
24
import org .hibernate .testing .TestForIssue ;
25
25
import org .hibernate .testing .jdbc .SQLStatementInspector ;
26
26
import org .hibernate .testing .orm .junit .DomainModel ;
27
+ import org .hibernate .testing .orm .junit .FailureExpected ;
27
28
import org .hibernate .testing .orm .junit .ServiceRegistry ;
28
29
import org .hibernate .testing .orm .junit .SessionFactory ;
29
30
import org .hibernate .testing .orm .junit .SessionFactoryScope ;
@@ -249,7 +250,7 @@ public void testNonExistentIdRequest(SessionFactoryScope scope) {
249
250
public void testBasicMultiLoadWithManagedAndNoChecking (SessionFactoryScope scope ) {
250
251
scope .inTransaction (
251
252
session -> {
252
- SimpleEntity first = session .byId ( SimpleEntity .class ).getReference ( 1 );
253
+ SimpleEntity first = session .byId ( SimpleEntity .class ).load ( 1 );
253
254
List <SimpleEntity > list = session .byMultipleIds ( SimpleEntity .class ).multiLoad ( ids ( 56 ) );
254
255
assertEquals ( 56 , list .size () );
255
256
// this check is HIGHLY specific to implementation in the batch loader
@@ -261,6 +262,36 @@ public void testBasicMultiLoadWithManagedAndNoChecking(SessionFactoryScope scope
261
262
262
263
@ Test
263
264
public void testBasicMultiLoadWithManagedAndChecking (SessionFactoryScope scope ) {
265
+ scope .inTransaction (
266
+ session -> {
267
+ SimpleEntity first = session .byId ( SimpleEntity .class ).load ( 1 );
268
+ List <SimpleEntity > list = session .byMultipleIds ( SimpleEntity .class )
269
+ .enableSessionCheck ( true )
270
+ .multiLoad ( ids ( 56 ) );
271
+ assertEquals ( 56 , list .size () );
272
+ // this check is HIGHLY specific to implementation in the batch loader
273
+ // which puts existing managed entities first...
274
+ assertSame ( first , list .get ( 0 ) );
275
+ }
276
+ );
277
+ }
278
+
279
+ @ Test @ FailureExpected (jiraKey = "HHH-18544" )
280
+ public void testBasicMultiLoadWithManagedAndNoCheckingProxied (SessionFactoryScope scope ) {
281
+ scope .inTransaction (
282
+ session -> {
283
+ SimpleEntity first = session .byId ( SimpleEntity .class ).getReference ( 1 );
284
+ List <SimpleEntity > list = session .byMultipleIds ( SimpleEntity .class ).multiLoad ( ids ( 56 ) );
285
+ assertEquals ( 56 , list .size () );
286
+ // this check is HIGHLY specific to implementation in the batch loader
287
+ // which puts existing managed entities first...
288
+ assertSame ( first , list .get ( 0 ) );
289
+ }
290
+ );
291
+ }
292
+
293
+ @ Test @ FailureExpected (jiraKey = "HHH-18544" )
294
+ public void testBasicMultiLoadWithManagedAndCheckingProxied (SessionFactoryScope scope ) {
264
295
scope .inTransaction (
265
296
session -> {
266
297
SimpleEntity first = session .byId ( SimpleEntity .class ).getReference ( 1 );
0 commit comments