> > I'm using a MySQL DataBase at this time.
> > And how can I get the id generated by the database for the current bean.
[quoted text clipped - 5 lines]
>
> I assume other servers have other ways of dealing with it.
> And how can I do if I prefer to stay independent from the platform server ?
>
> Bernard
I don't know if it is a MUST for your project to have numeric ids. If you
can use strings, look at these resources:
http://www.google.com/search?q=java+UUID+generation
Bye,
Jens
--
Jens Kutschke
http://www.j-dimension.com
Bernard Koninckx - 16 Jan 2004 16:29 GMT
It's a very long key ...
I prefere to use an Integer or a Double field into my database.
Bernard
> > And how can I do if I prefer to stay independent from the platform server
> ?
[quoted text clipped - 12 lines]
> Jens Kutschke
> http://www.j-dimension.com
> And how can I do if I prefer to stay independent from the platform server ?
Well, you could create the number as a field in some table, load it at
startup into an application-scope bean and have a single instance of
that bean manage the number. (If you're worried about crashes, you
could validate it at startup as well.)
If you can get away with non-sequential numbers, you can base your key
on a startup timestamp and then you don't have to worry about
validations after crashes.
But, part of the logic for having deployment descriptors is to allow
deployment variables to change. If you are using any files called
jboss*.xml, then you're already not completely independent from the
server.
Bernard Koninckx - 19 Jan 2004 11:28 GMT
Please,
Could you send me a sample code to illustrate the first method, including
the ejb-jar, ... needed ?
Thank you very much
Bernard
> > And how can I do if I prefer to stay independent from the platform server ?
>
[quoted text clipped - 11 lines]
> jboss*.xml, then you're already not completely independent from the
> server.