0 Replies Latest reply on Aug 30, 2007 10:08 AM by Francesco Benvegna

    Update corrupt database

    Francesco Benvegna Newbie

      I update a EJB Entity and after insert call the record is corrupted...
      A value is inserted as 沿47.163.0.61.
      The first character is corrupted.
      My solution is a persist (with flush) of partial record (with many object attributes insertable=false) and a merge.
      I think that problem is many attributes of type java.util.Date. Attributes of type Date are updated but but not inserted.

      @Table(name = "TB_LOG")
      public class Log implements Serializable {
       private static final long serialVersionUID = 1L;
       @Column(name = "OID", updatable = false)
       @SequenceGenerator(name = "SEQUENCE", sequenceName = "SEQ_TB_LOG_WSR", allocationSize = 1)
       @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQUENCE")
       private long oid;
       @Column(name = "CLI", nullable = false, updatable = false)
       private String clientAddress;
       @Column(name = "SOA_REQ", nullable = true, insertable=false)
       private String request;
       @Column(name = "SOA_RES", nullable = true, insertable=false)
       private String response;
       @Column(name = "DAT", nullable = true, insertable = false)
       private Date date;

      This is the only corrected method to store object Log (others cause curruption)

       Log log = new Log();
       log.setClientAddress(new String(address.toString())); // non so perchè ma necessita ricreare la stringa
       // altrimenti sulla INSERT del db accade un casino
       // !!! BOOOOO
       log.setDate(date); // non so perchè ma non cambiare l'ordine della persist e della merge, altrimenti i dati
       // su db saranno corrotti!!! BOOO

      My configuration is:
      - JBoss 4.0.5
      - Seam 1.2.1.GA
      - Hibernate core updated to 3.2.5
      - Oracle Database 8.1.7