HHH-13194 : Some methods returning org.hibernate.query.Query are not defined for StatelessSession
HHH-13194 : Remove @Incubating from org.hibernate.query.Query
This commit is contained in:
parent
5a58f50e09
commit
7a51b12cbb
|
@ -1161,9 +1161,6 @@ public interface Session extends SharedSessionContract, EntityManager, Hibernate
|
||||||
*/
|
*/
|
||||||
void addEventListeners(SessionEventListener... listeners);
|
void addEventListeners(SessionEventListener... listeners);
|
||||||
|
|
||||||
@Override
|
|
||||||
org.hibernate.query.Query createQuery(String queryString);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
<T> org.hibernate.query.Query<T> createQuery(String queryString, Class<T> resultType);
|
<T> org.hibernate.query.Query<T> createQuery(String queryString, Class<T> resultType);
|
||||||
|
|
||||||
|
@ -1176,8 +1173,6 @@ public interface Session extends SharedSessionContract, EntityManager, Hibernate
|
||||||
@Override
|
@Override
|
||||||
org.hibernate.query.Query createQuery(CriteriaDelete deleteQuery);
|
org.hibernate.query.Query createQuery(CriteriaDelete deleteQuery);
|
||||||
|
|
||||||
@Override
|
|
||||||
org.hibernate.query.Query getNamedQuery(String queryName);
|
|
||||||
|
|
||||||
<T> org.hibernate.query.Query<T> createNamedQuery(String name, Class<T> resultType);
|
<T> org.hibernate.query.Query<T> createNamedQuery(String name, Class<T> resultType);
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,12 @@ public interface SharedSessionContract extends QueryProducer, Serializable {
|
||||||
*/
|
*/
|
||||||
Transaction getTransaction();
|
Transaction getTransaction();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
org.hibernate.query.Query createQuery(String queryString);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
org.hibernate.query.Query getNamedQuery(String queryName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a ProcedureCall based on a named template
|
* Gets a ProcedureCall based on a named template
|
||||||
*
|
*
|
||||||
|
|
|
@ -10,6 +10,8 @@ import java.io.Closeable;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
|
|
||||||
|
import org.hibernate.query.NativeQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A command-oriented API for performing bulk operations against a database.
|
* A command-oriented API for performing bulk operations against a database.
|
||||||
* <p/>
|
* <p/>
|
||||||
|
@ -170,4 +172,7 @@ public interface StatelessSession extends SharedSessionContract, AutoCloseable,
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
Connection connection();
|
Connection connection();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
NativeQuery createSQLQuery(String queryString);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,12 +29,10 @@ import javax.persistence.TypedQuery;
|
||||||
|
|
||||||
import org.hibernate.CacheMode;
|
import org.hibernate.CacheMode;
|
||||||
import org.hibernate.FlushMode;
|
import org.hibernate.FlushMode;
|
||||||
import org.hibernate.Incubating;
|
|
||||||
import org.hibernate.LockMode;
|
import org.hibernate.LockMode;
|
||||||
import org.hibernate.LockOptions;
|
import org.hibernate.LockOptions;
|
||||||
import org.hibernate.ScrollMode;
|
import org.hibernate.ScrollMode;
|
||||||
import org.hibernate.ScrollableResults;
|
import org.hibernate.ScrollableResults;
|
||||||
import org.hibernate.graph.Graph;
|
|
||||||
import org.hibernate.graph.GraphSemantic;
|
import org.hibernate.graph.GraphSemantic;
|
||||||
import org.hibernate.graph.RootGraph;
|
import org.hibernate.graph.RootGraph;
|
||||||
import org.hibernate.transform.ResultTransformer;
|
import org.hibernate.transform.ResultTransformer;
|
||||||
|
@ -69,7 +67,6 @@ import org.hibernate.type.Type;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
@Incubating
|
|
||||||
@SuppressWarnings("UnusedDeclaration")
|
@SuppressWarnings("UnusedDeclaration")
|
||||||
public interface Query<R> extends TypedQuery<R>, org.hibernate.Query<R>, CommonQueryContract {
|
public interface Query<R> extends TypedQuery<R>, org.hibernate.Query<R>, CommonQueryContract {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
<generator class="native" />
|
<generator class="native" />
|
||||||
</id>
|
</id>
|
||||||
<many-to-one name="org" lazy="false" fetch="join" />
|
<many-to-one name="org" lazy="false" fetch="join" />
|
||||||
|
<query name="contacts">from Contact</query>
|
||||||
|
|
||||||
</class>
|
</class>
|
||||||
|
|
||||||
<class name="Org">
|
<class name="Org">
|
||||||
|
|
|
@ -16,7 +16,10 @@ import org.hibernate.Transaction;
|
||||||
import org.hibernate.cfg.Configuration;
|
import org.hibernate.cfg.Configuration;
|
||||||
import org.hibernate.cfg.Environment;
|
import org.hibernate.cfg.Environment;
|
||||||
import org.hibernate.dialect.AbstractHANADialect;
|
import org.hibernate.dialect.AbstractHANADialect;
|
||||||
|
import org.hibernate.query.NativeQuery;
|
||||||
|
|
||||||
import org.hibernate.testing.SkipForDialect;
|
import org.hibernate.testing.SkipForDialect;
|
||||||
|
import org.hibernate.testing.TestForIssue;
|
||||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@ -72,6 +75,52 @@ public class StatelessSessionQueryTest extends BaseCoreFunctionalTestCase {
|
||||||
testData.cleanData();
|
testData.cleanData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestForIssue( jiraKey = "HHH-13194")
|
||||||
|
@SkipForDialect(value = AbstractHANADialect.class, comment = " HANA doesn't support tables consisting of only a single auto-generated column")
|
||||||
|
public void testDeprecatedQueryApis() {
|
||||||
|
TestData testData=new TestData();
|
||||||
|
testData.createData();
|
||||||
|
|
||||||
|
final String queryString = "from Contact c join fetch c.org join fetch c.org.country";
|
||||||
|
StatelessSession s = sessionFactory().openStatelessSession();
|
||||||
|
|
||||||
|
org.hibernate.Query query = s.createQuery( queryString );
|
||||||
|
assertEquals( 1, query.getResultList().size() );
|
||||||
|
|
||||||
|
query = s.getNamedQuery( Contact.class.getName() + ".contacts" );
|
||||||
|
assertEquals( 1, query.getResultList().size() );
|
||||||
|
|
||||||
|
org.hibernate.SQLQuery sqlQuery = s.createSQLQuery( "select id from Contact" );
|
||||||
|
assertEquals( 1, sqlQuery.getResultList().size() );
|
||||||
|
|
||||||
|
s.close();
|
||||||
|
testData.cleanData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestForIssue( jiraKey = "HHH-13194")
|
||||||
|
@SkipForDialect(value = AbstractHANADialect.class, comment = " HANA doesn't support tables consisting of only a single auto-generated column")
|
||||||
|
public void testNewQueryApis() {
|
||||||
|
TestData testData=new TestData();
|
||||||
|
testData.createData();
|
||||||
|
|
||||||
|
final String queryString = "from Contact c join fetch c.org join fetch c.org.country";
|
||||||
|
StatelessSession s = sessionFactory().openStatelessSession();
|
||||||
|
|
||||||
|
org.hibernate.query.Query query = s.createQuery( queryString );
|
||||||
|
assertEquals( 1, query.getResultList().size() );
|
||||||
|
|
||||||
|
query = s.getNamedQuery( Contact.class.getName() + ".contacts" );
|
||||||
|
assertEquals( 1, query.getResultList().size() );
|
||||||
|
|
||||||
|
org.hibernate.query.NativeQuery sqlQuery = s.createSQLQuery( "select id from Contact" );
|
||||||
|
assertEquals( 1, sqlQuery.getResultList().size() );
|
||||||
|
|
||||||
|
s.close();
|
||||||
|
testData.cleanData();
|
||||||
|
}
|
||||||
|
|
||||||
private class TestData{
|
private class TestData{
|
||||||
List list = new ArrayList();
|
List list = new ArrayList();
|
||||||
public void createData(){
|
public void createData(){
|
||||||
|
|
Loading…
Reference in New Issue