-
1. Re: Auto generating keys in MsSQL Server
sesques Mar 9, 2004 5:07 PM (in response to pmfa)Hi,
I think You are missing using the @jboss.unknown-pk feature for auto-incremented primary keys:
Declare the unknown-pk tag:
* @jboss.unknown-pk
* class="java.lang.Long"
* column-name=<your column name>
* field-name=< the name you want>
* sql-type=<the type of your primary key>
* auto-increment="true"
and declare
* @jboss.entity-command name = "mssql-fetch-key"
I hope this helps you. -
2. Re: Auto generating keys in MsSQL Server
sbrytskyy Feb 8, 2005 1:35 PM (in response to pmfa)Your jbosscmp-jdbc.xml file must look like:
<jbosscmp-jdbc>
java:/MsSQLDataSource
<datasource-mapping>MS SQLSERVER2000</datasource-mapping>
<entity-command name="mssql-fetch-key" />
<enterprise-beans>
<ejb-name>Customer</ejb-name>
<table-name>CUSTOMER</table-name>
<cmp-field>
<field-name>id</field-name>
<auto-increment />
</cmp-field>
<cmp-field>
<field-name>lastName</field-name>
</cmp-field>
<cmp-field>
<field-name>firstName</field-name>
</cmp-field>
<unknown-pk>
<unknown-pk-class>java.lang.Long</unknown-pk-class>
<field-name>id</field-name>
<auto-increment />
</unknown-pk>
</enterprise-beans>
</jbosscmp-jdbc>