-->
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: error saving enum to oracle database
PostPosted: Thu Feb 16, 2006 6:52 am 
Newbie

Joined: Fri Feb 03, 2006 1:40 am
Posts: 11
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.


Top
 Profile  
 
 Post subject: 2c
PostPosted: Fri Feb 17, 2006 2:52 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
Have you looked at http://www.hibernate.org/265.html ?

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


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.