Test query entity with mapped by embedded

This commit is contained in:
Fabio Massimo Ercoli 2021-11-04 21:36:30 +01:00
parent 7dab08448f
commit e10eaf3ef4
1 changed files with 9 additions and 0 deletions

View File

@ -6,6 +6,8 @@
*/ */
package org.hibernate.orm.test.embeddable; package org.hibernate.orm.test.embeddable;
import java.util.List;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.query.Query; import org.hibernate.query.Query;
@ -81,6 +83,13 @@ public class MappedByEmbeddableTest extends BaseCoreFunctionalTestCase {
loadContaining( session, 1, 2 ); loadContaining( session, 1, 2 );
loadContaining( session, 3, 3 ); loadContaining( session, 3, 3 );
} ); } );
inTransaction( session -> {
Query<Contained> query = session.createQuery( "select c from contained c", Contained.class );
List<Contained> containeds = query.list();
assertThat( containeds ).hasSize( 3 );
} );
} }
private void saveComposition(Session session, int id, String data) { private void saveComposition(Session session, int id, String data) {