-
1. Re: Solution (with patch)
lido May 30, 2003 4:47 PM (in response to lido)In my case, the primary key class is known. So using an unknown-pk is not really what I wanted. I know the field I want is a Long, and I want to have an field accessor for it. So, I specified the the primkey-field to the deployment descriptor, and added removed the unknown-pk stuff.
I saw no reason why JDBCPkSqlCreateCommand should only work for Unknown Primary Keys, so I simply removed that check.
http://filebox.vt.edu/users/jlido/pub/JDBCPkSqlCreateCommand.patch
Comments?
-Jon -
2. Re: Solution (with patch)
sraj Jul 25, 2003 12:49 PM (in response to lido)Hi
Did you find any other way to achieve this without changing the JDBCPkSqlCreateCommand.
Thanks -
3. Re: Solution (with patch)
ahahamyan Sep 19, 2003 9:41 AM (in response to lido)This looks like has been fixed in JBoss 3.2.2 (RC4), all you have to is specify in jbosscmp-jdbc.xml, for the given entity
<ejb-name>User</ejb-name>
<table-name>USR</table-name>
<cmp-field>
<field-name>userId</field-name>
<column-name>USER_ID</column-name>
</cmp-field>
<entity-command name="get-generated-keys" class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCOracleCreateCommand">
SEQ_USR
</entity-command>
USER_ID is the primary key here generated from the sequence, the ejb-jar.xml specifies for the entity
<prim-key-class>java.lang.Long</prim-key-class>
<cmp-field><field-name>userId</field-name></cmp-field>
<primkey-field>userId</primkey-field>-->
among the other usual cmp fields. This works good.