I am having problems when saving enums.
I have the following definitions:
public enum DATATYPES {
STRING,
INTEGER,
FLOAT,
DOUBLE,
CHAR,
BYTE,
}
@Entity
public class ITAttribute {
protected String id;
@Id (generate = GeneratorType.AUTO)
@Column(length=20)
public String getId() {
return this.id;
}
public void setId (String id) {
this.id = id;
}
public ITAttribute (DATATYPES dataType) {
//super(name);
this.dataType = dataType;
}
private DATATYPES dataType;
public DATATYPES getDataType() {
return this.dataType;
}
public void setDataType (DATATYPES dataType) {
this.dataType = dataType;
}
}
hibernate tool generates this database table:
[hibernatetool] create table ITAttribute (id varchar2(20 char) not null, dataType number(10,0), primary key (id));
Then when I do something like
main {
...
...
ITAttribute a1 = new ITAttribute( DATATYPES.STRING);
s.save(a1);
...
}
I get the following exception:
15:42:22,418 WARN Configurator:126 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/C:/projects/LivePortfolio/web/WEB-INF/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
opening new session
Hibernate: select hibernate_sequence.nextval from dual
Hibernate: insert into ITAttribute (dataType, id) values (?, ?)
Exception in thread "main" java.lang.AbstractMethodError: oracle.jdbc.driver.OraclePreparedStatement.getParameterMetaData()Ljava/sql/ParameterMetaData;
at org.hibernate.type.EnumType.guessTypeByParameter(EnumType.java:200)
at org.hibernate.type.EnumType.guessType(EnumType.java:147)
at org.hibernate.type.EnumType.nullSafeSet(EnumType.java:113)
at org.hibernate.type.CustomType.nullSafeSet(CustomType.java:145)
at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:1825)
at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:1802)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2058)
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2426)
at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:51)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:243)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:227)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:296)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:905)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:345)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at test.InitDB4.main(InitDB4.java:56)
Any help will be appreciated.
|