Hello people, i hope someone can help me to workarround this:
I have 14 tables and 14 entities but 13 of them can be saved through session.save(entity) without any problem but one table, here is the SQL.
CREATE TABLE "LAURA2"."CONTABILIDAD_ANYO" ( "ANYO" VARCHAR2(4 CHAR) NOT NULL ENABLE, "CONTABILIDAD_ID" VARCHAR2(20 CHAR) NOT NULL ENABLE, "HEREDADA" NUMBER(22,0), "RESTANTE" NUMBER(22,0), "TOTAL" NUMBER(22,0), "GASTADO" NUMBER(22,0), CONSTRAINT "CONTABILIDAD_A_O_PK" PRIMARY KEY ("ANYO", "CONTABILIDAD_ID"), CONSTRAINT "CONTABILIDAD_A_O_CONTABIL_FK" FOREIGN KEY ("CONTABILIDAD_ID") REFERENCES "LAURA2"."CONTABILIDAD" ("ID") ENABLE )
and so the mapping:
@Entity @Table(name="CONTABILIDAD_ANYO") public class ContabilidadAnyo implements Serializable { private static final long serialVersionUID = 1L;
@EmbeddedId private ContabilidadAnyoPK id;
private BigDecimal gastado;
private BigDecimal heredada;
private BigDecimal restante;
private BigDecimal total; . . . }
@Embeddable public class ContabilidadAnyoPK implements Serializable { //default serial version id, required for serializable classes. private static final long serialVersionUID = 1L;
@Column(name="ANYO") private String anyo;
@Column(name="CONTABILIDAD_ID") private Contabilidad contabilidadBean; . . . }
I use an Oracle 10g XE Database with the 10.2.0.4 jdbc driver (I tried the 10.2.0.3 also)
The error message is ORA-01461: can bind a LONG value only for insert into a LONG column
I have tried setting the varchar2 columns with varchar2(char) (as you can see in the sql definition). Also I tried to set the same encoding as the database has: <property name="hibernate.connection.useUnicode">true</property> <property name="hibernate.connection.characterEncoding">al32utf8</property>
All those "solutions" i read at forums can't fix my problem. When i try to insert the same data at sql developer(cp1252 encoding) there is no problem.
Am i doing something wrong?
Thank you
(I forgot to paste the sql generated by hibernate: insert into CONTABILIDAD_ANYO (gastado, heredada, restante, total, ANYO, CONTABILIDAD_ID) values (?, ?, ?, ?, ?, ?) for values (null,null,null,null,'2010','4') )
Last edited by Khanser on Wed Mar 10, 2010 9:08 am, edited 1 time in total.
|