-->
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: Byte not mapping to MySQL tinyint properly
PostPosted: Fri Sep 01, 2006 3:09 pm 
Regular
Regular

Joined: Wed Dec 21, 2005 6:57 pm
Posts: 70
Hibernate is attempting to set a byte property to a non-byte value. (My colleague says she sees a boolean being used in a sql trace.) Is this a Hibernate bug? It seems that Hibernate should know the type of the argument to the set method and never attempt to set using non-byte data.

The database field is tinyint, and the mapping type is byte on a MySQL database.

Hibernate version:
3.1

Mapping documents:
Code:
        <property
            name="manual"
            type="byte"
            update="true"
            insert="true"
            access="property"
            column="manual"
            length="1"
        />


Full stack trace of any exception that occurs:

Code:
   [exec] 14:30:38,469 ERROR [LogInterceptor] RuntimeException in method: public abstract java.lang
Object com.fgm.imsma.ejb.LocationinfoversionRemote.add(java.lang.Object,boolean) throws java.rmi.Re
oteException:
   [exec] org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling se
ter of com.fgm.imsma.pojo.impl.Locationinfoversion.manual
   [exec]      at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccesso
.java:104)
   [exec]      at org.hibernate.tuple.AbstractEntityTuplizer.setPropertyValues(AbstractEntityTupliz
r.java:330)
   [exec]      at org.hibernate.tuple.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:
88)
   [exec]      at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(Abstract
ntityPersister.java:3232)
   [exec]      at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(Abstract
aveEventListener.java:253)
   [exec]      at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventLi
tener.java:167)
   [exec]      at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSav
EventListener.java:114)
   [exec]      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrReque
tedId(DefaultSaveOrUpdateEventListener.java:186)
   [exec]      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(Defaul
SaveOrUpdateEventListener.java:175)
   [exec]      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(Defa
ltSaveOrUpdateEventListener.java:98)
   [exec]      at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSa
eOrUpdateEventListener.java:70)
   [exec]      at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:531)
   [exec]      at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:523)
   [exec]      at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:519)
   [exec]      at com.fgm.imsma.biz.HibernateHelper.reAttach(HibernateHelper.java:652)
 
      [ . . . removed JBoss session bean invocation stack section ....]

   [exec] Caused by: java.lang.IllegalArgumentException
   [exec]      at sun.reflect.GeneratedMethodAccessor245.invoke(Unknown Source)
   [exec]      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java
25)
   [exec]      at java.lang.reflect.Method.invoke(Method.java:585)
   [exec]      at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccesso
.java:42)
   [exec]      ... 55 more



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


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 01, 2006 3:22 pm 
Regular
Regular

Joined: Wed Dec 21, 2005 6:57 pm
Posts: 70
Additional information: the logs indicate that Hibernate is attempting to bind "false" to this byte value:

Code:
    [exec] 15:14:51,036 INFO  [STDOUT] com.fgm.imsma.ejb.LocationinfoversionBean.ejbCreate()
    [exec] 15:14:51,129 INFO  [ByteType] could not bind value 'false' to parameter: 12
    [exec] 15:14:51,129 WARN  [JDBCExceptionReporter] SQL Error: 0, SQLState: 07001
    [exec] 15:14:51,129 ERROR [JDBCExceptionReporter] No value specified for parameter 12
    [exec] 15:14:51,145 ERROR [AbstractFlushingEventListener] Could not synchronize database state w
ith session
    [exec] org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
    [exec]      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:65)
    [exec]      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
    [exec]      at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:202)
    [exec]      at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:230)
    [exec]      at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
    [exec]      at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractF
lushingEventListener.java:296)
    [exec]      at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListen
er.java:27)
    [exec]      at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1009)
    [exec]      at com.fgm.imsma.biz.HibernateHelper.add(HibernateHelper.java:67)
    [exec]      at com.fgm.imsma.biz.AbstractHelper.add(AbstractHelper.java:171)



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.