I'm trying to implement a bean with an auto-generating key using Jboss and MsSQL 
Server, i've followed what sun's documentation says, here's the ejb-jar.xml:

<?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 
2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
  | <ejb-jar>
  |   <enterprise-beans>
  |       <entity>
  |           <ejb-name>ClientEJB</ejb-name>
  |           <local-home>pt.sebasi.client.ejb.LocalClientHome</local-home>
  |           <local>pt.sebasi.client.ejb.LocalClient</local>
  |           <ejb-class>pt.sebasi.client.ejb.ClientBean</ejb-class>
  |           <persistence-type>Container</persistence-type>
  |           <prim-key-class>java.lang.Object</prim-key-class>
  |           <reentrant>False</reentrant>
  |           <cmp-version>2.x</cmp-version>
  |           <abstract-schema-name>Cliente</abstract-schema-name>
  |           <cmp-field>
  |               <description>nome do cliente</description>
  |               <field-name>nome</field-name>
  |           </cmp-field>
  |           <cmp-field>
  |               <description>abreviatura do nome do cliente</description>
  |               <field-name>abreviatura</field-name>
  |           </cmp-field>
  |       </entity>
  |   </enterprise-beans>
  |   <assembly-descriptor>
  |       <container-transaction>
  |             <description>Transaction attributes for 'ClienteEJB' 
methods</description>
  |             <method>
  |                 <ejb-name>ClientEJB</ejb-name>
  |                 <method-name>*</method-name>
  |             </method>
  |             <trans-attribute>Required</trans-attribute>
  |       </container-transaction>
  |   </assembly-descriptor>
  | </ejb-jar>

the return type for ejbCreate is an Object, and findByPrimaryKey receives an Object as 
parameter.

But i can't get this to work, Jboss creates a table column named "ClientEJB_upk" but 
is unable to store the key, this is the error i get:

anonymous wrote : javax.ejb.EJBException: Could not create 
entity:java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for 
JDBC][SQLServer]Cannot insert explicit value for identity column in table 'ClientEJB' 
when IDENTITY_INSERT is set to OFF.

could someone please help me? thanks in advance

<a 
href="http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3824939#3824939";>View 
the original post</a>

<a 
href="http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3824939>Reply 
to the post</a>


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to