I'm trying something different...to try to solve the same problem.and am using Oracle8.
I have a trigger on the table set to fire "before INSERT" and set the id to the mySqeunce.nextval. But this doesn't seam to be working. On the entity bean that I get back i call getId and Jboss throws this exception: java.lang.IllegalArgumentException: Attempt to get a lock for a null object. The row however gets inserted properly. Does anyone know why this is the case? > -----Original Message----- > From: Rod Macpherson [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 18, 2003 1:43 PM > To: [EMAIL PROTECTED] > Subject: RE: [JBoss-user] CMP - Primary Key Strategies? > > > Consider a static interface createPrimaryKey() or > createPrimaryKey(String source) where source is a sequence name in the > oracle implementation. Use a pooled connection (needless to say) and > cache, say, a few dozen keys in memory. Alternatively you can > make your > sequence increment by, say, 100 and dish out keys until you > exhaust the > cache then grab another base value: high-low pattern as it is > sometimes > called. This strategy is portable insofar as you can have an > implementation for various RDBMSs but the rest of your code does not > change. The ejbCreate just calls createPrimaryKey and if anything goes > wrong you throw away that key. If you're server bounces you throw away > the cached keys, no biggie. > > > -----Original Message----- > From: Eric Tim [mailto:[EMAIL PROTECTED] > Sent: Monday, March 17, 2003 9:39 PM > To: [EMAIL PROTECTED] > Subject: [JBoss-user] CMP - Primary Key Strategies? > > > I'm working on a CMP EntityBean with JBoss3 on > Oracle8. > > My primary key must be a unique number. Oracle has a > nice facility for handling sequences, which doesn't > seam possible with this senerio because i'd need to > write some jdbc code in the ejbCreate method to get > the nextval. > > I'm aware that there are several J2EE > patterns/blueprints to solve this...most have > not-so-clean side effects that i'd like to > avoid...such as extra tables..etc. > > Is there anything that i can do with JBoss to solve > this problem in a simple and clean manner? > > Someone told me that there is a cmp engine that i can > buy that plugs into jboss that makes this easy. Does > anyone know what product this is? Does anyone have > experience with it? > > thanks, > -et > > __________________________________________________ > Do you Yahoo!? > Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! > http://platinum.yahoo.com > > > ------------------------------------------------------- > This SF.net email is sponsored by:Crypto Challenge is now open! > Get cracking and register here for some mind boggling fun and > the chance of winning an Apple iPod: > http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en > _______________________________________________ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user > > > ------------------------------------------------------- > This SF.net email is sponsored by: Does your code think in ink? > You could win a Tablet PC. Get a free Tablet PC hat just for playing. > What are you waiting for? > http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en > _______________________________________________ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user > This transmission contains information solely for intended recipient and may be privileged, confidential and/or otherwise protect from disclosure. If you are not the intended recipient, please contact the sender and delete all copies of this transmission. This message and/or the materials contained herein are not an offer to sell, or a solicitation of an offer to buy, any securities or other instruments. The information has been obtained or derived from sources believed by us to be reliable, but we do not represent that it is accurate or complete. Any opinions or estimates contained in this information constitute our judgment as of this date and are subject to change without notice. Any information you share with us will be used in the operation of our business, and we do not request and do not want any material, nonpublic information. Absent an express prior written agreement, we are not agreeing to treat any information confidentially and will use any and all information and reserve the right to publish or disclose any information you share with us. ------------------------------------------------------- This SF.net email is sponsored by: Does your code think in ink? You could win a Tablet PC. Get a free Tablet PC hat just for playing. What are you waiting for? http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
