-
1. Re: auto_increment
pboddie Feb 14, 2002 1:22 PM (in response to garbuzov)You might want to try...
<sql-type>INTEGER auto_increment PRIMARY KEY</sql-type>
This seems to work, although I have some other issues with entity beans at the moment. -
2. Re: auto_increment
pboddie Feb 14, 2002 2:12 PM (in response to garbuzov)Actually, this probably won't work at all. The primary key needs to be set during ejbCreate, but you don't have access to the generated value. Moreover, the entity bean doesn't seem to be able to "pick up" the generated value by itself. Therefore, you can't even provide a fake value and hope that it gets changed later.
What we really need is "unknown primary keys", I think. -
3. Re: auto_increment
davidjencks Feb 14, 2002 4:43 PM (in response to garbuzov)There is no way at all to do this now. Dain is working on a generic key generator for the cmp2. I am considering how to make it possible to use stored procedures for db access in cmp, which would provide an indirect solution (I think). (write a sp to do the insert, returning the id). My part is in the fairly distant future.
-
4. Re: auto_increment
pboddie Feb 15, 2002 5:55 AM (in response to garbuzov)So far, all of the material I've found on unknown primary keys just restates the specification (isn't that always the case with EJB?), but the specification also seems to suggest that adding extra abstract methods, cmp-fields and possibly a constructor (where the primary key is set) is the way to go.
That is, you add a constructor to the entity bean implementation and use some kind of generator there to set the primary key field. Should this work? (I can't seem to make it work yet.)