HIbernate query language problem.....

Posted by mslatf on Stack Overflow See other posts from Stack Overflow or by mslatf
Published on 2010-04-13T22:58:03Z Indexed on 2010/04/13 23:13 UTC
Read the original article Hit count: 272

Filed under:
|

I have a Project class that has a Set of userstories called userStories12many. I'm having troubles 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);

}

© Stack Overflow or respective owner

Related posts about hibernate

Related posts about java