I'm not sure I understand completely... but let's use another
terminology.

XYZBean the name of the bean
XYZPK   the class for the primary key

then the home interface contains
 XYZ findByPrimaryKey(XYZPK key);       // Where XYZ is the remote
interface to your bean

The same name will be used in the primary key class as in the bean

XYZBean
        Integer id;
        Integer idField2;
XYZPK
        Integer id;
        Integer idField2;

The jaws.xml mapping file is only needed to note differences between the
class fields vs. the actual table attributes. For example : idField2
(class member) could map to ID_FIELD_2 (attribute in the database).

The ejb-jar.xml must reflect the new key class <prim-key-class> under
the <entity> tag.

Don't forget that there is a specific format for PK classes, as they
must contain a constructor, hashCode() 
equals(). 

This is in no way exhaustive, but I hope it puts you on the right track!

Daniel


-----Message d'origine-----
De : Nordahl, David C [mailto:[EMAIL PROTECTED]]
Envoyé : 19 avril, 2001 15:16 
À : '[EMAIL PROTECTED]'
Objet : [JBoss-user] Question about custom finders for compound objects


I found a place in my EJB book (O'Reilly 2nd ed. pg. 159) that talks
about
having a compound key as a primary key.  It says that you have to map
the
keys to corresponding fields in the bean class.  

Ex. If 'Component' is a compound primary key and 'id' is an attribute of
'Component' which findByPrimaryKey(Integer key) is to search for.  It
says
the Component.id field must map to a XYZBean.id field of type int in the
XYZBean class.  

But it doesn't talk about mapping.  Is this something you must setup in
the
jaws.xml file? Or does it just mean that for the attributes for which
you
want to execute searches on (ie. write findBy methods for), you must
maintain duplicate copies of them in bean class?  If so isn't there a
cleaner way to do this?

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to