I attached below a post made yesterday by Scott Ellis in this forum. I think
that should answer your question :)
<quote>
I've been having some problems with the primary key class lately, and I have
looked for a book that really describes the process. I found O'Reilly's
Enterprise JavaBeans devotes a lot of time to the subject if you are
intersted in picking it up. I got it because it was recommended by the
website www.ejbnow.com . To get the primary key class right, you are going
to need a good reference.
Basically you need to make sure that the primary key class has public member
variables that match exactly in type and name of the same fields in your
implementation bean. The pk class must be serializable and implement the
equals and hashCode methods, and must have a default empty constructor. I'm
not sure if it is required, but you also provide a constructor that contains
the key values. The hashCode method I don't really know a lot about, but at
ejbnow.com, there is a tips page that describes how to code it.
In your ejb-jar.xml, make sure to not specify
<primkey-field>...</primkey-field>. When you specify a custom
prim-key-class you don't need this entry, and it will mess you up. Trust
me. So if your primary key class is called CustomerPK, then your entry for
the class in ejb-jar.xml is ( assuming no package name )
<prim-key-class>CustomerPK</prim-key-class>
Then you need to specify your primary key class in the home interface in
findByPrimaryKey, and it must be the return type of all of your ejbCreates
in the bean implementation.
</quote>
Scott
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".