users@glassfish.java.net

Re: JPA - One-To-Many relationship query problem

From: <glassfish_at_javadesktop.org>
Date: Thu, 31 Jan 2008 14:50:37 PST

My query itself looks straight forward. See below. Like I said, I do get the result back. The object is populated with all the rest of the data including parent class data. The only thing that doesnt get filled in is the list of one-to-many relationship. The sql statement logged does work and returns a list of 10 items when I run it in query analyzer.

                        MenuType menu = null;
                        //TODO get these sql statements from a catalog
                        String sql = "select m from MenuType m where m.name = :name";
                        //create query
                        Query query = entityManager.createQuery(sql);
                        query.setParameter("name", name);
                        //run query
                        menu = (MenuType)query.getSingleResult();
                        //return result.
                        return menu;
[Message sent by forum member 'pmysore' (pmysore)]

http://forums.java.net/jive/thread.jspa?messageID=256883