Hello Jim,

it is also possible to generate primary key value for "known" primary
key. You'll need to mark the pk field as <auto-increment/> and define
an <entity-command>.

alex

Monday, June 23, 2003, 6:02:17 AM, Jim Giudicci wrote:

JG> Me again,

JG> Fortunately, there is a way for the container to
JG> dynamically generate a key, using the <unknown-pk>
JG> element in the "jbosscmp-jdbc.xml" file.

JG> After scanning the new cmp docs for 3.2 I was having a
JG> bit of trouble figuring out where to place the
JG> element. I found the answer in the DTD, though.  It
JG> gets nested into <defaults> and <entity> elements.

JG> I found the answer to my other question, also--if you
JG> want the table to go away when you undeploy, set the
JG> <remove-table> element to "true" for that entity and
JG> leave <create-table> as "true" (its default setting). 
JG> All of this is declared in the "jbosscmp-jdbc.xml"
JG> file, which must be placed in the META-INF directory
JG> with the "ejb-jar.xml" file.

JG> So it would look like this (I think):

JG>   <entity>
JG>     <ejb-name>UserEJB</ejb-name>
JG>     <table-name>user</table-name>
JG>     <remove-table>true</remove-table>
                        
JG>     <unknown-pk>
     
JG> <unknown-pk-class>java.lang.Integer</unknown-pk-class>
JG>       <column-name>USER_ID</column-name>
JG>       <jdbc-type>INTEGER</jdbc-type>
JG>       <sql-type>INTEGER</sql-type>
JG>       <auto-increment/>
JG>     </unknown-pk>
JG>   </entity>

JG> Thanks for your help regardless, Marco :)

JG> --
JG> Jim



-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to