-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: update d'une propriété nulle ....
PostPosted: Wed Jun 29, 2005 6:03 am 
Newbie

Joined: Wed Jun 29, 2005 5:40 am
Posts: 7
Bonjour tout le monde,
J'utilise spring + hibernate dans un projet et je n'arrive pas à mettre à jour un objet, plus partiulièrement la propriété d'un objet.
L'idée est que si la propriété est renseignée, je la positionne à la valeur renseignée, sinon je la positionne à null. Dans le 2ème cas j'ai une erreur de la part d'oracle, ca entraine une erreur hibernate puis spring, ainsi de suite ..

mes logs :
Code:

11:01:45,735 [WebContainer : 0] ERROR <mon_pakage>  - org.springframework.dao.DataIntegrityViolationException: (Hibernate operation): data integrity violated by SQL ''; nested exception is java.sql.BatchUpdateException: ORA-01401: inserted value too large for column

11:01:45,735 [WebContainer : 0] ERROR <mon_pakage>  - updateObject() : null



le code qui génère cette erreur :
Code:
if (!form.isBlankString(form.getDateIdentification())) {
      c.setIdentification(sdf.parse(form.getDateIdentification()));
} else {
      c.setIdentification(null);
}
......
this.clientRisqueDao.updateObject(c);


l'objet java :
Code:

import java.util.Date;

/**
*   @hibernate.class
*      table="PSAC_TP_CLIENT_RISQUE" prefix="CRIS"
*     
*/
public class ClientRisque {

    /** identifier field */
    private Long id;

    /** nullable persistent field */
    private Date identification;

    /** default constructor */
    public ClientRisque() {
    }
   
    /**
     *   @hibernate.id
     *      generator-class="sequence"
     *      type="java.lang.Long"
     *      column="CRIS_NUM_ID"
     *   @hibernate.generator-param
     *      name="sequence"
     *      value="PSAC_CPT_CLIENT_RISQUE"
     */
    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    /**
     *   @hibernate.property
     *      column="CRIS_DAT_IDENTIF"
     *      length="7"
     *      not-null="false"
     */
    public Date getIdentification() {
        return this.identification;
    }

    public void setIdentification(Date identification) {
        this.identification = identification;
    }
}


mon fichier .hbm.xml :
Code:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping
>
    <class
        name="ClientRisque"
        table="PSAC_TP_CLIENT_RISQUE"
    >

        <id
            name="id"
            column="CRIS_NUM_ID"
            type="java.lang.Long"
        >
            <generator class="sequence">
                <param name="sequence">PSAC_CPT_CLIENT_RISQUE</param>
            </generator>
        </id>

        <property
            name="identification"
            type="java.util.Date"
            update="true"
            insert="true"
            column="CRIS_DAT_IDENTIF"
            length="7"
       not-null="false"
        />

    </class>

</hibernate-mapping>


Merci d'avance


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 29, 2005 9:55 am 
Newbie

Joined: Wed Jun 29, 2005 5:40 am
Posts: 7
Problem solved.
Nothing to do with updating null values.
Sorry about bothering everybody.
Consider this topic as null.

Best Regards, littleloulou


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.