HHH-6714 Parentheses dissapear in HQL query where they should stay
This commit is contained in:
parent
3c3482bd59
commit
77107cc35a
|
@ -361,7 +361,7 @@ arithmeticExpr
|
|||
: additiveExpr
|
||||
| multiplicativeExpr
|
||||
// | #(CONCAT { out("("); } expr ( { out("||"); } expr )+ { out(")"); } )
|
||||
| #(UNARY_MINUS { out("-"); } expr)
|
||||
| #(UNARY_MINUS { out("-"); } nestedExprAfterMinusDiv)
|
||||
| caseExpr
|
||||
;
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ public final class Hibernate {
|
|||
public static LobCreator getLobCreator(SessionImplementor session) {
|
||||
return session.getFactory()
|
||||
.getJdbcServices()
|
||||
.getLobCreator( ( LobCreationContext ) session );
|
||||
.getLobCreator( session );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.hibernate.internal.CoreMessageLogger;
|
|||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
|
||||
/**
|
||||
* Helper to extract type innformation from {@link DatabaseMetaData JDBC metadata}
|
||||
* Helper to extract type information from {@link DatabaseMetaData JDBC metadata}
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
|
|
|
@ -111,6 +111,9 @@ public class SqlGenerator extends SqlGeneratorBase implements ErrorReporter {
|
|||
|
||||
@Override
|
||||
protected void out(String s) {
|
||||
if(s.contains( "countaaa" )){
|
||||
System.out.println("------------");
|
||||
}
|
||||
writer.clause( s );
|
||||
}
|
||||
|
||||
|
|
|
@ -159,9 +159,7 @@ import org.hibernate.type.Type;
|
|||
*
|
||||
* @author Gavin King
|
||||
*/
|
||||
public final class SessionImpl
|
||||
extends AbstractSessionImpl
|
||||
implements EventSource, org.hibernate.Session, TransactionContext, LobCreationContext {
|
||||
public final class SessionImpl extends AbstractSessionImpl implements EventSource {
|
||||
|
||||
// todo : need to find a clean way to handle the "event source" role
|
||||
// a separate class responsible for generating/dispatching events just duplicates most of the Session methods...
|
||||
|
|
|
@ -35,50 +35,48 @@ import org.hibernate.stat.spi.StatisticsImplementor;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class TransactionEnvironmentImpl implements TransactionEnvironment {
|
||||
private final SessionFactoryImpl sessionFactory;
|
||||
private final SessionFactoryImpl sessionFactory;
|
||||
private final transient StatisticsImplementor statisticsImplementor;
|
||||
private final transient ServiceRegistry serviceRegistry;
|
||||
private final transient JdbcServices jdbcServices;
|
||||
private final transient JtaPlatform jtaPlatform;
|
||||
private final transient TransactionFactory transactionFactory;
|
||||
|
||||
private final transient StatisticsImplementor statisticsImplementor;
|
||||
private final transient ServiceRegistry serviceRegistry;
|
||||
private final transient JdbcServices jdbcServices;
|
||||
private final transient JtaPlatform jtaPlatform;
|
||||
private final transient TransactionFactory transactionFactory;
|
||||
public TransactionEnvironmentImpl(SessionFactoryImpl sessionFactory) {
|
||||
this.sessionFactory = sessionFactory;
|
||||
this.statisticsImplementor = sessionFactory.getStatisticsImplementor();
|
||||
this.serviceRegistry = sessionFactory.getServiceRegistry();
|
||||
this.jdbcServices = serviceRegistry.getService( JdbcServices.class );
|
||||
this.jtaPlatform = serviceRegistry.getService( JtaPlatform.class );
|
||||
this.transactionFactory = serviceRegistry.getService( TransactionFactory.class );
|
||||
}
|
||||
|
||||
public TransactionEnvironmentImpl(SessionFactoryImpl sessionFactory) {
|
||||
this.sessionFactory = sessionFactory;
|
||||
this.statisticsImplementor = sessionFactory.getStatisticsImplementor();
|
||||
this.serviceRegistry = sessionFactory.getServiceRegistry();
|
||||
this.jdbcServices = serviceRegistry.getService( JdbcServices.class );
|
||||
this.jtaPlatform = serviceRegistry.getService( JtaPlatform.class );
|
||||
this.transactionFactory = serviceRegistry.getService( TransactionFactory.class );
|
||||
@Override
|
||||
public SessionFactoryImplementor getSessionFactory() {
|
||||
return sessionFactory;
|
||||
}
|
||||
|
||||
}
|
||||
protected ServiceRegistry serviceRegistry() {
|
||||
return serviceRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SessionFactoryImplementor getSessionFactory() {
|
||||
return sessionFactory;
|
||||
}
|
||||
@Override
|
||||
public JdbcServices getJdbcServices() {
|
||||
return jdbcServices;
|
||||
}
|
||||
|
||||
protected ServiceRegistry serviceRegistry() {
|
||||
return serviceRegistry;
|
||||
}
|
||||
@Override
|
||||
public JtaPlatform getJtaPlatform() {
|
||||
return jtaPlatform;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JdbcServices getJdbcServices() {
|
||||
return jdbcServices;
|
||||
}
|
||||
@Override
|
||||
public TransactionFactory getTransactionFactory() {
|
||||
return transactionFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JtaPlatform getJtaPlatform() {
|
||||
return jtaPlatform;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransactionFactory getTransactionFactory() {
|
||||
return transactionFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatisticsImplementor getStatisticsImplementor() {
|
||||
return statisticsImplementor;
|
||||
}
|
||||
@Override
|
||||
public StatisticsImplementor getStatisticsImplementor() {
|
||||
return statisticsImplementor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -634,6 +634,26 @@ public class ASTParserLoadingTest extends BaseCoreFunctionalTestCase {
|
|||
return count;
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-6714" )
|
||||
public void testUnaryMinus(){
|
||||
Session s = openSession();
|
||||
s.beginTransaction();
|
||||
Human stliu = new Human();
|
||||
stliu.setIntValue( 26 );
|
||||
|
||||
s.persist( stliu );
|
||||
s.getTransaction().commit();
|
||||
s.clear();
|
||||
s.beginTransaction();
|
||||
List list =s.createQuery( "from Human h where -(h.intValue - 100)=74" ).list();
|
||||
assertEquals( 1, list.size() );
|
||||
s.getTransaction().commit();
|
||||
s.close();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEntityAndOneToOneReturnedByQuery() {
|
||||
Session s = openSession();
|
||||
|
|
Loading…
Reference in New Issue