mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-26 05:14:57 +00:00
@FailureExpected annotation added to tests in orm 6 substituted with @NotImplementedYet
This commit is contained in:
parent
bd9276d6d7
commit
a4b574e826
@ -589,10 +589,7 @@ public void testSerialized() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@FailureExpected(
|
||||
jiraKey = "",
|
||||
message = "Support for custom composite types not implemented - org.hibernate.orm.test.annotations.entity.Ransom#getAmount"
|
||||
)
|
||||
@NotImplementedYet(reason = "Support for custom composite types not implemented - org.hibernate.orm.test.annotations.entity.Ransom#getAmount")
|
||||
public void testCompositeType() throws Exception {
|
||||
Session s;
|
||||
Transaction tx;
|
||||
|
@ -30,6 +30,7 @@
|
||||
import org.hibernate.testing.orm.junit.DomainModel;
|
||||
import org.hibernate.testing.orm.junit.DomainModelScope;
|
||||
import org.hibernate.testing.orm.junit.FailureExpected;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.hibernate.testing.orm.junit.ServiceRegistry;
|
||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||
@ -91,7 +92,7 @@ public void testModel(DomainModelScope scope) {
|
||||
}
|
||||
|
||||
@Test
|
||||
@FailureExpected( reason = "Some problem with NavigablePath creation and/or TableGroup registration under those paths" )
|
||||
@NotImplementedYet(strict = false,reason = "Some problem with NavigablePath creation and/or TableGroup registration under those paths")
|
||||
public void testOperations(SessionFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
session -> {
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
import org.hibernate.testing.orm.junit.DomainModel;
|
||||
import org.hibernate.testing.orm.junit.FailureExpected;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.hibernate.testing.orm.junit.ServiceRegistry;
|
||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||
@ -50,7 +51,7 @@
|
||||
public class TablePerClassOverrideTests {
|
||||
|
||||
@Test
|
||||
@FailureExpected(reason = "@AttributeOverrides not applied for Table per class")
|
||||
@NotImplementedYet(strict = false, reason = "@AttributeOverrides not applied for Table per class")
|
||||
public void testSchema(SessionFactoryScope scope) {
|
||||
MetadataImplementor metadata = scope.getMetadataImplementor();
|
||||
assertTrue( SchemaUtil.isColumnPresent( "CUSTOMER", "STREET", metadata ) );
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
import org.hibernate.testing.orm.junit.DomainModel;
|
||||
import org.hibernate.testing.orm.junit.FailureExpected;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -86,7 +87,7 @@ public void testSimpleBuild(SessionFactoryScope scope) {
|
||||
}
|
||||
|
||||
@Test
|
||||
@FailureExpected( reason = "Cascade-driven DomainResult graph building not yet implemented" )
|
||||
@NotImplementedYet(reason = "Cascade-driven DomainResult graph building not yet implemented")
|
||||
public void testCascadeBasedBuild() {
|
||||
throw new NotYetImplementedFor6Exception( "Cascade-driven DomainResult graph building not yet implemented" );
|
||||
// EntityPersister ep = (EntityPersister) sessionFactory().getClassMetadata(Message.class);
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
@ -67,6 +68,7 @@ public void testTrivialCompilation() {
|
||||
@Test
|
||||
@TestForIssue(jiraKey = "HHH-8283")
|
||||
@Ignore( "Missing support for composite user types" )
|
||||
@NotImplementedYet
|
||||
public void testDateCompositeCustomType() {
|
||||
Payment payment = new Payment();
|
||||
payment.setAmount( new BigDecimal( 1000 ) );
|
||||
|
@ -10,43 +10,67 @@
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.SessionImplementor;
|
||||
import org.hibernate.jpa.HibernateEntityManagerFactory;
|
||||
import org.hibernate.jpa.QueryHints;
|
||||
import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase;
|
||||
import org.hibernate.stat.Statistics;
|
||||
|
||||
import org.hibernate.testing.FailureExpected;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.junit.Test;
|
||||
import org.hibernate.testing.orm.junit.EntityManagerFactoryScope;
|
||||
import org.hibernate.testing.orm.junit.Jpa;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.hibernate.testing.orm.junit.Setting;
|
||||
import org.hibernate.testing.orm.junit.SettingProvider;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.SharedCacheMode;
|
||||
import jakarta.persistence.TypedQuery;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
|
||||
/**
|
||||
* @author Gail Badner
|
||||
*/
|
||||
@TestForIssue( jiraKey = "HHH-9573" )
|
||||
public class CachedQueryTest extends BaseEntityManagerFunctionalTestCase {
|
||||
@TestForIssue(jiraKey = "HHH-9573")
|
||||
@Jpa(
|
||||
annotatedClasses = Employee.class,
|
||||
generateStatistics = true,
|
||||
properties = {
|
||||
@Setting(name = AvailableSettings.USE_QUERY_CACHE, value = "true"),
|
||||
@Setting(name = AvailableSettings.USE_SECOND_LEVEL_CACHE, value = "true"),
|
||||
},
|
||||
settingProviders = @SettingProvider(settingName = AvailableSettings.JAKARTA_SHARED_CACHE_MODE, provider = CachedQueryTest.SharedCacheModeProvider.class)
|
||||
)
|
||||
public class CachedQueryTest {
|
||||
|
||||
protected void addConfigOptions(Map options) {
|
||||
options.put( AvailableSettings.JPA_SHARED_CACHE_MODE, SharedCacheMode.ALL );
|
||||
}
|
||||
|
||||
public static class SharedCacheModeProvider implements SettingProvider.Provider<SharedCacheMode> {
|
||||
@Override
|
||||
public SharedCacheMode getSetting() {
|
||||
return SharedCacheMode.ALL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
// todo (6.0): implement shallow query cache structure
|
||||
@FailureExpected(jiraKey = "", message = "Different query cache structure")
|
||||
public void testCacheableQuery() {
|
||||
EntityManager em = getOrCreateEntityManager();
|
||||
em.getTransaction().begin();
|
||||
for ( int i = 0 ; i < 10 ; i++ ) {
|
||||
Employee employee = new Employee( "John" + i, 20d + i);
|
||||
em.persist( employee );
|
||||
}
|
||||
em.getTransaction().commit();
|
||||
em.close();
|
||||
@NotImplementedYet(strict = false, reason = "Different query cache structure")
|
||||
public void testCacheableQuery(EntityManagerFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
em -> {
|
||||
for ( int i = 0; i < 10; i++ ) {
|
||||
Employee employee = new Employee( "John" + i, 20d + i );
|
||||
em.persist( employee );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
HibernateEntityManagerFactory hemf = entityManagerFactory();
|
||||
Statistics stats = hemf.getSessionFactory().getStatistics();
|
||||
SessionFactoryImplementor hemf = (SessionFactoryImplementor) scope.getEntityManagerFactory();
|
||||
Statistics stats = hemf.getStatistics();
|
||||
|
||||
assertEquals( 0, stats.getQueryCacheHitCount() );
|
||||
assertEquals( 0, stats.getQueryCacheMissCount() );
|
||||
@ -57,119 +81,113 @@ public void testCacheableQuery() {
|
||||
|
||||
stats.clear();
|
||||
|
||||
em = getOrCreateEntityManager();
|
||||
em.getTransaction().begin();
|
||||
|
||||
// First time the query is executed, query and results are cached.
|
||||
|
||||
TypedQuery<Employee> query = em.createQuery( "select e from Employee e", Employee.class )
|
||||
.setHint( QueryHints.HINT_CACHEABLE, true );
|
||||
List<Employee> employees = query.getResultList();
|
||||
assertEquals( 10, employees.size() );
|
||||
assertEquals( 0, stats.getQueryCacheHitCount() );
|
||||
assertEquals( 1, stats.getQueryCacheMissCount() );
|
||||
assertEquals( 1, stats.getQueryCachePutCount() );
|
||||
// the first time the query executes, stats.getSecondLevelCacheHitCount() is 0 because the
|
||||
// entities are read from the query ResultSet (not from the entity cache).
|
||||
assertEquals( 0, stats.getSecondLevelCacheHitCount() );
|
||||
assertEquals( 0, stats.getSecondLevelCacheMissCount() );
|
||||
assertEquals( 0, stats.getSecondLevelCachePutCount() );
|
||||
scope.inTransaction(
|
||||
em -> {
|
||||
TypedQuery<Employee> query = em.createQuery( "select e from Employee e", Employee.class )
|
||||
.setHint( QueryHints.HINT_CACHEABLE, true );
|
||||
List<Employee> employees = query.getResultList();
|
||||
assertEquals( 10, employees.size() );
|
||||
assertEquals( 0, stats.getQueryCacheHitCount() );
|
||||
assertEquals( 1, stats.getQueryCacheMissCount() );
|
||||
assertEquals( 1, stats.getQueryCachePutCount() );
|
||||
// the first time the query executes, stats.getSecondLevelCacheHitCount() is 0 because the
|
||||
// entities are read from the query ResultSet (not from the entity cache).
|
||||
assertEquals( 0, stats.getSecondLevelCacheHitCount() );
|
||||
assertEquals( 0, stats.getSecondLevelCacheMissCount() );
|
||||
assertEquals( 0, stats.getSecondLevelCachePutCount() );
|
||||
}
|
||||
);
|
||||
|
||||
em.getTransaction().commit();
|
||||
em.close();
|
||||
|
||||
stats.clear();
|
||||
|
||||
// Second time the query is executed, list of entities are read from query cache and
|
||||
// the entities themselves are read from the entity cache.
|
||||
|
||||
em = getOrCreateEntityManager();
|
||||
em.getTransaction().begin();
|
||||
query = em.createQuery( "select e from Employee e", Employee.class )
|
||||
.setHint( QueryHints.HINT_CACHEABLE, true );
|
||||
employees = query.getResultList();
|
||||
assertEquals( 10, employees.size() );
|
||||
assertEquals( 1, stats.getQueryCacheHitCount() );
|
||||
assertEquals( 0, stats.getQueryCacheMissCount() );
|
||||
assertEquals( 0, stats.getQueryCachePutCount() );
|
||||
// the first time the query executes, stats.getSecondLevelCacheHitCount() is 0 because the
|
||||
// entities are read from the query ResultSet (not from the entity cache).
|
||||
assertEquals( 10, stats.getSecondLevelCacheHitCount() );
|
||||
assertEquals( 0, stats.getSecondLevelCacheMissCount() );
|
||||
assertEquals( 0, stats.getSecondLevelCachePutCount() );
|
||||
scope.inTransaction(
|
||||
em -> {
|
||||
TypedQuery<Employee> query = em.createQuery( "select e from Employee e", Employee.class )
|
||||
.setHint( QueryHints.HINT_CACHEABLE, true );
|
||||
List<Employee> employees = query.getResultList();
|
||||
assertEquals( 10, employees.size() );
|
||||
assertEquals( 1, stats.getQueryCacheHitCount() );
|
||||
assertEquals( 0, stats.getQueryCacheMissCount() );
|
||||
assertEquals( 0, stats.getQueryCachePutCount() );
|
||||
// the first time the query executes, stats.getSecondLevelCacheHitCount() is 0 because the
|
||||
// entities are read from the query ResultSet (not from the entity cache).
|
||||
assertEquals( 10, stats.getSecondLevelCacheHitCount() );
|
||||
assertEquals( 0, stats.getSecondLevelCacheMissCount() );
|
||||
assertEquals( 0, stats.getSecondLevelCachePutCount() );
|
||||
}
|
||||
);
|
||||
|
||||
em.getTransaction().commit();
|
||||
em.close();
|
||||
|
||||
// NOTE: JPACache.evictAll() only evicts entity regions;
|
||||
// it does not evict the collection regions or query cache region
|
||||
entityManagerFactory().getCache().evictAll();
|
||||
scope.getEntityManagerFactory().getCache().evictAll();
|
||||
|
||||
stats.clear();
|
||||
|
||||
em = getOrCreateEntityManager();
|
||||
em.getTransaction().begin();
|
||||
query = em.createQuery( "select e from Employee e", Employee.class )
|
||||
.setHint( QueryHints.HINT_CACHEABLE, true );
|
||||
employees = query.getResultList();
|
||||
assertEquals( 10, employees.size() );
|
||||
// query is still found in the cache
|
||||
assertEquals( 1, stats.getQueryCacheHitCount() );
|
||||
assertEquals( 0, stats.getQueryCacheMissCount() );
|
||||
assertEquals( 0, stats.getQueryCachePutCount() );
|
||||
// since entity regions were evicted, the 10 entities are not found, and are re-put after loading
|
||||
// as each entity ID is read from the query cache, Hibernate will look the entity up in the
|
||||
// cache and will not find it; that's why the "miss" and "put" counts are both 10.
|
||||
assertEquals( 0, stats.getSecondLevelCacheHitCount() );
|
||||
assertEquals( 10, stats.getSecondLevelCacheMissCount() );
|
||||
assertEquals( 10, stats.getSecondLevelCachePutCount() );
|
||||
scope.inTransaction(
|
||||
em -> {
|
||||
TypedQuery<Employee> query = em.createQuery( "select e from Employee e", Employee.class )
|
||||
.setHint( QueryHints.HINT_CACHEABLE, true );
|
||||
List<Employee> employees = query.getResultList();
|
||||
assertEquals( 10, employees.size() );
|
||||
// query is still found in the cache
|
||||
assertEquals( 1, stats.getQueryCacheHitCount() );
|
||||
assertEquals( 0, stats.getQueryCacheMissCount() );
|
||||
assertEquals( 0, stats.getQueryCachePutCount() );
|
||||
// since entity regions were evicted, the 10 entities are not found, and are re-put after loading
|
||||
// as each entity ID is read from the query cache, Hibernate will look the entity up in the
|
||||
// cache and will not find it; that's why the "miss" and "put" counts are both 10.
|
||||
assertEquals( 0, stats.getSecondLevelCacheHitCount() );
|
||||
assertEquals( 10, stats.getSecondLevelCacheMissCount() );
|
||||
assertEquals( 10, stats.getSecondLevelCachePutCount() );
|
||||
}
|
||||
);
|
||||
|
||||
em.getTransaction().commit();
|
||||
em.close();
|
||||
|
||||
stats.clear();
|
||||
|
||||
// this time call clear the entity regions and the query cache region
|
||||
em = getOrCreateEntityManager();
|
||||
scope.inEntityManager(
|
||||
em -> {
|
||||
em.getEntityManagerFactory().getCache().evictAll();
|
||||
em.unwrap( SessionImplementor.class )
|
||||
.getFactory()
|
||||
.getCache()
|
||||
.evictQueryRegions();
|
||||
|
||||
em.getEntityManagerFactory().getCache().evictAll();
|
||||
em.unwrap( SessionImplementor.class )
|
||||
.getFactory()
|
||||
.getCache()
|
||||
.evictQueryRegions();
|
||||
em.getTransaction().begin();
|
||||
try {
|
||||
TypedQuery<Employee> query = em.createQuery( "select e from Employee e", Employee.class )
|
||||
.setHint( QueryHints.HINT_CACHEABLE, true );
|
||||
List<Employee> employees = query.getResultList();
|
||||
assertEquals( 10, employees.size() );
|
||||
// query is no longer found in the cache
|
||||
assertEquals( 0, stats.getQueryCacheHitCount() );
|
||||
assertEquals( 1, stats.getQueryCacheMissCount() );
|
||||
assertEquals( 1, stats.getQueryCachePutCount() );
|
||||
// stats.getSecondLevelCacheHitCount() is 0 because the
|
||||
// entities are read from the query ResultSet (not from the entity cache).
|
||||
assertEquals( 0, stats.getSecondLevelCacheHitCount() );
|
||||
assertEquals( 0, stats.getSecondLevelCacheMissCount() );
|
||||
assertEquals( 10, stats.getSecondLevelCachePutCount() );
|
||||
|
||||
em.getTransaction().begin();
|
||||
query = em.createQuery( "select e from Employee e", Employee.class )
|
||||
.setHint( QueryHints.HINT_CACHEABLE, true );
|
||||
employees = query.getResultList();
|
||||
assertEquals( 10, employees.size() );
|
||||
// query is no longer found in the cache
|
||||
assertEquals( 0, stats.getQueryCacheHitCount() );
|
||||
assertEquals( 1, stats.getQueryCacheMissCount() );
|
||||
assertEquals( 1, stats.getQueryCachePutCount() );
|
||||
// stats.getSecondLevelCacheHitCount() is 0 because the
|
||||
// entities are read from the query ResultSet (not from the entity cache).
|
||||
assertEquals( 0, stats.getSecondLevelCacheHitCount() );
|
||||
assertEquals( 0, stats.getSecondLevelCacheMissCount() );
|
||||
assertEquals( 10, stats.getSecondLevelCachePutCount() );
|
||||
em.createQuery( "delete from Employee" ).executeUpdate();
|
||||
em.getTransaction().commit();
|
||||
}
|
||||
finally {
|
||||
if ( em.getTransaction().isActive() ) {
|
||||
em.getTransaction().rollback();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
em.createQuery( "delete from Employee" ).executeUpdate();
|
||||
em.getTransaction().commit();
|
||||
em.close();
|
||||
}
|
||||
|
||||
protected void addConfigOptions(Map options) {
|
||||
options.put( AvailableSettings.JPA_SHARED_CACHE_MODE, SharedCacheMode.ALL );
|
||||
options.put( AvailableSettings.GENERATE_STATISTICS, "true" );
|
||||
options.put( AvailableSettings.USE_QUERY_CACHE, "true" );
|
||||
options.put( AvailableSettings.USE_SECOND_LEVEL_CACHE, "true" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class[] getAnnotatedClasses() {
|
||||
return new Class[]{
|
||||
Employee.class
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,6 +24,7 @@
|
||||
import org.hibernate.testing.jdbc.SQLStatementInspector;
|
||||
import org.hibernate.testing.orm.junit.DomainModel;
|
||||
import org.hibernate.testing.orm.junit.FailureExpected;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.hibernate.testing.orm.junit.ServiceRegistry;
|
||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||
@ -206,7 +207,7 @@ public void testBasicMultiLoadWithManagedAndChecking(SessionFactoryScope scope)
|
||||
|
||||
@Test
|
||||
@TestForIssue(jiraKey = "HHH-12944")
|
||||
@FailureExpected( reason = "Caching/CacheMode supported not yet implemented" )
|
||||
@NotImplementedYet(strict = false, reason = "Caching/CacheMode supported not yet implemented")
|
||||
public void testMultiLoadFrom2ndLevelCache(SessionFactoryScope scope) {
|
||||
final SQLStatementInspector statementInspector = scope.getCollectingStatementInspector();
|
||||
statementInspector.clear();
|
||||
@ -261,7 +262,7 @@ public void testMultiLoadFrom2ndLevelCache(SessionFactoryScope scope) {
|
||||
|
||||
@Test
|
||||
@TestForIssue(jiraKey = "HHH-12944")
|
||||
@FailureExpected( reason = "Caching/CacheMode supported not yet implemented" )
|
||||
@NotImplementedYet(strict = false, reason = "Caching/CacheMode supported not yet implemented")
|
||||
public void testUnorderedMultiLoadFrom2ndLevelCache(SessionFactoryScope scope) {
|
||||
final SQLStatementInspector statementInspector = scope.getCollectingStatementInspector();
|
||||
statementInspector.clear();
|
||||
@ -450,7 +451,7 @@ public void testUnorderedMultiLoadFrom2ndLevelCachePendingDeleteReturnRemoved(Se
|
||||
}
|
||||
|
||||
@Test
|
||||
@FailureExpected( reason = "CacheMode not yet implemented" )
|
||||
@NotImplementedYet(strict = false, reason = "CacheMode not yet implemented")
|
||||
public void testMultiLoadWithCacheModeIgnore(SessionFactoryScope scope) {
|
||||
// do the multi-load, telling Hibernate to IGNORE the L2 cache -
|
||||
// the end result should be that the cache is (still) empty afterwards
|
||||
|
@ -206,7 +206,6 @@ public void testSizeWithoutNestedPathAddFetchDistinct(SessionFactoryScope scope)
|
||||
}
|
||||
|
||||
@Test
|
||||
// @FailureExpected( reason = "org.hibernate.PropertyAccessException : Student#teacher (I think its a stack-overflow)" )
|
||||
public void testSizeWithNestedPathAndImplicitJoin(SessionFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
(session) -> {
|
||||
@ -288,7 +287,6 @@ public void testSizeWithNestedPathAndImplicitJoinAddFetchDistinct(SessionFactory
|
||||
}
|
||||
|
||||
@Test
|
||||
@FailureExpected( reason = "org.hibernate.PropertyAccessException : Student#teacher (I think its a stack-overflow)" )
|
||||
public void testSizeWithNestedPath(SessionFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
(session) -> {
|
||||
@ -300,12 +298,14 @@ public void testSizeWithNestedPath(SessionFactoryScope scope) {
|
||||
|
||||
}
|
||||
|
||||
final SQLStatementInspector sqlStatementInspector = extractFromSession( session );
|
||||
sqlStatementInspector.clear();
|
||||
List<Student> students = session.createQuery(
|
||||
"select student from Student student join student.teacher t where size(student.teacher.skills) > -1",
|
||||
Student.class
|
||||
).getResultList();
|
||||
assertEquals( 3L, students.size() );
|
||||
extractFromSession( session ).assertNumberOfJoins( 0, 1 );
|
||||
sqlStatementInspector.assertNumberOfJoins( 0, 1 );
|
||||
|
||||
students = session.createQuery(
|
||||
"select student from Student student join student.teacher t where size(student.teacher.skills) > 0",
|
||||
@ -329,17 +329,16 @@ public void testSizeWithNestedPath(SessionFactoryScope scope) {
|
||||
}
|
||||
|
||||
@Test
|
||||
@FailureExpected( reason = "org.hibernate.PropertyAccessException : Student#teacher (I think its a stack-overflow)" )
|
||||
public void testSizeWithNestedPathAddFetchDistinct(SessionFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
(session) -> {
|
||||
final SQLStatementInspector sqlStatementInspector = extractFromSession( session );
|
||||
sqlStatementInspector.clear();
|
||||
List<Student> students = session.createQuery(
|
||||
"select distinct student from Student student join student.teacher t join fetch student.teacher tjoin left join fetch tjoin.skills where size(student.teacher.skills) > -1",
|
||||
Student.class
|
||||
).getResultList();
|
||||
// NOTE: An INNER JOIN is done on Teacher twice, which results in 4 joins.
|
||||
// A possible optimization would be to reuse this INNER JOIN.
|
||||
extractFromSession( session ).assertNumberOfJoins( 0, 4 );
|
||||
sqlStatementInspector.assertNumberOfJoins( 0, 3 );
|
||||
assertEquals( 3L, students.size() );
|
||||
assertTrue( Hibernate.isInitialized( students.get( 0 ).getTeacher().getSkills() ) );
|
||||
assertTrue( Hibernate.isInitialized( students.get( 1 ).getTeacher().getSkills() ) );
|
||||
@ -370,16 +369,18 @@ public void testSizeWithNestedPathAddFetchDistinct(SessionFactoryScope scope) {
|
||||
}
|
||||
|
||||
@Test
|
||||
// @FailureExpected( reason = "org.hibernate.PropertyAccessException : Student#teacher (I think its a stack-overflow)" )
|
||||
public void testSizeWithNestedPath2(SessionFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
(session) -> {
|
||||
final SQLStatementInspector sqlStatementInspector = extractFromSession( session );
|
||||
sqlStatementInspector.clear();
|
||||
|
||||
List<Student> students = session.createQuery(
|
||||
"select student from Student student join student.teacher t where size(t.skills) > -1",
|
||||
Student.class
|
||||
).getResultList();
|
||||
assertEquals( 3, students.size() );
|
||||
extractFromSession( session ).assertNumberOfJoins( 0, 1 );
|
||||
sqlStatementInspector.assertNumberOfJoins( 0, 1 );
|
||||
|
||||
students = session.createQuery(
|
||||
"select student from Student student join student.teacher t where size(t.skills) > 0",
|
||||
@ -403,17 +404,19 @@ public void testSizeWithNestedPath2(SessionFactoryScope scope) {
|
||||
}
|
||||
|
||||
@Test
|
||||
@FailureExpected( reason = "org.hibernate.PropertyAccessException : Student#teacher (I think its a stack-overflow)" )
|
||||
public void testSizeWithNestedPath2AddFetchDistinct(SessionFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
(session) -> {
|
||||
final SQLStatementInspector sqlStatementInspector = extractFromSession( session );
|
||||
sqlStatementInspector.clear();
|
||||
|
||||
List<Student> students = session.createQuery(
|
||||
"select distinct student from Student student join student.teacher t join fetch student.teacher tfetch left join fetch tfetch.skills where size(t.skills) > -1",
|
||||
Student.class
|
||||
).getResultList();
|
||||
// NOTE: An INNER JOIN is done on Teacher twice, which results in 4 joins.
|
||||
// A possible optimization would be to reuse this INNER JOIN.
|
||||
extractFromSession( session ).assertNumberOfJoins( 0, 4 );
|
||||
sqlStatementInspector.assertNumberOfJoins( 0, 4 );
|
||||
assertEquals( 3L, students.size() );
|
||||
assertTrue( Hibernate.isInitialized( students.get( 0 ).getTeacher().getSkills() ) );
|
||||
assertTrue( Hibernate.isInitialized( students.get( 1 ).getTeacher().getSkills() ) );
|
||||
|
@ -17,6 +17,7 @@
|
||||
import org.hibernate.testing.orm.domain.retail.Vendor;
|
||||
import org.hibernate.testing.orm.junit.BaseSessionFactoryFunctionalTest;
|
||||
import org.hibernate.testing.orm.junit.FailureExpected;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -58,7 +59,7 @@ public void cleanUpTestData() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@FailureExpected( reason = "selection of discriminator not yet implemented" )
|
||||
@NotImplementedYet(strict = false, reason = "selection of discriminator not yet implemented")
|
||||
public void testSelection() {
|
||||
inTransaction(
|
||||
session -> {
|
||||
|
@ -15,6 +15,7 @@
|
||||
import org.hibernate.testing.orm.domain.gambit.EntityWithManyToOneSelfReference;
|
||||
import org.hibernate.testing.orm.junit.DomainModel;
|
||||
import org.hibernate.testing.orm.junit.FailureExpected;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.hibernate.testing.orm.junit.ServiceRegistry;
|
||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||
@ -194,7 +195,7 @@ public void testHqlSelectWithFetchJoin(SessionFactoryScope scope) {
|
||||
}
|
||||
|
||||
@Test
|
||||
@FailureExpected
|
||||
@NotImplementedYet(strict = false)
|
||||
public void testGetByMultipleIds(SessionFactoryScope scope) {
|
||||
|
||||
scope.inTransaction(
|
||||
|
@ -15,6 +15,7 @@
|
||||
import org.hibernate.testing.orm.domain.gambit.EntityWithManyToOneSelfReference;
|
||||
import org.hibernate.testing.orm.junit.DomainModel;
|
||||
import org.hibernate.testing.orm.junit.FailureExpected;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.hibernate.testing.orm.junit.ServiceRegistry;
|
||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||
@ -193,7 +194,7 @@ public void testHqlSelectWithFetchJoin(SessionFactoryScope scope) {
|
||||
}
|
||||
|
||||
@Test
|
||||
@FailureExpected
|
||||
@NotImplementedYet(strict = false)
|
||||
public void testGetByMultipleIds(SessionFactoryScope scope) {
|
||||
|
||||
scope.inTransaction(
|
||||
|
@ -10,6 +10,7 @@
|
||||
import org.hibernate.orm.test.sql.hand.custom.CustomStoredProcTestSupport;
|
||||
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.junit.Ignore;
|
||||
|
||||
/**
|
||||
@ -20,6 +21,7 @@
|
||||
@RequiresDialect( DB2Dialect.class )
|
||||
// todo (6.0): needs a composite user type mechanism e.g. by providing a custom embeddable strategy or istantiator
|
||||
@Ignore( "Missing support for composite user types" )
|
||||
@NotImplementedYet
|
||||
public class DB2CustomSQLTest extends CustomStoredProcTestSupport {
|
||||
public String[] getMappings() {
|
||||
return new String[] { "sql/hand/custom/db2/Mappings.hbm.xml" };
|
||||
|
@ -10,6 +10,7 @@
|
||||
import org.hibernate.orm.test.sql.hand.custom.CustomStoredProcTestSupport;
|
||||
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.junit.Ignore;
|
||||
|
||||
/**
|
||||
@ -18,6 +19,7 @@
|
||||
@RequiresDialect(DerbyDialect.class)
|
||||
// todo (6.0): needs a composite user type mechanism e.g. by providing a custom embeddable strategy or istantiator
|
||||
@Ignore( "Missing support for composite user types" )
|
||||
@NotImplementedYet
|
||||
public class DerbyCustomSQLTest extends CustomStoredProcTestSupport {
|
||||
public String[] getMappings() {
|
||||
return new String[] {"sql/hand/custom/derby/Mappings.hbm.xml"};
|
||||
|
@ -10,6 +10,7 @@
|
||||
import org.hibernate.orm.test.sql.hand.custom.CustomStoredProcTestSupport;
|
||||
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.junit.Ignore;
|
||||
|
||||
/**
|
||||
@ -20,6 +21,7 @@
|
||||
@RequiresDialect( MySQLDialect.class )
|
||||
// todo (6.0): needs a composite user type mechanism e.g. by providing a custom embeddable strategy or istantiator
|
||||
@Ignore( "Missing support for composite user types" )
|
||||
@NotImplementedYet
|
||||
public class MySQLCustomSQLTest extends CustomStoredProcTestSupport {
|
||||
public String[] getMappings() {
|
||||
return new String[] { "sql/hand/custom/mysql/Mappings.hbm.xml" };
|
||||
|
@ -10,6 +10,7 @@
|
||||
import org.hibernate.orm.test.sql.hand.custom.CustomStoredProcTestSupport;
|
||||
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.junit.Ignore;
|
||||
|
||||
/**
|
||||
@ -20,6 +21,7 @@
|
||||
@RequiresDialect( OracleDialect.class )
|
||||
// todo (6.0): needs a composite user type mechanism e.g. by providing a custom embeddable strategy or istantiator
|
||||
@Ignore( "Missing support for composite user types" )
|
||||
@NotImplementedYet
|
||||
public class OracleCustomSQLTest extends CustomStoredProcTestSupport {
|
||||
public String[] getMappings() {
|
||||
return new String[] { "sql/hand/custom/oracle/Mappings.hbm.xml", "sql/hand/custom/oracle/StoredProcedures.hbm.xml" };
|
||||
|
@ -10,6 +10,7 @@
|
||||
import org.hibernate.orm.test.sql.hand.custom.CustomStoredProcTestSupport;
|
||||
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.junit.Ignore;
|
||||
|
||||
/**
|
||||
@ -20,6 +21,7 @@
|
||||
@RequiresDialect( SQLServerDialect.class )
|
||||
// todo (6.0): needs a composite user type mechanism e.g. by providing a custom embeddable strategy or istantiator
|
||||
@Ignore( "Missing support for composite user types" )
|
||||
@NotImplementedYet
|
||||
public class SQLServerCustomSQLTest extends CustomStoredProcTestSupport {
|
||||
public String[] getMappings() {
|
||||
return new String[] { "sql/hand/custom/sqlserver/Mappings.hbm.xml" };
|
||||
|
@ -10,6 +10,7 @@
|
||||
import org.hibernate.orm.test.sql.hand.custom.CustomStoredProcTestSupport;
|
||||
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.junit.Ignore;
|
||||
|
||||
/**
|
||||
@ -20,6 +21,7 @@
|
||||
@RequiresDialect( { SybaseDialect.class })
|
||||
// todo (6.0): needs a composite user type mechanism e.g. by providing a custom embeddable strategy or istantiator
|
||||
@Ignore( "Missing support for composite user types" )
|
||||
@NotImplementedYet
|
||||
public class SybaseCustomSQLTest extends CustomStoredProcTestSupport {
|
||||
public String[] getMappings() {
|
||||
return new String[] { "sql/hand/custom/sybase/Mappings.hbm.xml" };
|
||||
|
Loading…
x
Reference in New Issue
Block a user