I am curious why you used an EntityBean here. Is it becaus your key
generation it db based rather than algorithm based?

Regards,

-Chris.

Floyd Marinescu wrote on 5/15/00 12:53 pm:

>the best solution is not to
>rely on the database for
>generating primary keys. I
>also struggled with this
>simple issue, and ended up
>writing my own primary key
>generating mechanism. I
>have an entity bean that
>generated primary keys for
>my app. Its simple and more
>portable.
>
>Floyd Marinescu
>
>-----------------------------
>----
>Senior Architect
>The Middleware Company
>http://www.middleware-com
>pany.com
>floyd@middleware-company
>.com
>416-889-6115
>
>Need help with EJB / J2EE?
>Ask about our on-site
>training and consulting
>services.
>
>-----Original Message-----
>From: A mailing list for
>Enterprise JavaBeans
>development
>[mailto:EJB-INTEREST@JAVA.
>SUN.COM]On Behalf Of
>Seibert, Dan Sent: Monday,
>May 15, 2000 8:39 AM
>To:
>[EMAIL PROTECTED]
>M
>Subject: Creating Entity
>Beans with db generated
>sequence numbers
>
>
>Hi All,
>
>I have a question regarding
>Creating CMP Entity EJBs. For
>several of our Entities, we
>use a sequence number
>generated by our database
>(Oracle) as a primary key.
>The problem is that our
>ejbCreate() method expects
>a primary key when invoked.
>Also, the persister
>generated create methods
>appear to be called before
>even the first line of the
>bean's ejbCreate().
>
>To get around this, at the
>controller level, we were able
>to create a separate
>Connection, query the
>database for the next
>sequence number, close the
>connection, and then call the
>EJBHome Create() method
>passing in the sequence
>number.
>Although it works, this
>approach seems very
>clumsy and slow.  There's got
>to be a better way,
>Perhaps where we don't even
>need a separate database
>connection.
>
>I assume many of you are
>also using database
>generated sequence
>numbers. Have any of you
>run into this same problem?
>Any ideas for a more elegant
>solution?
>
>
>Thanks,
>Dan
>
>===================
>===================
>===================
>==================
>To unsubscribe, send email
>to [EMAIL PROTECTED]
>and include in the body  of
>the message "signoff
>EJB-INTEREST".  For general
>help, send email to
>[EMAIL PROTECTED] and
>include in the body of the
>message "help".
>
>===================
>===================
>===================
>==================
>To unsubscribe, send email
>to [EMAIL PROTECTED]
>and include in the body of
>the message "signoff
>EJB-INTEREST".  For general
>help, send email to
>[EMAIL PROTECTED] and
>include in the body of the
>message "help".


Chris Raber, [EMAIL PROTECTED]
Director, GemStone Systems, Inc.
p:248-680-6691, f:248-680-6689
http://www.gemstone.com/

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to