hi,
I have just migrated my Hibernate code from 3.1.3 to 3.3.1 (one that comes default with Jboss 5.1.0 GA).
I have a simple class, Mapping and execution code, this code works fine with earlier version but in latter, it throws exception.
I have changed dialect from Oracle9Dialect to Oracle9iDialect (still getting same exception).
In this particular application.functionality I am connecting to 2 different db, for this I have made changes in jbossts-properties.xml file. So not getting any session/transaction related exception, anymore.
I am struggling with this error for last 2-3 days, I have tried changing datatype of class attribute from primitive to Object, but not luck thr.
Bean Class (class has getter/setter as well. I have changes data type from int to Integer, but in both cases same exception). _________
public class IDWSetupAuditLog implements Serializable { private Integer auditId = 0; private Integer tableId = 0; private String changeReqId; private String changeReqName; private Integer changeImplId = 0; private String changeImplName; private String changeDetail; private String changeType; private String changeReasonDesc; private Date lastUpdateDt; }
Mapping __________ <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.geam.dese.hibernate.dto.IDWSetupAuditLog" table="DESE.IDW_SETUP_AUDIT_LOG" > <id name="auditId" type="integer" column="AUDIT_ID"> <generator class="sequence"><param name="sequence">DESE.IDW_SETUP_AUDIT_LOG_SEQ</param></generator> </id> <property name="tableId" column="TABLE_ID" type="integer"/> <property name="changeReqId" column="CHANGE_REQUESTER_ID" type="string"/> <property name="changeReqName" column="CHANGE_REQUESTER_NM" type="string"/> <property name="changeImplId" column="CHANGE_IMPLEMENTER_ID" type="integer"/> <property name="changeImplName" column="CHANGE_IMPLEMENTER_NM" type="string"/> <property name="changeDetail" column="CHANGE_DETAIL_TXT" type="string"/> <property name="changeType" column="CHANGE_TYPE" type="string"/> <property name="changeReasonDesc" column="CHANGE_REASON_DESC" type="string"/> <property name="lastUpdateDt" column="LAST_UPDATE_DTM" type="timestamp"/> </class> </hibernate-mapping>
Exception is coming in following code --------------------------------------
public void insertAuditData(IDWSetupAuditLog auditLog, Session session) throws Exception { this.log.debug("Begin of EventDAO : insertAuditData()"); try { session.save(auditLog);/////------------->This line throws following exception session.flush(); session.clear();
Following few 9 lines r coming because I have added SOP in setter method 2011-04-04 15:48:58,284 INFO [STDOUT] (http-0.0.0.0-8280-2) setTableId->1 2011-04-04 15:48:58,284 INFO [STDOUT] (http-0.0.0.0-8280-2) setChangeDetail 2011-04-04 15:48:58,284 INFO [STDOUT] (http-0.0.0.0-8280-2) setChangeImplId=>200011691 2011-04-04 15:48:58,284 INFO [STDOUT] (http-0.0.0.0-8280-2) setChangeImplName 2011-04-04 15:48:58,284 INFO [STDOUT] (http-0.0.0.0-8280-2) setChangeReqId 2011-04-04 15:48:58,284 INFO [STDOUT] (http-0.0.0.0-8280-2) setChangeReqName 2011-04-04 15:48:58,284 INFO [STDOUT] (http-0.0.0.0-8280-2) setChangeReasonDesc 2011-04-04 15:48:58,285 INFO [STDOUT] (http-0.0.0.0-8280-2) setChangeType 2011-04-04 15:48:58,285 INFO [STDOUT] (http-0.0.0.0-8280-2) setLastUpdateDt 2011-04-04 15:48:58,285 DEBUG [com.geam.dese.hibernate.utils.HibernateSessionFactory] (http-0.0.0.0-8280-2) Begin of HibernateSessionFactory : getCurrentSession() 2011-04-04 15:48:58,285 DEBUG [com.geam.dese.hibernate.dao.EventDAO] (http-0.0.0.0-8280-2) Begin of EventDAO : insertAuditData() 2011-04-04 15:48:58,289 WARN [com.arjuna.ats.jta.logging.loggerI18N] (http-0.0.0.0-8280-2) [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.multipleWarning] [com.arjuna.ats.internal.jta.transaction.arjunacore.lastResource.multipleWarning] Multiple last resources have been added to the current transaction. This is transactionally unsafe and should not be relied upon. Current resource is org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@6dce3f7e Following line is coming, it means value is getting generated for sequence (current value of this sequence in db is 11500 (so well in the rage of int variable 2011-04-04 15:48:58,289 INFO [STDOUT] (http-0.0.0.0-8280-2) Hibernate: select DESE.IDW_SETUP_AUDIT_LOG_SEQ.nextval from dual 2011-04-04 15:48:58,295 DEBUG [com.geam.dese.hibernate.dao.EventDAO] (http-0.0.0.0-8280-2) Exception in EventDAO::insertAuditData ==> java.lang.ClassCastException: com.geam.dese.hibernate.dto.IDWSetupAuditLog cannot be cast to java.util.Map 2011-04-04 15:48:58,295 DEBUG [com.geam.dese.hibernate.businessobject.EventBO] (http-0.0.0.0-8280-2) Exception in EventBO::insertData ==> java.lang.ClassCastException: com.geam.dese.hibernate.dto.IDWSetupAuditLog cannot be cast to java.util.Map 2011-04-04 15:48:58,296 DEBUG [com.geam.dese.hibernate.ejb.SessionFacadeBean] (http-0.0.0.0-8280-2) Exception in SessionFacadeBean::insertData ==> java.lang.ClassCastException: com.geam.dese.hibernate.dto.IDWSetupAuditLog cannot be cast to java.util.Map 2011-04-04 15:48:58,297 ERROR [org.jboss.ejb.plugins.LogInterceptor] (http-0.0.0.0-8280-2) TransactionRolledbackLocalException in method: public abstract boolean com.geam.dese.hibernate.ejb.Business.insertData(java.util.List,java.lang.String,int,java.lang.String,java.lang.String,java.lang.String,java.lang.String) throws java.lang.Exception, causedBy: java.lang.ClassCastException: com.geam.dese.hibernate.dto.IDWSetupAuditLog cannot be cast to java.util.Map at org.hibernate.property.MapAccessor$MapSetter.set(MapAccessor.java:68) at org.hibernate.tuple.entity.AbstractEntityTuplizer.setIdentifier(AbstractEntityTuplizer.java:234) at org.hibernate.persister.entity.AbstractEntityPersister.setIdentifier(AbstractEntityPersister.java:3624) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:194) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:144) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210) at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:56) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195) at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:50) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93) at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:562) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:550) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:546) at com.geam.dese.hibernate.dao.EventDAO.insertAuditData(EventDAO.java:193) at com.geam.dese.hibernate.businessobject.EventBO.insertData(EventBO.java:124) at com.geam.dese.hibernate.ejb.SessionFacadeBean.insertData(SessionFacadeBean.java:174) 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:597) at org.jboss.invocation.Invocation.performCall(Invocation.java:386)
|