Hi,
I'm using an HQL query querying and matching against a list of components, the generated query used rowvaluecontructorsyntax in IN list.
I notice that a method on org.hibernate.dialect.Dialect.supportsRowValueConstructorSyntaxInInList() is supposed to tell if the dialect supports the syntax.
It looks like all Dialects packaged with hibernate do NOT support the syntax. Can someone then explain to me why hibernate is still generating (col1, col2) IN(?,?) syntax when talking to my HSQLDB database ?
I know for a fact that HSQLDB 1.8.0 does NOT support the syntax explaining the SQLException below.
Hibernate version:
3.2.6.GA
Mapping documents:
[code<hibernate-mapping package="com.archinsurance.rdm.entity.archlink.impl">
<class name="SymbolMappingImpl" table="SymbolMapping">
<id name="id" column="SymbolMappingId" type="int">
<generator class="identity" />
</id>
<component name="businessKey" class="com.archinsurance.rdm.entity.archlink.SymbolMappingKey">
<property name="subBusinessDivisionCdId" column="SubBusinessDivisionCdId" />
<property name="productFamilyCdId" column="ProductFamilyCdId" />
<property name="symbolCdId" column="SymbolCdId" />
<property name="companyCdId" column="CompanyCdId" />
<property name="stateCdId" column="StateCdId" />
</component>
<component name="validityPeriod" class="com.archinsurance.rdm.entity.reference.ValidityPeriod">
<property name="validFromDate" column="Effective_Dt" type="date" />
<property name="validToDate" column="Expiration_Dt" type="date" />
</component>
</class>
</hibernate-mapping>
[/code]
Code between sessionFactory.openSession() and session.close():
Code:
List results = entityManager.createQuery("from SymbolMappingImpl e where e.businessKey in (:list)").setParameter("list", list).getResultList();
Full stack trace of any exception that occurs:Code:
Caused by: java.sql.SQLException: Unexpected token: , in statement [/* from com.archinsurance.rdm.entity.archlink.impl.SymbolMappingImpl e where e.businessKey in (:list) */ select symbolmapp0_.SymbolMappingId as SymbolMa1_217_, symbolmapp0_.SubBusinessDivisionCdId as SubBusin2_217_, symbolmapp0_.ProductFamilyCdId as ProductF3_217_, symbolmapp0_.SymbolCdId as SymbolCdId217_, symbolmapp0_.CompanyCdId as CompanyC5_217_, symbolmapp0_.StateCdId as StateCdId217_, symbolmapp0_.Effective_Dt as Effective7_217_, symbolmapp0_.Expiration_Dt as Expiration8_217_ from SymbolMapping symbolmapp0_ where (symbolmapp0_.SubBusinessDivisionCdId, symbolmapp0_.ProductFamilyCdId, symbolmapp0_.SymbolCdId, symbolmapp0_.CompanyCdId, symbolmapp0_.StateCdId) in ((?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?) , (?, ?, ?, ?, ?))]
at org.hsqldb.jdbc.Util.throwError(Util.java:56)
at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(jdbcPreparedStatement.java:1820)
at org.hsqldb.jdbc.jdbcConnection.prepareStatement(jdbcConnection.java:563)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:505)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:423)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
at org.hibernate.loader.Loader.doQuery(Loader.java:673)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2213)
... 43 more
... Removed 28 stack frames
Name and version of the database you are using:
HSQLDB 1.8.0
The generated SQL (show_sql=true):
See above