I'm trying to write a HQL query and am I little confused.
I have one table IntellectualPropery that is assoicated another Usage in a one to many relationship (i.e) IntellectualPropery can have many Usage records but each Usage record is assoicated to an single IntellectualProperty record.
I want to perform a search to find all IntellectualPropery records by a field in Usage called Project or by a number of Projects.
The query string that I've written is :
public List getIntellectualPropertysByProject(Object[] projectIds) {
return getHibernateTemplate().find("select ip from IntellectualProperty as ip join ip.usages as usage where usage.project = :ids", projectIds);
}
But I'm getting the error listed below. Any ideas or pointers?
No positional parameters in query: select ip from IntellectualProperty as ip join ip.usages as usage where usage.project = :ids
Kind Regards,
Barry
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:1.2
Mapping documents:
Full stack trace of any exception that occurs:<br/>
No positional parameters in query: select ip from IntellectualProperty as ip join ip.usages as usage where usage.project = :ids
java.lang.IllegalArgumentException: No positional parameters in query: select ip from IntellectualProperty as ip join ip.usages as usage where usage.project = :ids at net.sf.hibernate.impl.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:142) at net.sf.hibernate.impl.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:385) at org.springframework.orm.hibernate.HibernateTemplate$24.doInHibernate(HibernateTemplate.java:438) at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:176) at org.springframework.orm.hibernate.HibernateTemplate.executeFind(HibernateTemplate.java:196) at org.springframework.orm.hibernate.HibernateTemplate.find(HibernateTemplate.java:434) at au.edu.tlf.lips.persistence.hibernate.IntellectualPropertyDAOHibernate.getIntellectualPropertysByProject(IntellectualPropertyDAOHibernate.java:79) at au.edu.tlf.lips.persistence.IntellectualPropertyDAOTest.testGetIntellectualPropertysByProject(IntellectualPropertyDAOTest.java:149) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Name and version of the database you are using:MySQL 4.1