-->
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: Hibernate 3.0.5 + annotations + java 5.0 Enums problem
PostPosted: Tue Oct 18, 2005 4:03 pm 
Newbie

Joined: Mon Feb 07, 2005 7:57 pm
Posts: 9
Hibernate version: 3.0.5


Full stack trace of any exception that occurs:
org.hibernate.exception.GenericJDBCException: could not insert: [com.mgjug.model.persistence.usuario.Usuario]
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1777)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2178)
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:34)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:240)
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:160)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:95)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:96)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:468)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:463)
at com.mgjug.eai.HibernateGenericDAO.insert(HibernateGenericDAO.java:27)
at com.mgjug.services.impl.CadastroServiceImpl.cadastrar(CadastroServiceImpl.java:18)
at com.mgjug.services.test.CadastroServiceTest.testCadastrar(CadastroServiceTest.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: com.mysql.jdbc.NotImplemented: Feature not implemented
at com.mysql.jdbc.PreparedStatement.getParameterMetaData(PreparedStatement.java:951)
at org.apache.commons.dbcp.DelegatingPreparedStatement.getParameterMetaData(DelegatingPreparedStatement.java:143)
at org.hibernate.type.EnumType.nullSafeSet(EnumType.java:92)
at org.hibernate.type.CustomType.nullSafeSet(CustomType.java:151)
at org.hibernate.type.ComponentType.nullSafeSet(ComponentType.java:211)
at org.hibernate.persister.entity.BasicEntityPersister.dehydrate(BasicEntityPersister.java:1617)
at org.hibernate.persister.entity.BasicEntityPersister.dehydrate(BasicEntityPersister.java:1594)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1741)
... 30 more




Name and version of the database you are using:mysql 4.1

Hello there! I'm getting this error when using Enums as one of my properties in a persistent class. Is there anything special that should be done?

Here's my class:
@Embeddable
public class Endereco implements BaseEntity {
private static final long serialVersionUID = 6713650151456618035L;
private UFEnum UF;

public enum UFEnum {
MINAS_GERAIS("MG","Minas Gerais");
@SuppressWarnings("unused")
private final String sigla;
private final String descricao;
UFEnum(String sigla, String descricao){
this.sigla = sigla;
this.descricao = descricao;
}
@Override
public String toString() {
return descricao;
}

}

Regards

Vinicius


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 19, 2005 11:33 am 
Newbie

Joined: Mon Oct 17, 2005 3:42 pm
Posts: 17
what database are you using? I'm somewhat successfully using Enum in the EJB3 API against postgresql, so it should work, but from the looks of your stack trace hibernate is trying to get metadata using a method that your JDBC driver doesn't support.


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.