Joined: Mon Sep 12, 2005 5:18 pm Posts: 6 Location: Cambridge, MA, USA
|
Summary of problem:
I have two classes, ConstituentTA and EmailTA with composite keys which are related through a many:many association. A third class, ConstituentSearchResultTA, has a many:one association to ConstituentTA. I am trying to execute an HQL query to return ConstituentSearchResultTA objects based on an email address. My initial HQL attempt was:
Code: from ConstituentSearchResultTA cs where exists(from cs.constituent.emails e where e.emailAddress = 'blah')
This forms a correct query, but it does not perform well. I found some SQL which does perform better, and figured out what looked like the way to write the HQL: Code: from ConstituentSearchResultTA cs where cs.constituent in(select elements(e.constituents) from EmailTA e where e.emailAddress = 'blah')
Unfortunately, the join condition comes out as: Code: where (constituen0_.ACCOUNT_ID, constituen0_.NAME_ID) in (select constituen2_.ACCOUNT_ID from...
The elements(e.constituents) construct is not correctly equating the full composite key of ConstituentTA - only the first column appears. Am I doing something wrong? Is there another way to get the SQL I want (which is hopefully clear from my proposed HQL)? Any other suggestions? Hibernate version:3.1.3 Mapping documents:
ConstituentSearchResultTA:
<hibernate-mapping package="com.tsi.ta.model.domain.taobj.account"> <class name="ConstituentSearchResultTA" table="SEARCH_ACCOUNT" mutable="false"> ... <many-to-one name="constituent" class="ConstituentTA" lazy="false" insert="false" update="false"> <column name="ACCOUNT_ID"/> <column name="NAME_ID"/> </many-to-one> ... </class> </hibernate-mapping>
ConstituentTA:
<hibernate-mapping package="com.tsi.ta.model.domain.taobj.account"> <class name="ConstituentTA" table="NAMES" rowid="ROWID">
<composite-id name="hibId"> <key-many-to-one name="account" column="ACCOUNT_ID" class="AccountTA"/> <key-property name="nameId" column="NAME_ID"/> </composite-id> ... <bag name="emails" inverse="true" table="HIB_NAMES_EMAILS" batch-size="5"> <key> <column name="ACCOUNT_ID"/> <column name="NAME_ID"/> </key> <many-to-many class="com.tsi.ta.model.domain.taobj.contact.EmailTA"> <column name="EMAIL_ACCOUNT_ID"/> <column name="EMAIL_ID"/> </many-to-many> </bag> ... </class> </hibernate-mapping>
EmailTA:
<hibernate-mapping package="com.tsi.ta.model.domain.taobj.contact"> <class name="EmailTA" table="EMAILS" rowid="ROWID">
<composite-id name="hibId"> <key-many-to-one name="account" column="ACCOUNT_ID" class="com.tsi.ta.model.domain.taobj.account.AccountTA"/> <key-property name="emailId" column="EMAIL_ID"/> </composite-id> ... <set name="constituents" table="HIB_NAMES_EMAILS" batch-size="5"> <key> <column name="EMAIL_ACCOUNT_ID"/> <column name="EMAIL_ID"/> </key> <many-to-many class="com.tsi.ta.model.domain.taobj.account.ConstituentTA"> <column name="ACCOUNT_ID"/> <column name="NAME_ID"/> </many-to-many> </set>
</class> </hibernate-mapping> Code between sessionFactory.openSession() and session.close(): Query q = sess.createQuery("from ConstituentSearchResultTA cs where cs.constituent in(select elements(e.constituents) from EmailTA e where e.emailAddress='slin@targetsite.com')"); Full stack trace of any exception that occurs: org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.JDBCException.<init>(JDBCException.java:26) at org.hibernate.exception.SQLGrammarException.<init>(SQLGrammarException.java:31) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.loader.Loader.doList(Loader.java:2148) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029) at org.hibernate.loader.Loader.list(Loader.java:2024) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:307) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) at test.com.tsi.ta.model.domain.Tester.testAccountSearch(Tester.java:1424) at test.com.tsi.ta.model.domain.Tester.main(Tester.java:1592) java.sql.SQLException: ORA-00947: not enough values
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282) at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639) at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:185) at oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:503) at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:965) at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:535) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1051) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2984) at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3026) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139) at org.hibernate.loader.Loader.getResultSet(Loader.java:1669) at org.hibernate.loader.Loader.doQuery(Loader.java:662) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2145) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029) at org.hibernate.loader.Loader.list(Loader.java:2024) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:307) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) at test.com.tsi.ta.model.domain.Tester.testAccountSearch(Tester.java:1424) at test.com.tsi.ta.model.domain.Tester.main(Tester.java:1592) Name and version of the database you are using: Oracle 9iThe generated SQL (show_sql=true): Hibernate: select constituen0_.ROWID as ROWID1_43_, constituen0_.LAST_NAME as LAST2_43_, constituen0_.FIRST_NAME as FIRST3_43_, constituen0_.APARTMENT_NUMBER as APARTMENT4_43_, constituen0_.STATE as STATE43_, constituen0_.ZIP_CODE as ZIP6_43_, constituen0_.ACCOUNT_ID as ACCOUNT7_43_, constituen0_.NAME_ID as NAME8_43_, constituen0_.ADDRESS_ID as ADDRESS9_43_, constituen0_.STS as STS43_, 'AL' as formula42_ from SEARCH_ACCOUNT constituen0_ where (constituen0_.ACCOUNT_ID, constituen0_.NAME_ID) in (select constituen2_.ACCOUNT_ID from EMAILS emailta1_, HIB_NAMES_EMAILS constituen2_ where emailta1_.ACCOUNT_ID=constituen2_.EMAIL_ACCOUNT_ID and emailta1_.EMAIL_ID=constituen2_.EMAIL_ID and emailta1_.EMAIL_ADDRESS='slin@targetsite.com')
Debug level Hibernate log excerpt:
5016 [main] DEBUG org.hibernate.impl.SessionImpl - opened session at timestamp: 4790974067920896 5016 [main] DEBUG org.hibernate.impl.SessionImpl - setting flush mode to: NEVER 5016 [main] DEBUG org.hibernate.transaction.JDBCTransaction - begin 5016 [main] DEBUG org.hibernate.jdbc.ConnectionManager - opening JDBC connection 5016 [main] DEBUG com.mchange.v2.resourcepool.BasicResourcePool - resource age is okay: com.mchange.v2.c3p0.impl.NewPooledConnection@cc ---> age: 2453 max: 2800000 [com.mchange.v2.resourcepool.BasicResourcePool@c3] 5016 [main] DEBUG com.mchange.v2.resourcepool.BasicResourcePool - trace com.mchange.v2.resourcepool.BasicResourcePool@c3 [managed: 1, unused: 0, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.NewPooledConnection@cc) 5016 [main] DEBUG org.hibernate.transaction.JDBCTransaction - current autocommit status: false 5016 [main] DEBUG org.hibernate.jdbc.JDBCContext - after transaction begin 5032 [main] DEBUG org.hibernate.engine.query.QueryPlanCache - unable to locate HQL query plan in cache; generating (from ConstituentSearchResultTA cs where cs.constituent in(select elements(e.constituents) from EmailTA e where e.emailAddress='slin@targetsite.com')) 5266 [main] DEBUG org.hibernate.hql.ast.QueryTranslatorImpl - parse() - HQL: from com.tsi.ta.model.domain.taobj.account.ConstituentSearchResultTA cs where cs.constituent in(select elements(e.constituents) from com.tsi.ta.model.domain.taobj.contact.EmailTA e where e.emailAddress='slin@targetsite.com') 5297 [main] DEBUG org.hibernate.hql.ast.AST - --- HQL AST --- \-[QUERY] 'query' +-[SELECT_FROM] 'SELECT_FROM' | \-[FROM] 'from' | \-[RANGE] 'RANGE' | +-[DOT] '.' | | +-[DOT] '.' | | | +-[DOT] '.' | | | | +-[DOT] '.' | | | | | +-[DOT] '.' | | | | | | +-[DOT] '.' | | | | | | | +-[DOT] '.' | | | | | | | | +-[IDENT] 'com' | | | | | | | | \-[IDENT] 'tsi' | | | | | | | \-[IDENT] 'ta' | | | | | | \-[IDENT] 'model' | | | | | \-[IDENT] 'domain' | | | | \-[IDENT] 'taobj' | | | \-[IDENT] 'account' | | \-[IDENT] 'ConstituentSearchResultTA' | \-[ALIAS] 'cs' \-[WHERE] 'where' \-[IN] 'in' +-[DOT] '.' | +-[IDENT] 'cs' | \-[IDENT] 'constituent' \-[IN_LIST] 'inList' \-[QUERY] 'query' +-[SELECT_FROM] 'SELECT_FROM' | +-[FROM] 'from' | | \-[RANGE] 'RANGE' | | +-[DOT] '.' | | | +-[DOT] '.' | | | | +-[DOT] '.' | | | | | +-[DOT] '.' | | | | | | +-[DOT] '.' | | | | | | | +-[DOT] '.' | | | | | | | | +-[DOT] '.' | | | | | | | | | +-[IDENT] 'com' | | | | | | | | | \-[IDENT] 'tsi' | | | | | | | | \-[IDENT] 'ta' | | | | | | | \-[IDENT] 'model' | | | | | | \-[IDENT] 'domain' | | | | | \-[IDENT] 'taobj' | | | | \-[IDENT] 'contact' | | | \-[IDENT] 'EmailTA' | | \-[ALIAS] 'e' | \-[SELECT] 'select' | \-[ELEMENTS] 'elements' | \-[DOT] '.' | +-[IDENT] 'e' | \-[IDENT] 'constituents' \-[WHERE] 'where' \-[EQ] '=' +-[DOT] '.' | +-[IDENT] 'e' | \-[IDENT] 'emailAddress' \-[QUOTED_STRING] ''slin@targetsite.com''
5297 [main] DEBUG org.hibernate.hql.ast.ErrorCounter - throwQueryException() : no errors 5344 [main] DEBUG org.hibernate.hql.antlr.HqlSqlBaseWalker - select << begin [level=1, statement=select] 5360 [main] DEBUG org.hibernate.hql.ast.tree.FromElement - FromClause{level=1} : com.tsi.ta.model.domain.taobj.account.ConstituentSearchResultTA (cs) -> constituen0_ 5375 [main] DEBUG org.hibernate.hql.ast.tree.FromReferenceNode - Resolved : cs -> constituen0_.ROWID 5375 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - getDataType() : constituent -> org.hibernate.type.ManyToOneType(com.tsi.ta.model.domain.taobj.account.ConstituentTA) 5375 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - dereferenceShortcut() : property constituent in com.tsi.ta.model.domain.taobj.account.ConstituentSearchResultTA does not require a join. 5375 [main] DEBUG org.hibernate.hql.ast.tree.FromReferenceNode - Resolved : cs.constituent -> (constituen0_.ACCOUNT_ID, constituen0_.NAME_ID) 5375 [main] DEBUG org.hibernate.hql.antlr.HqlSqlBaseWalker - select << begin [level=2, statement=select] 5375 [main] DEBUG org.hibernate.hql.ast.tree.FromElement - FromClause{level=2} : com.tsi.ta.model.domain.taobj.contact.EmailTA (e) -> emailta1_ 5391 [main] DEBUG org.hibernate.hql.ast.tree.FromReferenceNode - Resolved : e -> (emailta1_.ACCOUNT_ID, emailta1_.EMAIL_ID) 5391 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - getDataType() : constituents -> org.hibernate.type.SetType(com.tsi.ta.model.domain.taobj.contact.EmailTA.constituents) 5407 [main] DEBUG org.hibernate.hql.ast.tree.FromElementFactory - createManyToMany() : path = e.constituents role = com.tsi.ta.model.domain.taobj.contact.EmailTA.constituents associatedEntityName = com.tsi.ta.model.domain.taobj.account.ConstituentTA 5407 [main] DEBUG org.hibernate.hql.ast.tree.FromElement - FromClause{level=2} : com.tsi.ta.model.domain.taobj.account.ConstituentTA (no alias) -> constituen2_ 5407 [main] DEBUG org.hibernate.hql.ast.tree.FromClause - addJoinByPathMap() : e.constituents -> NAMES constituen2_ 5407 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - dereferenceCollection() : Created new FROM element for e.constituents : HIB_NAMES_EMAILS constituen2_ 5407 [main] DEBUG org.hibernate.hql.ast.tree.MethodNode - Creating elements for e.constituents[].elements 5438 [main] DEBUG org.hibernate.hql.ast.tree.FromReferenceNode - Resolved : e -> (emailta1_.ACCOUNT_ID, emailta1_.EMAIL_ID) 5438 [main] DEBUG org.hibernate.hql.ast.tree.DotNode - getDataType() : emailAddress -> org.hibernate.type.StringType@1cd 5438 [main] DEBUG org.hibernate.hql.ast.tree.FromReferenceNode - Resolved : e.emailAddress -> emailta1_.EMAIL_ADDRESS 5438 [main] DEBUG org.hibernate.hql.antlr.HqlSqlBaseWalker - select : finishing up [level=2, statement=select] 5438 [main] DEBUG org.hibernate.hql.ast.HqlSqlWalker - processQuery() : ( SELECT ( {select clause} ( constituen2_.ACCOUNT_ID ( . (emailta1_.ACCOUNT_ID, emailta1_.EMAIL_ID) constituents ) ) ) ( FromClause{level=2} EMAILS emailta1_ HIB_NAMES_EMAILS constituen2_ ) ( where ( = ( emailta1_.EMAIL_ADDRESS (emailta1_.ACCOUNT_ID, emailta1_.EMAIL_ID) emailAddress ) 'slin@targetsite.com' ) ) ) 5454 [main] DEBUG org.hibernate.hql.ast.util.SyntheticAndFactory - Using WHERE fragment [emailta1_.ACCOUNT_ID=constituen2_.EMAIL_ACCOUNT_ID and emailta1_.EMAIL_ID=constituen2_.EMAIL_ID] 5454 [main] DEBUG org.hibernate.hql.ast.util.JoinProcessor - Using FROM fragment [EMAILS emailta1_] 5454 [main] DEBUG org.hibernate.hql.antlr.HqlSqlBaseWalker - select >> end [level=2, statement=select] 5454 [main] DEBUG org.hibernate.hql.antlr.HqlSqlBaseWalker - select : finishing up [level=1, statement=select] 5454 [main] DEBUG org.hibernate.hql.ast.HqlSqlWalker - processQuery() : ( SELECT ( FromClause{level=1} SEARCH_ACCOUNT constituen0_ ) ( where ( in ( (constituen0_.ACCOUNT_ID, constituen0_.NAME_ID) constituen0_.ROWID constituent ) ( inList ( SELECT ( {select clause} ( constituen2_.ACCOUNT_ID ( . (emailta1_.ACCOUNT_ID, emailta1_.EMAIL_ID) constituents ) ) ) ( FromClause{level=2} EMAILS emailta1_ HIB_NAMES_EMAILS constituen2_ ) ( where ( {theta joins} emailta1_.ACCOUNT_ID=constituen2_.EMAIL_ACCOUNT_ID and emailta1_.EMAIL_ID=constituen2_.EMAIL_ID ) ( = ( emailta1_.EMAIL_ADDRESS (emailta1_.ACCOUNT_ID, emailta1_.EMAIL_ID) emailAddress ) 'slin@targetsite.com' ) ) ) ) ) ) ) 5454 [main] DEBUG org.hibernate.hql.ast.HqlSqlWalker - Derived SELECT clause created. 5454 [main] DEBUG org.hibernate.hql.ast.util.JoinProcessor - Using FROM fragment [SEARCH_ACCOUNT constituen0_] 5454 [main] DEBUG org.hibernate.hql.antlr.HqlSqlBaseWalker - select >> end [level=1, statement=select] 5454 [main] DEBUG org.hibernate.hql.ast.AST - --- SQL AST --- \-[SELECT] QueryNode: 'SELECT' querySpaces (SEARCH_ACCOUNT,EMAILS,HIB_NAMES_EMAILS,BRIEF_NAMES,NAMES) +-[SELECT_CLAUSE] SelectClause: '{derived select clause}' | +-[SELECT_EXPR] SelectExpressionImpl: 'constituen0_.ROWID as ROWID1_43_' {FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=cs,role=null,tableName=SEARCH_ACCOUNT,tableAlias=constituen0_,origin=null,colums={,className=com.tsi.ta.model.domain.taobj.account.ConstituentSearchResultTA}}} | \-[SQL_TOKEN] SqlFragment: 'constituen0_.LAST_NAME as LAST2_43_, constituen0_.FIRST_NAME as FIRST3_43_, constituen0_.APARTMENT_NUMBER as APARTMENT4_43_, constituen0_.STATE as STATE43_, constituen0_.ZIP_CODE as ZIP6_43_, constituen0_.ACCOUNT_ID as ACCOUNT7_43_, constituen0_.NAME_ID as NAME8_43_, constituen0_.ADDRESS_ID as ADDRESS9_43_, constituen0_.STS as STS43_, 'AL' as formula42_' +-[FROM] FromClause: 'from' FromClause{level=1, fromElementCounter=1, fromElements=1, fromElementByClassAlias=[cs], fromElementByTableAlias=[constituen0_], fromElementsByPath=[], collectionJoinFromElementsByPath=[], impliedElements=[]} | \-[FROM_FRAGMENT] FromElement: 'SEARCH_ACCOUNT constituen0_' FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=cs,role=null,tableName=SEARCH_ACCOUNT,tableAlias=constituen0_,origin=null,colums={,className=com.tsi.ta.model.domain.taobj.account.ConstituentSearchResultTA}} \-[WHERE] SqlNode: 'where' \-[IN] InLogicOperatorNode: 'in' +-[DOT] DotNode: '(constituen0_.ACCOUNT_ID, constituen0_.NAME_ID)' {propertyName=constituent,dereferenceType=ROOT_LEVEL,propertyPath=constituent,path=cs.constituent,tableAlias=constituen0_,className=com.tsi.ta.model.domain.taobj.account.ConstituentSearchResultTA,classAlias=cs} | +-[ALIAS_REF] IdentNode: 'constituen0_.ROWID' {alias=cs, className=com.tsi.ta.model.domain.taobj.account.ConstituentSearchResultTA, tableAlias=constituen0_} | \-[IDENT] IdentNode: 'constituent' {originalText=constituent} \-[IN_LIST] SqlNode: 'inList' \-[SELECT] QueryNode: 'SELECT' querySpaces (SEARCH_ACCOUNT,EMAILS,HIB_NAMES_EMAILS,BRIEF_NAMES,NAMES) +-[SELECT_CLAUSE] SelectClause: '{select clause}' | \-[SQL_TOKEN] CollectionFunction: 'constituen2_.ACCOUNT_ID' {method=elements,selectColumns=[constituen2_.ACCOUNT_ID, constituen2_.NAME_ID],fromElement=constituen2_} | \-[DOT] DotNode: '.' {propertyName=constituents,dereferenceType=3,propertyPath=constituents,path=e.constituents,tableAlias=constituen2_,className=com.tsi.ta.model.domain.taobj.account.ConstituentTA,classAlias=null} | +-[ALIAS_REF] IdentNode: '(emailta1_.ACCOUNT_ID, emailta1_.EMAIL_ID)' {alias=e, className=com.tsi.ta.model.domain.taobj.contact.EmailTA, tableAlias=emailta1_} | \-[IDENT] IdentNode: 'constituents' {originalText=constituents} +-[FROM] FromClause: 'from' FromClause{level=2, fromElementCounter=2, fromElements=2, fromElementByClassAlias=[e], fromElementByTableAlias=[emailta1_, constituen2_], fromElementsByPath=[e.constituents], collectionJoinFromElementsByPath=[], impliedElements=[]} | +-[FROM_FRAGMENT] FromElement: 'EMAILS emailta1_' FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=e,role=null,tableName=EMAILS,tableAlias=emailta1_,origin=null,colums={,className=com.tsi.ta.model.domain.taobj.contact.EmailTA}} | \-[FROM_FRAGMENT] ImpliedFromElement: 'HIB_NAMES_EMAILS constituen2_' ImpliedFromElement{implied,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=null,role=com.tsi.ta.model.domain.taobj.contact.EmailTA.constituents,tableName=NAMES,tableAlias=constituen2_,origin=EMAILS emailta1_,colums={emailta1_.ACCOUNT_ID emailta1_.EMAIL_ID ,className=com.tsi.ta.model.domain.taobj.account.ConstituentTA}} \-[WHERE] SqlNode: 'where' +-[THETA_JOINS] SqlNode: '{theta joins}' | \-[SQL_TOKEN] SqlFragment: 'emailta1_.ACCOUNT_ID=constituen2_.EMAIL_ACCOUNT_ID and emailta1_.EMAIL_ID=constituen2_.EMAIL_ID' \-[EQ] BinaryLogicOperatorNode: '=' +-[DOT] DotNode: 'emailta1_.EMAIL_ADDRESS' {propertyName=emailAddress,dereferenceType=4,propertyPath=emailAddress,path=e.emailAddress,tableAlias=emailta1_,className=com.tsi.ta.model.domain.taobj.contact.EmailTA,classAlias=e} | +-[ALIAS_REF] IdentNode: '(emailta1_.ACCOUNT_ID, emailta1_.EMAIL_ID)' {alias=e, className=com.tsi.ta.model.domain.taobj.contact.EmailTA, tableAlias=emailta1_} | \-[IDENT] IdentNode: 'emailAddress' {originalText=emailAddress} \-[QUOTED_STRING] LiteralNode: ''slin@targetsite.com''
5454 [main] DEBUG org.hibernate.hql.ast.ErrorCounter - throwQueryException() : no errors 5469 [main] DEBUG org.hibernate.hql.ast.QueryTranslatorImpl - HQL: from com.tsi.ta.model.domain.taobj.account.ConstituentSearchResultTA cs where cs.constituent in(select elements(e.constituents) from com.tsi.ta.model.domain.taobj.contact.EmailTA e where e.emailAddress='slin@targetsite.com') 5469 [main] DEBUG org.hibernate.hql.ast.QueryTranslatorImpl - SQL: select constituen0_.ROWID as ROWID1_43_, constituen0_.LAST_NAME as LAST2_43_, constituen0_.FIRST_NAME as FIRST3_43_, constituen0_.APARTMENT_NUMBER as APARTMENT4_43_, constituen0_.STATE as STATE43_, constituen0_.ZIP_CODE as ZIP6_43_, constituen0_.ACCOUNT_ID as ACCOUNT7_43_, constituen0_.NAME_ID as NAME8_43_, constituen0_.ADDRESS_ID as ADDRESS9_43_, constituen0_.STS as STS43_, 'AL' as formula42_ from SEARCH_ACCOUNT constituen0_ where (constituen0_.ACCOUNT_ID, constituen0_.NAME_ID) in (select constituen2_.ACCOUNT_ID from EMAILS emailta1_, HIB_NAMES_EMAILS constituen2_ where emailta1_.ACCOUNT_ID=constituen2_.EMAIL_ACCOUNT_ID and emailta1_.EMAIL_ID=constituen2_.EMAIL_ID and emailta1_.EMAIL_ADDRESS='slin@targetsite.com') 5469 [main] DEBUG org.hibernate.hql.ast.ErrorCounter - throwQueryException() : no errors 5485 [main] DEBUG org.hibernate.engine.query.HQLQueryPlan - HQL param location recognition took 0 mills (from ConstituentSearchResultTA cs where cs.constituent in(select elements(e.constituents) from EmailTA e where e.emailAddress='slin@targetsite.com')) 5485 [main] DEBUG org.hibernate.engine.query.QueryPlanCache - located HQL query plan in cache (from ConstituentSearchResultTA cs where cs.constituent in(select elements(e.constituents) from EmailTA e where e.emailAddress='slin@targetsite.com')) 5485 [main] DEBUG org.hibernate.engine.query.HQLQueryPlan - find: from ConstituentSearchResultTA cs where cs.constituent in(select elements(e.constituents) from EmailTA e where e.emailAddress='slin@targetsite.com') 5485 [main] DEBUG org.hibernate.engine.QueryParameters - named parameters: {} 5500 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0) 5500 [main] DEBUG org.hibernate.SQL - select constituen0_.ROWID as ROWID1_43_, constituen0_.LAST_NAME as LAST2_43_, constituen0_.FIRST_NAME as FIRST3_43_, constituen0_.APARTMENT_NUMBER as APARTMENT4_43_, constituen0_.STATE as STATE43_, constituen0_.ZIP_CODE as ZIP6_43_, constituen0_.ACCOUNT_ID as ACCOUNT7_43_, constituen0_.NAME_ID as NAME8_43_, constituen0_.ADDRESS_ID as ADDRESS9_43_, constituen0_.STS as STS43_, 'AL' as formula42_ from SEARCH_ACCOUNT constituen0_ where (constituen0_.ACCOUNT_ID, constituen0_.NAME_ID) in (select constituen2_.ACCOUNT_ID from EMAILS emailta1_, HIB_NAMES_EMAILS constituen2_ where emailta1_.ACCOUNT_ID=constituen2_.EMAIL_ACCOUNT_ID and emailta1_.EMAIL_ID=constituen2_.EMAIL_ID and emailta1_.EMAIL_ADDRESS='slin@targetsite.com') Hibernate: select constituen0_.ROWID as ROWID1_43_, constituen0_.LAST_NAME as LAST2_43_, constituen0_.FIRST_NAME as FIRST3_43_, constituen0_.APARTMENT_NUMBER as APARTMENT4_43_, constituen0_.STATE as STATE43_, constituen0_.ZIP_CODE as ZIP6_43_, constituen0_.ACCOUNT_ID as ACCOUNT7_43_, constituen0_.NAME_ID as NAME8_43_, constituen0_.ADDRESS_ID as ADDRESS9_43_, constituen0_.STS as STS43_, 'AL' as formula42_ from SEARCH_ACCOUNT constituen0_ where (constituen0_.ACCOUNT_ID, constituen0_.NAME_ID) in (select constituen2_.ACCOUNT_ID from EMAILS emailta1_, HIB_NAMES_EMAILS constituen2_ where emailta1_.ACCOUNT_ID=constituen2_.EMAIL_ACCOUNT_ID and emailta1_.EMAIL_ID=constituen2_.EMAIL_ID and emailta1_.EMAIL_ADDRESS='slin@targetsite.com') 5500 [main] DEBUG org.hibernate.jdbc.AbstractBatcher - preparing statement 5704 [main] DEBUG com.mchange.v2.c3p0.impl.NewPooledConnection - com.mchange.v2.c3p0.impl.NewPooledConnection@cc handling a throwable. java.sql.SQLException: ORA-00947: not enough values
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282) at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639) at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:185) at oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:503) at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:965) at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:535) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1051) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2984) at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3026) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139) at org.hibernate.loader.Loader.getResultSet(Loader.java:1669) at org.hibernate.loader.Loader.doQuery(Loader.java:662) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) at org.hibernate.loader.Loader.doList(Loader.java:2145) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029) at org.hibernate.loader.Loader.list(Loader.java:2024) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:307) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) at test.com.tsi.ta.model.domain.Tester.testAccountSearch(Tester.java:1424) at test.com.tsi.ta.model.domain.Tester.main(Tester.java:1592)
Code: Code: Code:
|
|