You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by "Rodrigo G. Tavares de Souza" <rs...@computeasy.com.br> on 2004/10/27 14:33:26 UTC

Store Problem

Hi,

    Sometimes I'm getting problems in the store method, but it's 
happening only on update action and with some tables that have 
reference-descriptor or collection-descriptor at  repository.xml. 
However, if I get the same object without  references it's working 
fine.  I gonna show the problem. Look.

    I get a bean from DB and changed some attributes, when call the 
broken to store it I receive an exception that says it can't insert null 
on a not null field, but when I was debuging I saw the atribute with a 
valid value before the store, I also saw the sql generated by OJB, and 
here there was a null value.
   
    Someone knows what can be happening?

tks
Rodrigo G. Tavares de Souza


    Sample of an object with problem.
-----------
<!-- Store doesn't work with this -->
<class-descriptor 
class="br.com.computeasy.tiamat.ojb.valueobject.changeordervo.ChangeOrderVO" 
table="corderchangeorder">
    <field-descriptor id="0" name="idchangeorder" column="idchangeorder" 
jdbc-type="BIGINT" primarykey="true" autoincrement="true" 
sequence-name="sq_corderchangeorder"/>
    <field-descriptor id="1" name="idempresa" column="idempresa" 
jdbc-type="BIGINT" primarykey="true"/>
    <field-descriptor id="2" name="idgrupoatendimento" 
column="idgrupoatendimento" jdbc-type="BIGINT"/>
    <field-descriptor id="3" name="idgrupostatus" column="idgrupostatus" 
jdbc-type="BIGINT"/>
    <field-descriptor id="4" name="idstatus" column="idstatus" 
jdbc-type="BIGINT"/>
    <field-descriptor id="5" name="idusuario" column="idusuario" 
jdbc-type="BIGINT"/>
    <field-descriptor id="6" name="descricao" column="descricao" 
jdbc-type="VARCHAR"/>
    <field-descriptor id="7" name="dtcadastro" column="dtcadastro" 
conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion" 
jdbc-type="TIMESTAMP"/>
    <field-descriptor id="8" name="dtlimite" column="dtlimite" 
conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion" 
jdbc-type="TIMESTAMP"/>
    <field-descriptor id="9" name="dttermino" column="dttermino" 
conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion" 
jdbc-type="TIMESTAMP"/>
    <field-descriptor id="10" name="ativo_sn" column="ativo_sn" 
jdbc-type="VARCHAR"/>
    <field-descriptor id="11" name="andamento" column="andamento" 
jdbc-type="VARCHAR"/>

    <reference-descriptor name="usuarioVO"
                          
class-ref="br.com.computeasy.tiamat.ojb.valueobject.helpdeskvo.UsuarioVO"
                          auto-retrieve="true">
        <foreignkey field-ref="idusuario"/>
        <foreignkey field-ref="idempresa"/>
    </reference-descriptor>

    <reference-descriptor name="hdeskStatusVO"
                          
class-ref="br.com.computeasy.tiamat.ojb.valueobject.helpdeskvo.HdeskStatusVO"
                          auto-retrieve="true">
        <foreignkey field-ref="idstatus"/>
        <foreignkey field-ref="idempresa"/>
        <foreignkey field-ref="idgrupoatendimento"/>
        <foreignkey field-ref="idgrupostatus"/>
    </reference-descriptor>
</class-descriptor>

<!-- With this copy without references it works fine -->
<class-descriptor 
class="br.com.computeasy.tiamat.ojb.valueobject.changeordervo.ChangeOrder" 
table="corderchangeorder">
    <field-descriptor id="0" name="idchangeorder" column="idchangeorder" 
jdbc-type="BIGINT" primarykey="true" autoincrement="true" 
sequence-name="sq_corderchangeorder"/>
    <field-descriptor id="1" name="idempresa" column="idempresa" 
jdbc-type="BIGINT" primarykey="true"/>
    <field-descriptor id="2" name="idgrupoatendimento" 
column="idgrupoatendimento" jdbc-type="BIGINT"/>
    <field-descriptor id="3" name="idgrupostatus" column="idgrupostatus" 
jdbc-type="BIGINT"/>
    <field-descriptor id="4" name="idstatus" column="idstatus" 
jdbc-type="BIGINT"/>
    <field-descriptor id="5" name="idusuario" column="idusuario" 
jdbc-type="BIGINT"/>
    <field-descriptor id="6" name="descricao" column="descricao" 
jdbc-type="VARCHAR"/>
    <field-descriptor id="7" name="dtcadastro" column="dtcadastro" 
conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion" 
jdbc-type="TIMESTAMP"/>
    <field-descriptor id="8" name="dtlimite" column="dtlimite" 
conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion" 
jdbc-type="TIMESTAMP"/>
    <field-descriptor id="9" name="dttermino" column="dttermino" 
conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion" 
jdbc-type="TIMESTAMP"/>
    <field-descriptor id="10" name="ativo_sn" column="ativo_sn" 
jdbc-type="VARCHAR"/>
    <field-descriptor id="11" name="andamento" column="andamento" 
jdbc-type="VARCHAR"/>
</class-descriptor>
-----------

Re: Store Problem

Posted by Leandro Rodrigo Saad Cruz <le...@ibnetwork.com.br>.
Could send the StackTrace ?! Which field is it ?!
Please send the SQL that was generated by OJB !

On Wed, 2004-10-27 at 09:33 -0300, Rodrigo G. Tavares de Souza wrote:
> Hi,
> 
>     Sometimes I'm getting problems in the store method, but it's 
> happening only on update action and with some tables that have 
> reference-descriptor or collection-descriptor at  repository.xml. 
> However, if I get the same object without  references it's working 
> fine.  I gonna show the problem. Look.
> 
>     I get a bean from DB and changed some attributes, when call the 
> broken to store it I receive an exception that says it can't insert null 
> on a not null field, but when I was debuging I saw the atribute with a 
> valid value before the store, I also saw the sql generated by OJB, and 
> here there was a null value.
>    
>     Someone knows what can be happening?
> 
> tks
> Rodrigo G. Tavares de Souza
> 
> 
>     Sample of an object with problem.
> -----------
> <!-- Store doesn't work with this -->
> <class-descriptor 
> class="br.com.computeasy.tiamat.ojb.valueobject.changeordervo.ChangeOrderVO" 
> table="corderchangeorder">
>     <field-descriptor id="0" name="idchangeorder" column="idchangeorder" 
> jdbc-type="BIGINT" primarykey="true" autoincrement="true" 
> sequence-name="sq_corderchangeorder"/>
>     <field-descriptor id="1" name="idempresa" column="idempresa" 
> jdbc-type="BIGINT" primarykey="true"/>
>     <field-descriptor id="2" name="idgrupoatendimento" 
> column="idgrupoatendimento" jdbc-type="BIGINT"/>
>     <field-descriptor id="3" name="idgrupostatus" column="idgrupostatus" 
> jdbc-type="BIGINT"/>
>     <field-descriptor id="4" name="idstatus" column="idstatus" 
> jdbc-type="BIGINT"/>
>     <field-descriptor id="5" name="idusuario" column="idusuario" 
> jdbc-type="BIGINT"/>
>     <field-descriptor id="6" name="descricao" column="descricao" 
> jdbc-type="VARCHAR"/>
>     <field-descriptor id="7" name="dtcadastro" column="dtcadastro" 
> conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion" 
> jdbc-type="TIMESTAMP"/>
>     <field-descriptor id="8" name="dtlimite" column="dtlimite" 
> conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion" 
> jdbc-type="TIMESTAMP"/>
>     <field-descriptor id="9" name="dttermino" column="dttermino" 
> conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion" 
> jdbc-type="TIMESTAMP"/>
>     <field-descriptor id="10" name="ativo_sn" column="ativo_sn" 
> jdbc-type="VARCHAR"/>
>     <field-descriptor id="11" name="andamento" column="andamento" 
> jdbc-type="VARCHAR"/>
> 
>     <reference-descriptor name="usuarioVO"
>                           
> class-ref="br.com.computeasy.tiamat.ojb.valueobject.helpdeskvo.UsuarioVO"
>                           auto-retrieve="true">
>         <foreignkey field-ref="idusuario"/>
>         <foreignkey field-ref="idempresa"/>
>     </reference-descriptor>
> 
>     <reference-descriptor name="hdeskStatusVO"
>                           
> class-ref="br.com.computeasy.tiamat.ojb.valueobject.helpdeskvo.HdeskStatusVO"
>                           auto-retrieve="true">
>         <foreignkey field-ref="idstatus"/>
>         <foreignkey field-ref="idempresa"/>
>         <foreignkey field-ref="idgrupoatendimento"/>
>         <foreignkey field-ref="idgrupostatus"/>
>     </reference-descriptor>
> </class-descriptor>
> 
> <!-- With this copy without references it works fine -->
> <class-descriptor 
> class="br.com.computeasy.tiamat.ojb.valueobject.changeordervo.ChangeOrder" 
> table="corderchangeorder">
>     <field-descriptor id="0" name="idchangeorder" column="idchangeorder" 
> jdbc-type="BIGINT" primarykey="true" autoincrement="true" 
> sequence-name="sq_corderchangeorder"/>
>     <field-descriptor id="1" name="idempresa" column="idempresa" 
> jdbc-type="BIGINT" primarykey="true"/>
>     <field-descriptor id="2" name="idgrupoatendimento" 
> column="idgrupoatendimento" jdbc-type="BIGINT"/>
>     <field-descriptor id="3" name="idgrupostatus" column="idgrupostatus" 
> jdbc-type="BIGINT"/>
>     <field-descriptor id="4" name="idstatus" column="idstatus" 
> jdbc-type="BIGINT"/>
>     <field-descriptor id="5" name="idusuario" column="idusuario" 
> jdbc-type="BIGINT"/>
>     <field-descriptor id="6" name="descricao" column="descricao" 
> jdbc-type="VARCHAR"/>
>     <field-descriptor id="7" name="dtcadastro" column="dtcadastro" 
> conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion" 
> jdbc-type="TIMESTAMP"/>
>     <field-descriptor id="8" name="dtlimite" column="dtlimite" 
> conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion" 
> jdbc-type="TIMESTAMP"/>
>     <field-descriptor id="9" name="dttermino" column="dttermino" 
> conversion="org.apache.ojb.broker.accesslayer.conversions.JavaDate2SqlTimestampFieldConversion" 
> jdbc-type="TIMESTAMP"/>
>     <field-descriptor id="10" name="ativo_sn" column="ativo_sn" 
> jdbc-type="VARCHAR"/>
>     <field-descriptor id="11" name="andamento" column="andamento" 
> jdbc-type="VARCHAR"/>
> </class-descriptor>
> -----------


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org