[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Named query not known error with Jboss/EJB3
elsieq
do-not-reply at jboss.com
Mon Apr 16 12:43:43 EDT 2007
Hi,
I am using jboss-4.0.5 GA. When I try to use a named query, I am getting a hibernate mapping exception "Named query not known". The steps to create and use a named query with EJB3 seem very simple so I don't know where I'm going wrong.
I have defined the named query with the entity like this:
@Entity
@NamedQuery(name="findGroupsByMemberId",
query="select gm from Groupmember gm where gm.memberIdKy = :memberId")
@Table(name = "groupmember", catalog = "cmpe275db", uniqueConstraints = {})
public class Groupmember implements java.io.Serializable {
I then use that query in a stateless session bean like this:
Query q = em.createNamedQuery("findGroupsByMemberId");
q.setParameter("memberId",stumblerId);
Since I am coding to EJB3 and also using Eclipse with the JBossIDE plugin, that is pretty much all I need to do. As far as I know, I don't have to deal with mapping files or anything else like that.
Any clues or insights would be really appreciated.
Regards,
-Elsie Qureshi
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037635#4037635
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037635
More information about the jboss-user
mailing list