yea right
----- Original Message -----
From: "costin" <[EMAIL PROTECTED]>
To: "Brijesh Sood" <[EMAIL PROTECTED]>
Sent: Wednesday, March 19, 2003 4:06 PM
Subject: Re[2]: [JBoss-user] CMP - Primary Key Strategies?


> Hi!
>
> So basically you can use the autoincrement feature with:
>
> - not doing anything in ejbCreate
>
> (the rest is standard - get/set methods/descriptor/etc...)?
>
> Is this correct?
>
>
> BS> Hi Eric
> BS>             Well this is good to used db based sequence number as the
primary key . I m currently using the mysql and its auto_increment sequence
as primary key
> BS> But to use this feature u have to use jboss 3.2.03 beta ..As  unique
sequence no is managed by the db not but the EJB container . so while
inserted the new record . u dont have to pass the value
> BS> for the unique sequence no.
> BS> Like u have a User Entity EJB
> BS> User have DB schema
>
> BS> userID int(11) auto_increment primary key  ----------------------- now
this is acting as the primary key
> BS> username varchar(30)
> BS> password varchar(30)
> BS> email varchar(30)
> BS> ur
>
> BS> ejbCreate(String username, String password, String email)
> BS> {
> BS>     //    here u havent provided the value of userID as it inserted by
DB // it can any sequence no
> BS> }
> BS> ejbPostCreate(String username, String password, String email)
> BS> {
>
> BS> }
> BS>     Deployment decriptor entor
>
> BS>       <ejb-name>User</ejb-name>
> BS>       <local-home>com.n4i.ejb.test.UserLocalHome</local-home>
> BS>       <local>com.n4i.ejb.test.UserLocal</local>
> BS>       <ejb-class>com.n4i.ejb.test.UserBean</ejb-class>
> BS>       <persistence-type>Container</persistence-type>
> BS>       <prim-key-class>java.lang.Integer</prim-key-class>  // I m using
int(11) as the primary key if ur using some unique string the specify
java.lang.String
>
> BS>      <reentrant>False</reentrant>
> BS>       <cmp-version>2.x</cmp-version>
> BS>       <abstract-schema-name>User</abstract-schema-name>
> BS>       <cmp-field>
> BS>         <field-name>userID</field-name>
> BS>       </cmp-field>
> BS>       <cmp-field>
> BS>         <field-name>username</field-name>
> BS>       </cmp-field>
> BS>       <cmp-field>
> BS>         <field-name>password</field-name>
> BS>       </cmp-field>
> BS>       <cmp-field>
> BS>         <field-name>email</field-name>
> BS>       </cmp-field>
> BS>       <primkey-field>userID</primkey-field>
>
>
>
> BS> But u need to have getter and setter for this unique sequence no
primary key field ... as its  getter method will be used when u call
getUserID on local/Remote refernce of the entityBean .
> BS> // One thing that is to noted here .is userID field is managed by the
DB not by EJB Container but have to declare in the deployment descriptor as
CMP field
>
> BS> Eric this thing is working with mysql for mee .. in oracle if ur using
sequence as primary key its value is integer .. and it will work tooo .
>
> BS> Rgds
>
> BS> Brijesh
>
>
> BS> ----- Original Message -----
> BS> From: "Eric Tim" <[EMAIL PROTECTED]>
> BS> To: <[EMAIL PROTECTED]>
> BS> Sent: Tuesday, March 18, 2003 11:08 AM
> BS> 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
> >>
>
>
> --
>  costin                            mailto:[EMAIL PROTECTED]
>
>
>
> -------------------------------------------------------
> 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 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

Reply via email to