Discussions

EJB design: Id generator - java singleton, sessionbean jdbc, entity bean?

  1. What's the best form of id generator to use in EJB architectures and which type should be used when.

    Cheers.
  2. try using the sequence number generator of the backend database. Oracle generates unique id's
  3. Yes, but what is the best method to access this, as per the original question?
  4. On my last project, we used BMP entity EJB's to get an Oracle sequence via a stored procedure.

    So, in the ejbCreate method, we called the stored procedure and created the database row.

    Using a stateless session EJB would be just as good I'd have thought.

    On my current project, we use Sybase which doesn't have sequence generators. We have implemented a customised version of the High-Low pattern that is described within the 'patterns' section of this site. This works very well :-)

    Cheers,
    Rick