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);
}