Hello Felipe,

Something like the following
in jbosscmp-jdbc.xml
      <entity>
         <ejb-name>MyBean</ejb-name>
         <cmp-field>
            <field-name>id</field-name>
            <auto-increment/>
        </cmp-field>

        ...
        
      <!-- retrieves generated key of the record inserted into SQLServer db -->
      <entity-command name="mssql-fetch-key"
                      
class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCSQLServerCreateCommand">
         <!-- uncomment for versions prior to SQL Server 2000
         <attribute name="pk-sql">SELECT @@IDENTITY</attribute>
         -->
      </entity-command>
      </entity>

Note, you might need to upgrade to 3.2.1.

alex

Thursday, June 05, 2003, 8:07:09 PM, Felipe Oliveira wrote:

FO> hi all,

FO> i am writing a CMP entity bean that uses a mssql table with a identity 
FO> (auto-increment) primary key. how do i tell jboss not to use the primary 
FO> key field on inserts? is it possible?

FO> i tried to set the field as read-only but it didn't work. jboss didn't 
FO> let me have a pk field as read-only. any ideas?

FO> i am running jboss-3.2.0, jvm1.4 on redhat 9.

FO> thanks in advance,

FO> felipe



-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to