-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Using a DTO in HQL query
PostPosted: Tue Jul 24, 2007 4:33 am 
Newbie

Joined: Wed Jul 06, 2005 12:39 pm
Posts: 8
Location: UK
Hi

I have an hibernate HQL query as follows (This is just an example)

"select new DataTransferObject(app.listOfItems) from ModelObject as app "

The item passed into the constructor is a list mapped as a many-to-many List in the HBM file.

When I run the query passing in the List to the contructor I get an exception. If i dont pass this list in it is fine.

Anyone have any ideas? The only reason I want to pass in the list (amongst other properties) is i only want a small number of properties returned in the search result.

is org.hibernate.exception.SQLGrammarException: could not execute query
Caused by: org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query
Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
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:2214)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
at org.hibernate.loader.Loader.list(Loader.java:2090)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:388)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.springframework.orm.hibernate3.HibernateTemplate$29.doInHibernate(HibernateTemplate.java:844)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:835)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 24, 2007 4:39 am 
Newbie

Joined: Wed Jul 06, 2005 12:39 pm
Posts: 8
Location: UK
Just answered my own question.

Hibernate 3 does not seem to support collctions in Select new.

Will this every be added as this would be useful?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 24, 2007 4:40 am 
Newbie

Joined: Wed Jul 06, 2005 12:39 pm
Posts: 8
Location: UK
Just answered my own question.

Hibernate 3 does not seem to support collctions in Select new.

Will this every be added as this would be useful?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 24, 2007 4:40 am 
Newbie

Joined: Wed Jul 06, 2005 12:39 pm
Posts: 8
Location: UK
Just answered my own question.

Hibernate 3 does not seem to support collections in Select new.

Will this every be added as this would be useful?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.