> Is it possible to create a primary key object for a bean 
> where the PK object
> itself is not stored in the database, but its attributes are?
> In other words, I have a table which doesn't have a unique 
> primary key but
> rather a pair of fields that must be unique.  How do I make a 
> primary key
> object without having to add another field to the database?

You need to create a primary key class for your EJB.  The class needs to
have public members representing the elements of your key.  It needs to
implement the java.io.Serializable interface, and it needs to implement:
  public boolean equals(Object obj)
and:
  public int hashCode()

You specify this class (fully qualified) as the <prim-key-class> in
ejb-jar.xml.  You do not specify a <primkey-field>.

--
Stephen Oakes, [EMAIL PROTECTED]
+61 3 9695 5777, www.atomicmedia.com

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

Reply via email to