[Hibernate-JIRA] Created: (HHH-5992) A query fails to return correct results silently
by Tom Ross (JIRA)
A query fails to return correct results silently
------------------------------------------------
Key: HHH-5992
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5992
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.2
Environment: JBoss EAP 5.1
Reporter: Tom Ross
The following query fails silently to return a correct result select v1.username, v2.username from user_ety v1, user_ety v2 where v1.username = '1' and v2.username = '2'. It returns one row with "1,1" instead of one row with "1,2".
The query works with pre JPA CMP EJBs (ver 2.1) but fails when moved to JPA based persistence.
This failure is very dangerous since it is silent and without manually checking data it is impossible to determine if a correct set is returned.
The workaround is to use aliases and modify the query so it looks like that:
select v1.username as username1, v2.username as username2 from user_ety v1, user_ety v2 where v1.username = '1' and v2.username = '2'.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 4 months
[Hibernate-JIRA] Created: (HSEARCH-988) DB matrix test failures against DB2
by Hardy Ferentschik (JIRA)
DB matrix test failures against DB2
-----------------------------------
Key: HSEARCH-988
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-988
Project: Hibernate Search
Issue Type: Bug
Components: tests
Affects Versions: 4.0.0.CR2
Reporter: Hardy Ferentschik
Assignee: Hardy Ferentschik
Fix For: 4.0.0.Final
DB2 failures:
{noformat}
>>> org.hibernate.search.test.bridge.BridgeTest.testDefaultAndNullBridges
>>> org.hibernate.search.test.bridge.BridgeTest.testCustomBridges
>>> org.hibernate.search.test.bridge.BridgeTest.testDateBridge
>>> org.hibernate.search.test.bridge.BridgeTest.testCalendarBridge
>>> org.hibernate.search.test.bridge.MapBridgeTest.testSearchNullEntry
>>> org.hibernate.search.test.bridge.MapBridgeTest.testSearchNullEmbedded
>>> org.hibernate.search.test.bridge.MapBridgeTest.testSearchNullNumericEmbedded
>>> org.hibernate.search.test.bridge.MapBridgeTest.testSearchNullNumericEntry
>>> org.hibernate.search.test.bridge.MapBridgeTest.testSearchNotNullEntry
>>> org.hibernate.search.test.bridge.MapBridgeTest.testSearchEntryWhenNullEntryNotIndexed
>>> org.hibernate.search.test.bridge.MapBridgeTest.testSearchNotNullNumeric
>>> org.hibernate.search.test.bridge.MapBridgeTest.testSearchNotNullNumericEntryWhenNullEntryNotIndexed
>>> org.hibernate.search.test.bridge.MapBridgeTest.testDateIndexing
{noformat}
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 4 months
[Hibernate-JIRA] Created: (HHH-6856) RowValueConstructorSyntax with In syntax is not working
by Strong Liu (JIRA)
RowValueConstructorSyntax with In syntax is not working
-------------------------------------------------------
Key: HHH-6856
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6856
Project: Hibernate Core
Issue Type: Bug
Components: query-sql
Affects Versions: 4.0.0.CR6
Reporter: Strong Liu
Assignee: Strong Liu
Fix For: 4.0.0.next
_org.hibernate.test.hql.HQLTest#testRowValueConstructorSyntaxInInList_ fails on oracle.
because this HQL "from LineItem l where l.id in (('a1',1,'b1'),('a2',2,'b2'))" is not correctly parsed.
it throws the following exception:
{quote}
16:43:59,245 DEBUG QueryTranslatorImpl:252 - --- SQL AST ---
\-[SELECT] QueryNode: 'SELECT' querySpaces (LineItem)
+-[SELECT_CLAUSE] SelectClause: '{derived select clause}'
| +-[SELECT_EXPR] SelectExpressionImpl: 'lineitem0_.customerId as customerId30_, lineitem0_.orderNumber as orderNum2_30_, lineitem0_.productId as productId30_' {FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=l,role=null,tableName=LineItem,tableAlias=lineitem0_,origin=null,columns={,className=LineItem}}}
| \-[SQL_TOKEN] SqlFragment: 'lineitem0_.quantity as quantity30_'
+-[FROM] FromClause: 'from' FromClause{level=1, fromElementCounter=1, fromElements=1, fromElementByClassAlias=[l], fromElementByTableAlias=[lineitem0_], fromElementsByPath=[], collectionJoinFromElementsByPath=[], impliedElements=[]}
| \-[FROM_FRAGMENT] FromElement: 'LineItem lineitem0_' FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=l,role=null,tableName=LineItem,tableAlias=lineitem0_,origin=null,columns={,className=LineItem}}
\-[WHERE] SqlNode: 'where'
\-[IN] InLogicOperatorNode: 'in'
+-[DOT] DotNode: '(lineitem0_.customerId, lineitem0_.orderNumber, lineitem0_.productId)' {propertyName=id,dereferenceType=2,propertyPath=id,path=l.id,tableAlias=lineitem0_,className=LineItem,classAlias=l}
| +-[ALIAS_REF] IdentNode: '(lineitem0_.customerId, lineitem0_.orderNumber, lineitem0_.productId)' {alias=l, className=LineItem, tableAlias=lineitem0_}
| \-[IDENT] IdentNode: 'id' {originalText=id}
\-[IN_LIST] SqlNode: 'inList'
+-[VECTOR_EXPR] SqlNode: '{vector}'
| +-[QUOTED_STRING] LiteralNode: ''a1''
| +-[NUM_INT] LiteralNode: '1'
| \-[QUOTED_STRING] LiteralNode: ''b1''
\-[VECTOR_EXPR] SqlNode: '{vector}'
+-[QUOTED_STRING] LiteralNode: ''a2''
+-[NUM_INT] LiteralNode: '2'
\-[QUOTED_STRING] LiteralNode: ''b2''
16:43:59,249 DEBUG ErrorCounter:82 - throwQueryException() : no errors
16:43:59,252 ERROR ErrorCounter:54 - <AST>:0:0: unexpected AST node: {vector}
16:43:59,254 ERROR ErrorCounter:50 - <AST>:0:0: unexpected AST node: {vector}
<AST>:0:0: unexpected AST node: {vector}
at org.hibernate.hql.internal.antlr.SqlGeneratorBase.inList(SqlGeneratorBase.java:3155)
at org.hibernate.hql.internal.antlr.SqlGeneratorBase.exoticComparisonExpression(SqlGeneratorBase.java:2965)
at org.hibernate.hql.internal.antlr.SqlGeneratorBase.comparisonExpr(SqlGeneratorBase.java:1219)
at org.hibernate.hql.internal.antlr.SqlGeneratorBase.booleanExpr(SqlGeneratorBase.java:857)
{quote}
I think the key is here
{code:title=sql-gen.g}
inList
: #(IN_LIST { out(" "); } ( parenSelect | simpleExprList ) )
;
simpleExprList
: { out("("); } (e:simpleExpr { separator(e," , "); } )* { out(")"); }
;
// A simple expression, or a sub-select with parens around it.
expr
: simpleExpr
| #( VECTOR_EXPR { out("("); } (e:expr { separator(e," , "); } )* { out(")"); } )
| parenSelect
| #(ANY { out("any "); } quantified )
| #(ALL { out("all "); } quantified )
| #(SOME { out("some "); } quantified )
;
{code}
fromt this grammar, inList doesn't accept VECTOR
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 4 months
[Hibernate-JIRA] Created: (HSEARCH-986) Test failures against Oracle
by Hardy Ferentschik (JIRA)
Test failures against Oracle
----------------------------
Key: HSEARCH-986
URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-986
Project: Hibernate Search
Issue Type: Bug
Components: tests
Affects Versions: 4.0.0.CR2
Reporter: Hardy Ferentschik
Assignee: Hardy Ferentschik
Fix For: 4.0.0.Final
The following tests fail when run against Oracle.
{noformat}
>>> org.hibernate.search.test.batchindexing.SearchIndexerTest.testIdentifierNaming
>>> org.hibernate.search.test.embedded.depth.DocumentIdContainedInTest.testCorrectDepthIndexed
>>> org.hibernate.search.test.engine.UsingIdentifierRollbackTest.testRolledBackIdentifiersOnUnusualDocumentId
>>> org.hibernate.search.test.proxy.ProxyTest.testDeteleProxy
{noformat}
They are test setup related and should be easy to fix.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 4 months
[Hibernate-JIRA] Created: (HHH-6780) Wrong Query timeout calculation
by Ruben Garcia (JIRA)
Wrong Query timeout calculation
--------------------------------
Key: HHH-6780
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6780
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 4.0.0.CR5, 4.0.0.CR4
Environment: Hibernate 4.0.0.RC5, Spring 3.1.RC1
Reporter: Ruben Garcia
Class: org.hibernate.engine.jdbc.internal.StatementPreparerImpl.StatementPreparationTemplate
Method: setStatementTimeout
private void setStatementTimeout(PreparedStatement preparedStatement) throws SQLException {
if ( transactionTimeOut > 0 ) {
int timeout = (int) ( transactionTimeOut - ( System.currentTimeMillis() / 1000 ) );
if ( timeout <= 0 ) {
throw new TransactionException( "transaction timeout expired" );
} else {
preparedStatement.setQueryTimeout( timeout );
}
}
}
Test Code:
Session session = openSession();
Transaction transaction = session.getTransaction();
transaction .setTimeout(20);
This calculation will be always negative:
int timeout = (int) ( transactionTimeOut - ( System.currentTimeMillis() / 1000 ) );
resulting TransactionException( "transaction timeout expired" ) will be throw.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 4 months