-->
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.  [ 2 posts ] 
Author Message
 Post subject: what's wrong with this HQL?
PostPosted: Sun Oct 03, 2004 3:47 am 
Newbie

Joined: Sun Oct 03, 2004 3:39 am
Posts: 1
the class is here:
public class CmrcCategory implements Serializable {

/** identifier field */
private Integer categoryId;

/** nullable persistent field */
private String categoryName;

/** persistent field */
private Set cmrcProducts;
...

the HQL is here
List l=session.CreateQuery("select c.cmrcProducts from CmrcCategory c where c.categoryId='14'").list();

the Exception is here
expecting 'elements' or 'indices' after: id [select c.cmrcProducts from code.model.CmrcCategory c where c.categoryId='14']

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 03, 2004 4:57 pm 
Beginner
Beginner

Joined: Wed Nov 19, 2003 6:46 pm
Posts: 41
Location: Auckland, New Zealand
Well... RTFM really...


but the answer is in the error message:

try using the elements function as documented in the manual. That is:

List l=session.CreateQuery("select elements(c.cmrcProducts) from CmrcCategory c where c.categoryId='14'").list();


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.