I have an hql named query:
Code:
from CatalogEntryImpl as entity
where entity.catalog = :catalog
and entity.publication.authors.firstName = :authorFirstName
and entity.publication.authors.lastName = :authorLastName
CatalogEntryImp.catalog is a CatalogImpl object, and
CatalogEntryImpl.publication is a PublicationImpl object
with a collection of Author objects that have firstName
and lastName properties.
So, I want my hql to select CatalogEntryImpls where
any of their publication's authors match the authorFirstName
and authorLastName values.
However, I get an "ORA-01008: not all variables bound"
error when the query is run. I've verified that my :catalog,
:authorFirstName and :authorLastName parameters
are not null and of correct type.
Now, what's interesting is that it /seems/ to be giving
me errors on CatalogEntryImpl.subjectEntries, which
is a collection of SubjectEntryImpl objects.
Any ideas? (And if the idea is RTFM, please supply me
a link to said FM page, because I have scoured the docs
/pretty well/ at this point...).
Thanks!
Brent
Hibernate version: 3.0.5
Mapping documents: Will provide if necessary
Code between sessionFactory.openSession() and session.close():Code:
Vector r = (Vector) catalogService.execute(new HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException {
// query is the named query mentioned above..
Query q = session.getNamedQuery(query);
String key = null;
// params is a Map of parameters...
for (Iterator it = params.keySet().iterator(); it.hasNext();) {
key = (String) it.next();
q.setParameter(key, params.get(key));
}
q.setMaxResults(5);
q.setCacheable(true);
return new Vector(new LinkedHashSet(q.list()));
}
}, true);
Full stack trace of any exception that occurs:Code:
xxx.CatalogServiceException: Error performing 'xxx.CatalogService.execute(org.springframework.orm.hibernate3.HibernateCallback hibernateCallback, boolean boo)' --> org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not load collection by subselect: [xxx.CatalogEntryImpl.subjectEntries#<275414, 301453>]; uncategorized SQLException for SQL [select subjectent0_.CATALOG_ENTRY_FK as CATALOG3_1_, subjectent0_.ID as ID1_, subjectent0_.ID as ID0_, subjectent0_.ORDINAL as ORDINAL13_0_, subjectent0_.CATALOG_ENTRY_FK as CATALOG3_13_0_, subjectent0_.SUBJECT_FK as SUBJECT4_13_0_ from SUBJECT_ENTRY subjectent0_ where subjectent0_.CATALOG_ENTRY_FK in (select catalogent0_.ID from CATALOG_ENTRY catalogent0_, PUBLICATION publicatio1_, AUTHOR authors2_, AUTHOR authors4_ where publicatio1_.ID=authors4_.PUBLICATION_FK and publicatio1_.ID=authors2_.PUBLICATION_FK and catalogent0_.PUBLICATION_FK=publicatio1_.ID and catalogent0_.CATALOG_FK=? and authors2_.FIRST_NAME=? and authors4_.LAST_NAME=?) order by subjectent0_.CATALOG_ENTRY_FK]; SQL state [72000]; error code [1008]; ORA-01008: not all variables bound
; nested exception is java.sql.SQLException: ORA-01008: not all variables bound
[nested exception: org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not load collection by subselect: [xxx.CatalogEntryImpl.subjectEntries#<275414, 301453>]; uncategorized SQLException for SQL [select subjectent0_.CATALOG_ENTRY_FK as CATALOG3_1_, subjectent0_.ID as ID1_, subjectent0_.ID as ID0_, subjectent0_.ORDINAL as ORDINAL13_0_, subjectent0_.CATALOG_ENTRY_FK as CATALOG3_13_0_, subjectent0_.SUBJECT_FK as SUBJECT4_13_0_ from SUBJECT_ENTRY subjectent0_ where subjectent0_.CATALOG_ENTRY_FK in (select catalogent0_.ID from CATALOG_ENTRY catalogent0_, PUBLICATION publicatio1_, AUTHOR authors2_, AUTHOR authors4_ where publicatio1_.ID=authors4_.PUBLICATION_FK and publicatio1_.ID=authors2_.PUBLICATION_FK and catalogent0_.PUBLICATION_FK=publicatio1_.ID and catalogent0_.CATALOG_FK=? and authors2_.FIRST_NAME=? and authors4_.LAST_NAME=?) order by subjectent0_.CATALOG_ENTRY_FK]; SQL state [72000]; error code [1008]; ORA-01008: not all variables bound
; nested exception is java.sql.SQLException: ORA-01008: not all variables bound
]
Name and version of the database you are using: Oracle 9.0.1
The generated SQL (show_sql=true): (in stack trace)
Debug level Hibernate log excerpt:Code:
Code: