-->
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: problems with HQL query .....
PostPosted: Tue Apr 13, 2010 6:45 pm 
Newbie

Joined: Tue Apr 13, 2010 6:32 pm
Posts: 1
I have a project class that has a set of userstories called userStories12many
im having trouble trying to get the project that has a certain userstory in its set getComponent(int userStoryID)

I think im on the right track but i dont know what i did wrong

public Projects getComponent(int userStoryID)
{
Session session = SessionFactoryHelper.getSessionFactory()
.getCurrentSession();
session.beginTransaction();

List<Projects> compo = session.createQuery("select p "
+"from Projects as p inner join fetch p.userStories12many as u "
+"where u.storyId='"+userStoryID+"'").list();
session.getTransaction().commit();
return compo.get(0);

}


Top
 Profile  
 
 Post subject: Re: problems with HQL query .....
PostPosted: Tue Apr 13, 2010 10:19 pm 
Newbie

Joined: Tue Apr 13, 2010 2:23 am
Posts: 7
no reply!

◎◎◎◎

_________________
Hobbies Sports: Playing golf!

ping g10 driver*
ping g10 irons|


Top
 Profile  
 
 Post subject: Re: problems with HQL query .....
PostPosted: Wed Apr 14, 2010 3:25 am 
Regular
Regular

Joined: Wed Mar 10, 2010 4:48 am
Posts: 106
Did you get an error?


Top
 Profile  
 
 Post subject: Re: problems with HQL query .....
PostPosted: Wed Apr 14, 2010 4:57 am 
Beginner
Beginner

Joined: Fri Aug 24, 2007 9:47 am
Posts: 21
try something like that

List<Projects> compo =
s.createQuery(new StringBuffer("SELECT a, b FROM ")
.append(Projects .class.getName() + " a, ")
.append(userStories12many .class.getName() + " b ")
.append(" WHERE a.storyId. = buserStoryID. ")
.toString())
.list();

_________________
recherche-programmeur.fr


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.