2 Replies Latest reply on Jan 15, 2003 1:43 AM by Scott Van Kirk

    1:n relationship bug with SQL Server 2000

    andres Newbie

      I'm using JBoss 3.0.4. I created a 1:n relationship Client-has-Branches (Sucursales in Spanish).

      When I try to create a client's branch (sucursal), I get the following error:

      -- Calling javax.ejb.CreateException: Could not create entity:java.sql.SQLException: [Microsoft][SQLServer JDBC Driver][SQLServer]Column name 'id_cliente' appears more than once in the result column list.

      I traced Jboss statements to SQL Server 2000 and yes, Jboss is duplicating the column, please see this!

      exec sp_executesql N'INSERT INTO SucursalCliente (id_sucursal_cliente, descripcion, id_cliente, pje_recargo, pje_bonificacion, id_condicion_iva, cuit, calle, nro, id_provincia_estado, id_pais, cod_postal, localidad, telefonos, contacto, piso, depto, id_cliente) VALUES (@P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11, @P12, @P13, @P14, @P15, @P16, @P17, @P18)', N'@P1 int ,@P2 varchar(8000) ,@P3 int ,@P4 varchar(8000) ,@P5 varchar(8000) ,@P6 int ,@P7 varchar(8000) ,@P8 varchar(8000) ,@P9 int ,@P10 int ,@P11 int ,@P12 varchar(8000) ,@P13 varchar(8000) ,@P14 varchar(8000) ,@P15 varchar(8000) ,@P16 varchar(8000) ,@P17 varchar(8000) ,@P18 int ', 3, 'testCrearSucursal', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL

      The section in jbosscmp-jdbc.xml is:

      <ejb-relation>
      <ejb-relation-name>cliente-has-Sucursales</ejb-relation-name>
      <foreign-key-mapping />
      <ejb-relationship-role>
      <ejb-relationship-role-name>ClienteRelationshipRole</ejb-relationship-role-name>
      <key-fields>
      <key-field>
      <field-name>idCliente</field-name>
      <column-name>id_cliente</column-name>
      </key-field>
      </key-fields>
      </ejb-relationship-role>
      <ejb-relationship-role>
      <ejb-relationship-role-name>SucursalClienteRelationshipRole</ejb-relationship-role-name>
      <key-fields />
      </ejb-relationship-role>
      </ejb-relation>

      The section in ejb-jar.xml is:

      <ejb-relation>
      <ejb-relation-name>cliente-has-Sucursales</ejb-relation-name>
      <ejb-relationship-role>
      cliente
      <ejb-relationship-role-name>ClienteRelationshipRole</ejb-relationship-role-name>
      One
      <relationship-role-source>
      cliente
      <ejb-name>Cliente</ejb-name>
      </relationship-role-source>
      <cmr-field>
      sucursalCliente
      <cmr-field-name>sucursalesCliente</cmr-field-name>
      <cmr-field-type>java.util.Collection</cmr-field-type>
      </cmr-field>
      </ejb-relationship-role>
      <ejb-relationship-role>
      sucursalCliente
      <ejb-relationship-role-name>SucursalClienteRelationshipRole</ejb-relationship-role-name>
      Many
      <relationship-role-source>
      sucursalCliente
      <ejb-name>SucursalCliente</ejb-name>
      </relationship-role-source>
      </ejb-relationship-role>
      </ejb-relation>

      Is this a bug??? I'm wasting valuable time here... trying to solve this strange thing.

      Any ideas?