I am getting the error in an Hibernate project. There is a Kisi class. Here is the class structure of my project:
Kisi entity:
@Entity
@Table(name = "KISI" )
public class Kisi implements java.io.Serializable {
/**
*
*/
private static final long serialVersionUID = 3283201458992402052L;
@Id
@Column(name = "ANAHTAR")
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "kisi_Sequence")
@SequenceGenerator(name = "kisi_Sequence", sequenceName = "KISI_SEQ" , allocationSize = 1)
private int anahtar;
@ManyToOne(fetch = FetchType.LAZY, cascade= {CascadeType.ALL})
@JoinColumn(name = "UNVANANAHTAR", nullable = true)
private Unvan unvani;
@Column(name = "ADI", columnDefinition = "VARCHAR2(700 Byte)", nullable = false)
private String adi;
@Column(name = "SOYADI", columnDefinition = "VARCHAR2(1000 Byte)", nullable = false)
private String soyadi;
@OneToOne(fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
private Kimlik kimligi;
@Column(nullable = true)
private LocalDate dogumTarihi;
@Enumerated
@Column(name="CINSIYET", columnDefinition = "smallint", nullable = true)
private Cinsiyet cinsiyeti;
@Enumerated
@Column(name="MEDENIDURUMU", columnDefinition = "smallint", nullable = true)
private MedeniDurum medeniDurumu;
@OneToOne(fetch = FetchType.LAZY)
@PrimaryKeyJoinColumn
private KisiDetay kisiDetay;
@OneToMany(fetch = FetchType.LAZY, mappedBy = "kisisi")
private Set<KisiIletisim> iletisimKumesi;
public Kisi() {
super();
String bosSozce = Sabit.BOSSOZCE;
this.anahtar = Integer.MIN_VALUE;
this.unvani = null;
this.adi = bosSozce;
this.soyadi = bosSozce;
this.kimligi = null;
this.dogumTarihi = Sabit.BOSTARIH;
this.cinsiyeti = Cinsiyet.VARSAYILAN;
this.medeniDurumu = MedeniDurum.VARSAYILAN;
this.iletisimKumesi = new HashSet<KisiIletisim>(0);
this.kisiDetay = null;
}
// Constructors, getters and setters
Enumeration values are as such:
Cinsiyet enum:
public enum Cinsiyet {
VARSAYILAN,
KADIN,
ERKEK
}
MedeniDurum enum:
public enum MedeniDurum {
VARSAYILAN,
EVLI,
BEKAR,
DUL
}
Database table structure is as below:
Database Table of Kisi entity:
When I try to insert Kisi , I am getting the error:
Error : 932, Position : 121, Sql =insert into KISIPROFIL.KISI (ADI, CINSIYET, dogumTarihi, MEDENIDURUMU, SOYADI, UNVANANAHTAR, ANAHTAR) values (:1 , :2 , :3 , :4 , :5 , :6 , :7 ),
Error Msg = ORA-00932: inconsistent data types: should be: NUMBER received: BINARY
original sql:
insert into KISIPROFIL.KISI (ADI, CINSIYET, dogumTarihi, MEDENIDURUMU, SOYADI, UNVANANAHTAR, ANAHTAR) values (?, ?, ?, ?, ?, ?, ?)
sql:
insert into KISIPROFIL.KISI (ADI, CINSIYET, dogumTarihi, MEDENIDURUMU, SOYADI, UNVANANAHTAR, ANAHTAR) values (:1 , :2 , :3 , :4 , :5 , :6 , :7 )
OracleErrorNumber: 932
stacktrace
(SQLExceptionTypeDelegate.java:63)org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42)org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:95)org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:207)org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:45)org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2886)org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3386)org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:89)
How can I overcome that problem? Thanks in advance.