I have two classes with composite PKs.  The PK classes are annotated with 
@Embeddable and the IDs with @EmbeddedId.

One class (table) has a composite key made up of a student primary key and a 
test primary key.  The class is called something very original, like 
Student_Test. The PK is called ID.  The sudent PK is a code, say his dob 
concatenated with his initials (if there are two identical ones, concat 2 to 
the second one).

If I want to get all instances of Sudent_Test for a particular student, do I do 
this?

  | Query q = manager.createQuery("select st from Student_Test st where 
st.ID.student = :student")
  | 
Searches through the forums have led me to believe it is not going to be this 
easy, but have not provided clear answers.  There is some sugestion that 
Student should be a member of Student_Test.  But with a composite PK already 
holding enough to get a reference to Student, that seems wasteful.

Any ideas?

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

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


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to