File tree Expand file tree Collapse file tree 2 files changed +3
-6
lines changed 
hibernate-core/src/test/java/org/hibernate/orm/test/annotations/subselect Expand file tree Collapse file tree 2 files changed +3
-6
lines changed Original file line number Diff line number Diff line change 1414 * 
1515 */ 
1616@ Entity 
17- @ Subselect ("select Item .name as name, max(Bid .amount) as amount from Item, Bid where Bid .itemId = Item .id group by Item .name" )
17+ @ Subselect ("select i .name as name, max(b .amount) as amount from Item i , Bid b  where b .itemId = i .id group by i .name" )
1818@ Synchronize ({"Item" , "Bid" })
1919public  class  HighestBid  {
2020
Original file line number Diff line number Diff line change 77import  org .junit .Assert ;
88import  org .junit .Test ;
99
10- import  org .hibernate .query .Query ;
1110import  org .hibernate .Session ;
1211import  org .hibernate .Transaction ;
1312import  org .hibernate .testing .junit4 .BaseCoreFunctionalTestCase ;
@@ -45,15 +44,13 @@ public void testSubselectWithSynchronize() {
4544		s .persist (bid2 );
4645
4746		//Because we use 'synchronize' annotation, this query should trigger session flush 
48- 		Query  query  = s .createQuery ("from HighestBid b where b.name = :name" );
47+ 		var  query  = s .createQuery ("from HighestBid b where b.name = :name" ,  HighestBid . class );
4948		query .setParameter ( "name" , "widget" , StandardBasicTypes .STRING  );
50- 		HighestBid  highestBid  = ( HighestBid )  query .list ().iterator ().next ();
49+ 		HighestBid  highestBid  = query .list ().iterator ().next ();
5150
5251		Assert .assertEquals ( 200.0 , highestBid .getAmount (), 0.01  );
5352		tx .rollback ();
5453		s .close ();
55- 
56- 
5754	}
5855
5956	@ Override 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments