Hi,
Hibernate version: 2.1.6
i run into a very strange problem with my application. I am trying to map the following:
Code:
public interface DataCollectorMgmt extends Remote, Serializable {
boolean ping() throws RemoteException;
String getHost() throws RemoteException;
void shutdownDataCollectorDaemon() throws RemoteException;
}
Using the following
Mapping documents:Code:
<hibernate-mapping default-cascade="none" auto-import="true" default-access="field">
<class name="com.diatem.db.datacollection.DataCollectorProcessEntry" mutable="true" polymorphism="implicit" dynamic-update="false" dynamic-insert="false">
<cache usage="read-write" />
<id name="id" type="long" unsaved-value="0">
<generator class="native">
</generator>
</id>
<property name="host" type="string"/>
<property name="startTime" type="timestamp"/>
<property name="server" type="com.diatem.services.suremon.datacollection.DataCollectorMgmt"/>
</class>
</hibernate-mapping>
The problem is I get the following exception when I try to run it on JBoss Server.
Name and version of the database you are using: IBM DB2 V8Full stack trace of any exception that occurs:Code:
2006-11-17 14:44:11,102 INFO [com.diatem.persistence.HibernateSession] Session opened
2006-11-17 14:44:11,102 DEBUG [net.sf.hibernate.impl.SessionImpl] saving [com.diatem.db.datacollection.DataCollectorProcessEntry#<null>]
2006-11-17 14:44:11,102 DEBUG [net.sf.hibernate.impl.SessionImpl] executing insertions
2006-11-17 14:44:11,118 DEBUG [net.sf.hibernate.persister.EntityPersister] Inserting entity: com.diatem.db.datacollection.DataCollectorProcessEntry (native id)
2006-11-17 14:44:11,118 DEBUG [net.sf.hibernate.impl.BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
2006-11-17 14:44:11,118 DEBUG [net.sf.hibernate.SQL] insert into DataCollectorProcessEntry (host, startTime, server, id) values (?, ?, ?, default)
2006-11-17 14:44:11,118 INFO [STDOUT] Hibernate: insert into DataCollectorProcessEntry (host, startTime, server, id) values (?, ?, ?, default)
2006-11-17 14:44:11,118 DEBUG [net.sf.hibernate.impl.BatcherImpl] preparing statement
2006-11-17 14:44:11,118 DEBUG [net.sf.hibernate.persister.EntityPersister] Dehydrating entity: [com.diatem.db.datacollection.DataCollectorProcessEntry#<null>]
2006-11-17 14:44:11,118 DEBUG [net.sf.hibernate.type.StringType] binding 'arad/192.168.32.29' to parameter: 1
2006-11-17 14:44:11,118 DEBUG [net.sf.hibernate.type.TimestampType] binding '2006-11-17 14:44:11' to parameter: 2
2006-11-17 14:44:11,118 DEBUG [net.sf.hibernate.type.SerializableType] binding '2c6d8085f3f280c5e3efedaee4e9e1f4e5edaef3e5f2f6e9e3e5f3aef3f5f2e5edefeeaee4e1f4e1e3efecece5e3f4e9efeeaec4e1f4e1c3efecece5e3f4eff2cde7edf4c9edf0ecdfd3f4f5e28080808080808082828080f8f2809aeae1f6e1aef2ede9aef3e5f2f6e5f2aed2e5edeff4e5d3f4f5e2697e5c490b61e59a828080f8f2809ceae1f6e1aef2ede9aef3e5f2f6e5f2aed2e5edeff4e5cfe2eae5e3f453e134118ce1b39e838080f8f0f7b6808ad5eee9e3e1f3f4d2e5e6808db1b9b2aeb1b6b8aeb3b2aeb2b980808bc180808080808080803d0b13238080818e77f2e4af008080f8' to parameter: 3
2006-11-17 14:44:11,134 DEBUG [net.sf.hibernate.util.JDBCExceptionReporter] SQL Exception
com.ibm.db2.jcc.b.SqlException: DB2 SQL error: SQLCODE: -301, SQLSTATE: 07006, SQLERRMC: 3
at com.ibm.db2.jcc.b.sf.d(sf.java:1396)
at com.ibm.db2.jcc.c.jb.l(jb.java:367)
at com.ibm.db2.jcc.c.jb.a(jb.java:64)
at com.ibm.db2.jcc.c.w.a(w.java:48)
at com.ibm.db2.jcc.c.dc.b(dc.java:302)
at com.ibm.db2.jcc.b.tf.cb(tf.java:1719)
at com.ibm.db2.jcc.b.tf.d(tf.java:2319)
at com.ibm.db2.jcc.b.tf.Y(tf.java:540)
at com.ibm.db2.jcc.b.tf.executeUpdate(tf.java:523)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:320)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:528)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:432)
at net.sf.hibernate.impl.ScheduledIdentityInsertion.execute(ScheduledIdentityInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:932)
at net.sf.hibernate.impl.SessionImpl.doSave(SessionImpl.java:857)
at net.sf.hibernate.impl.SessionImpl.saveWithGeneratedIdentifier(SessionImpl.java:775)
at net.sf.hibernate.impl.SessionImpl.save(SessionImpl.java:738)
at com.diatem.dao.DataCollectionDAO.registerDataCollectorDaemon(DataCollectionDAO.java:719)
at com.diatem.ejb.session.DataCollectionBean.registerDataCollectorDaemon(DataCollectionBean.java:686)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:313)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:147)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
at org.jboss.ejb.Container.invoke(Container.java:713)
at sun.reflect.GeneratedMethodAccessor150.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:72)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:45)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:70)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:187)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:480)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:367)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)
However if I run the same insert statemnt with the same bindings directlly on my database it executes without any problems and the data is inserted in the DB.
So my question is why when using Hibernate i get an SQL exception that parameter 3 ( i.e. server which is the srialized DataCollectorMgmt class ) is not of the same type as the database field.
My DB Table looks as follows:
Code:
Name DataType Size Nullable
ID BIGINT 8 No
HOST VARCHAR 255 Yes
STARTTIME TIMESTAMP 10 Yes
SERVER VARCHAR 32267 Yes
Any help will be greatelly appreciated as I am strugling with this error for some time.
Thanks
Radu