Hi Iam trying to use named queries for the contained objects.
say Products has many Items.
SO how would i do named queries in this case?
<sql-query name="QUERY_GET_PRODUCTS_BY_NAME">
<return alias="product" class="Product"/>
<return-join alias="item" property="product.item"/>
SELECT {product.*}
FROM PRODUCTS product
JOIN ITEMS item
ON product.ITEM_ID = item.ITEM_ID
WHERE product.name LIKE :productName
</sql-query>
I tried to use it this way but iam geting an erro message
2009-04-03 11:38:34,828 WARN [main] (JDBCExceptionReporter.java:77) - SQL Error: 17006, SQLState: null
2009-04-03 11:38:34,828 ERROR [main] (JDBCExceptionReporter.java:78) - Invalid column name
org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2216)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152)
at eman.ism.core.hibernate.HibernateDAO.executeSQLNamedQuery(HibernateDAO.java:152)