[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: Help on Named Query

elsieq do-not-reply at jboss.com
Tue Apr 17 14:53:26 EDT 2007


Hi again scout1lacno,

Here is my entity with named query defined:

@Entity
@NamedQuery (name="Groupmember.findGroupsByMemberId", query="SELECT gm FROM Groupmember gm")
@Table(name = "groupmember", catalog = "cmpe275db", uniqueConstraints = {})
public class Groupmember implements java.io.Serializable {
...
}

And here is the relevant portion of my stateless session bean where I try to use the query:

Query q = em.createNamedQuery
("Groupmember.findGroupsByMemberId");

That is really all that I have done.  I am wondering if this error has anything to do with my persistence.xml which simply looks like this:

<?xml version="1.0" encoding="UTF-8"?>

	<persistence-unit name="cmpe275PU" transaction-type="JTA">
		<jta-data-source>java:/MySQLDS</jta-data-source>
		
			
				
	</persistence-unit>


So I am not even dealing with using the % yet ... I am just trying to get a basic named query to work.  Any help would be greatly appreciated.

-elsieq

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4038105#4038105

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4038105



More information about the jboss-user mailing list