i am using hybernate 3 with jboss 4.1
and i have the hbm file user.hbm.xml
<?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 package="com.sst.interco.bean">
<class name="UserBean" table="user">
<synchronize table="contactaddress"/>
<id name="userOID" type="long" column="UserOID">
<generator class="increment"/>
</id>
<property name="userID" not-null="true" column="UserID" length="150" type="java.lang.String"/>
<property name="firstName" not-null="false" column="FirstName" length="150" type="java.lang.String"/>
<property name="lastName" not-null="false" column="LastName" length="150" type="java.lang.String"/>
<property name="designation" not-null="false" column="Designation" length="150" type="java.lang.String"/>
<property name="empID" not-null="false" column="EmpID" length="150" type="java.lang.String"/>
<property name="emailID" not-null="false" column="EmailId" length="150" type="java.lang.String"/>
<property name="passWord" not-null="false" column="PassWord" length="150" type="java.lang.String"/>
<property name="DOB" not-null="false" column="DOB" length="150"/>
<property name="secretQuestion" not-null="false" column="SecretQuestion" length="150" type="java.lang.String"/>
<property name="secretAnswer" not-null="false" column="SecretAnswer" length="150" type="java.lang.String"/>
<property name="isActive" not-null="false" column="IsActive" length="150"/>
<property name="pswChangeDate" not-null="false" column="PswChangeDate" length="150"/>
<property name="lastLoginDate" not-null="false" column="LastLoginDate" length="150"/>
<property name="creationDate" not-null="false" column="CreationDate" length="150"/>
<property name="lastUser" not-null="false" column="LastUser" length="150" type="java.lang.String"/>
<property name="lastUpdate" not-null="false" column="LastUpdate" length="150"/>
<property name="notes" not-null="false" column="Notes" length="150" type="java.lang.String"/>
<property name="roleID" not-null="false" column="RoleID" length="150" type="java.lang.String"/>
<property name="acceibleEntity" not-null="false" column="AcceibleEntity" length="150" type="java.lang.String"/>
<set name="addressBean" table="contactaddress" cascade="all">
<key column="ReferenceOID"/>
<one-to-many class="AddressBean"/>
</set>
<set name="userRightBean" table="userright" cascade="all">
<key column="ReferenceOID"/>
<one-to-many class="UserRightBean"/>
</set>
</class>
<sql-query name="userhelpqry">
<return class="UserBean"/>
select * from user
</sql-query>
</hibernate-mapping>
when i try to retireve data from coding
UserBean obj = (UserBean) pri.get(UserBean.class, Long(1));
and when i try to get address of user
Set<AddressBean> set = view.getAddressBean();
Set<AddressDTO> addressList = new HashSet<AddressDTO> ();
if (set != null) {
for (AddressBean bea : set) {
AddressDTO aDTO = new AddressDTO();
AddressBean.convertBeanToDTO(aDTO, bea);
addressList.add(aDTO);
}
}
as this
jboss throws error
as
org.hibernate.exception.GenericJDBCException: could not initialize a collection: [com.sst.interco.bean.UserBean.addressBean#2]
at com.sst.interco.bo.UserBO.retrieveUserDetails(UserBO.java:431)
at com.sst.interco.action.UserAction.retriveUserDetails(UserAction.java:115)
at com.sst.interco.action.UserAction.doAction(UserAction.java:32)
at com.sst.acf.ejb.DSActionWrapper.doAction(DSActionWrapper.java:33)
at com.sst.acf.ActionManager.doAction(ActionManager.java:58)
at com.sst.interco.util.HybernateActionWrapper.doAction(HybernateActionWrapper.java:34)
at com.sst.acf.ActionManager.doAction(ActionManager.java:60)
at com.sst.acf.RequestProcessor.processRequest(RequestProcessor.java:41)
at com.sst.acf.ejb.EJBDispatcherBean.dispatch(EJBDispatcherBean.java:43)
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:585)
at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:113)
at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:51)
at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:313)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:146)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:122)
at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
at org.jboss.ejb.Container.invoke(Container.java:870)
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:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
at org.jboss.invocation.http.server.HttpInvoker.invoke(HttpInvoker.java:139)
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:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
at org.jboss.invocation.http.servlet.InvokerServlet.processRequest(InvokerServlet.java:147)
at org.jboss.invocation.http.servlet.InvokerServlet.doPost(InvokerServlet.java:209)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:150)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:54)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.hibernate.exception.GenericJDBCException: could not initialize a collection: [com.sst.interco.bean.UserBean.addressBean#2]
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1926)
at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:71)
at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:520)
at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1627)
at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
at org.hibernate.collection.PersistentSet.iterator(PersistentSet.java:138)
at com.sst.interco.bo.UserBO.setDTO(UserBO.java:112)
at com.sst.interco.bo.UserBO.retrieveUserDetails(UserBO.java:425)
... 84 more
why it is so as i use java 1.5
any solution ........................
|