I cannot seem to get the syntax down here. I have a compound primary defined
something like this:
@Entity
@Table(name = "Person")
public class Person implements Serializable {
PersonPk pk;
.
.
.
@EmbeddedId({
@AttributeOverride(name=?ssn?),
@AttributeOverride(name=?tshirtsize?)})
public PersonPK getPk()
{ return pk; }
@Embeddable
public class PersonPK implements Serializable
{
private String ssn;
private String tshirtsize;
...
}
But when I go to do a query on the leading field of the compound key, in this
case to get all the tshirtsizes associated with a specific ssn in a query like:
public @Stateless class PersonEJBBean implements PersonEJB
{
@PersistenceContext (unitName = "Personnel")
protected EntityManager vEm;
List getTshirtsizeBySsn (long ssn) {
List ssnList = Em.createQuery("from Person p where p.ssn = :Ssn)
.setParameter("Ssn", new Long(ssn))
.getResultList();
.
.
.
I get an InvocationException the states:
could not resolve property: ssn of Person [from Person p where ......]
?????
I've tried everything I can think of to execute a query on the leading part of
a compound key, but cannot seem to come up with an acceptable syntax.
Any ideas?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3919935#3919935
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3919935
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user