I was wrong, I have read in Sun's Guide that the PK-classes can be of any type as far as the attributes that form that class have the same name as those container managed in the bean (among other requisites).


I'm gonna try.





José Manuel Molina wrote:
Reading with care the code at "mastering EJB 2nd ed" I have seen two "tricks" about the PK-class they use

-. It goes to the DB as a string, so its supposed* to be mapped like that, doing this with string is stright forward, as the toString method solves it, its not the same however when you need the PK to be assigned by the DB Engine. (AUTO-Increment, I use MySQL)

-. here it comes the *, they don't put any mapping file in the book, (maybe in the downloadable sources but I havent readed them), so It wasn't clear to me at first what they were doing with it (they follow EJB 2.0, so the fileds arent in the Bean class, I think that in 1.x they fileds must be Class attributes but I'm not totally sure).



So.....   please if I'm mistaked tell me.    The Pk must be a Java "incoporated class" mappeable somehow to SQL types or if you use yopur own Pk it mus go to the DB as a String.


David Blevins wrote:
You should try using just java.lang.Integer as a primary key.  I know that will will work.

-David




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
http://OpenEJB.sf.net
OpenEJB-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/openejb-user


  


Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to