java - Hibernate SerializationException -


in database, have 3 tables: hotels, facilities , images. hotels table has "one many relationship" both tables: facilities , images. facilities , images table, both have hotels column foreign key.

while fetching details of hotel, want retrieve facilities , images hotel. receive org.hibernate.type.serializationexception

exception stacktrace:

severe: servlet.service() servlet [dispatcher] in context path threw exception [request processing failed; nested exception org.hibernate.type.serializationexception: not deserialize] root cause java.io.streamcorruptedexception: invalid stream header: 32303136     @ java.io.objectinputstream.readstreamheader(objectinputstream.java:804)     @ java.io.objectinputstream.<init>(objectinputstream.java:299)     @ org.hibernate.internal.util.serializationhelper$customobjectinputstream.<init>(serializationhelper.java:328)     @ org.hibernate.internal.util.serializationhelper$customobjectinputstream.<init>(serializationhelper.java:318)     @ org.hibernate.internal.util.serializationhelper.dodeserialize(serializationhelper.java:237)     @ org.hibernate.internal.util.serializationhelper.deserialize(serializationhelper.java:306)     @ org.hibernate.type.descriptor.java.serializabletypedescriptor.frombytes(serializabletypedescriptor.java:155)     @ org.hibernate.type.descriptor.java.serializabletypedescriptor.wrap(serializabletypedescriptor.java:130)     @ org.hibernate.type.descriptor.java.serializabletypedescriptor.wrap(serializabletypedescriptor.java:44)     @ org.hibernate.type.descriptor.sql.varbinarytypedescriptor$2.doextract(varbinarytypedescriptor.java:71)     @ org.hibernate.type.descriptor.sql.basicextractor.extract(basicextractor.java:64)     @ org.hibernate.type.abstractstandardbasictype.nullsafeget(abstractstandardbasictype.java:267)     @ org.hibernate.type.abstractstandardbasictype.nullsafeget(abstractstandardbasictype.java:263)     @ org.hibernate.type.abstractstandardbasictype.nullsafeget(abstractstandardbasictype.java:253)     @ org.hibernate.type.abstractstandardbasictype.hydrate(abstractstandardbasictype.java:338)     @ org.hibernate.persister.entity.abstractentitypersister.hydrate(abstractentitypersister.java:2969)     @ org.hibernate.loader.plan.exec.process.internal.entityreferenceinitializerimpl.loadfromresultset(entityreferenceinitializerimpl.java:324)     @ org.hibernate.loader.plan.exec.process.internal.entityreferenceinitializerimpl.hydrateentitystate(entityreferenceinitializerimpl.java:251)     @ org.hibernate.loader.plan.exec.process.internal.abstractrowreader.readrow(abstractrowreader.java:107)     @ org.hibernate.loader.plan.exec.process.internal.resultsetprocessorimpl.extractresults(resultsetprocessorimpl.java:129)     @ org.hibernate.loader.plan.exec.internal.abstractloadplanbasedloader.executeload(abstractloadplanbasedloader.java:138)     @ org.hibernate.loader.plan.exec.internal.abstractloadplanbasedloader.executeload(abstractloadplanbasedloader.java:102)     @ org.hibernate.loader.collection.plan.abstractloadplanbasedcollectioninitializer.initialize(abstractloadplanbasedcollectioninitializer.java:100)     @ org.hibernate.persister.collection.abstractcollectionpersister.initialize(abstractcollectionpersister.java:693)     @ org.hibernate.event.internal.defaultinitializecollectioneventlistener.oninitializecollection(defaultinitializecollectioneventlistener.java:92)     @ org.hibernate.internal.sessionimpl.initializecollection(sessionimpl.java:1897)     @ org.hibernate.collection.internal.abstractpersistentcollection.forceinitialization(abstractpersistentcollection.java:683)     @ org.hibernate.engine.internal.statefulpersistencecontext.initializenonlazycollections(statefulpersistencecontext.java:890)     @ org.hibernate.loader.loader.doqueryandinitializenonlazycollections(loader.java:359)     @ org.hibernate.loader.loader.dolist(loader.java:2553)     @ org.hibernate.loader.loader.dolist(loader.java:2539)     @ org.hibernate.loader.loader.listignorequerycache(loader.java:2369)     @ org.hibernate.loader.loader.list(loader.java:2364)     @ org.hibernate.loader.hql.queryloader.list(queryloader.java:496)     @ org.hibernate.hql.internal.ast.querytranslatorimpl.list(querytranslatorimpl.java:387)     @ org.hibernate.engine.query.spi.hqlqueryplan.performlist(hqlqueryplan.java:231)     @ org.hibernate.internal.sessionimpl.list(sessionimpl.java:1264)     @ org.hibernate.internal.queryimpl.list(queryimpl.java:103)     @ com.holidify.app.dao.impl.hotelsdaoimpl.getmergedresponse(hotelsdaoimpl.java:81)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:606)     @ org.springframework.aop.support.aoputils.invokejoinpointusingreflection(aoputils.java:317)     @ org.springframework.aop.framework.reflectivemethodinvocation.invokejoinpoint(reflectivemethodinvocation.java:190)     @ org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:157)     @ org.springframework.transaction.interceptor.transactioninterceptor$1.proceedwithinvocation(transactioninterceptor.java:98)     @ org.springframework.transaction.interceptor.transactionaspectsupport.invokewithintransaction(transactionaspectsupport.java:262)     @ org.springframework.transaction.interceptor.transactioninterceptor.invoke(transactioninterceptor.java:95)     @ org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:179)     @ org.springframework.aop.framework.jdkdynamicaopproxy.invoke(jdkdynamicaopproxy.java:207)     @ com.sun.proxy.$proxy53.getmergedresponse(unknown source)     @ com.holidify.app.service.impl.hotelsserviceimpl.gethotelsmergedresponse(hotelsserviceimpl.java:104)     @ com.holidify.app.controller.hotelscontroller.searchdynamichotels(hotelscontroller.java:192)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:606)     @ org.springframework.web.method.support.invocablehandlermethod.invoke(invocablehandlermethod.java:215)     @ org.springframework.web.method.support.invocablehandlermethod.invokeforrequest(invocablehandlermethod.java:132)     @ org.springframework.web.servlet.mvc.method.annotation.servletinvocablehandlermethod.invokeandhandle(servletinvocablehandlermethod.java:104)     @ org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter.invokehandlemethod(requestmappinghandleradapter.java:749)     @ org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter.handleinternal(requestmappinghandleradapter.java:689)     @ org.springframework.web.servlet.mvc.method.abstracthandlermethodadapter.handle(abstracthandlermethodadapter.java:83)     @ org.springframework.web.servlet.dispatcherservlet.dodispatch(dispatcherservlet.java:938)     @ org.springframework.web.servlet.dispatcherservlet.doservice(dispatcherservlet.java:870)     @ org.springframework.web.servlet.frameworkservlet.processrequest(frameworkservlet.java:961)     @ org.springframework.web.servlet.frameworkservlet.dopost(frameworkservlet.java:863)     @ javax.servlet.http.httpservlet.service(httpservlet.java:650)     @ org.springframework.web.servlet.frameworkservlet.service(frameworkservlet.java:837)     @ javax.servlet.http.httpservlet.service(httpservlet.java:731)     @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:303)     @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:208)     @ org.apache.tomcat.websocket.server.wsfilter.dofilter(wsfilter.java:52)     @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:241)     @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:208)     @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:220)     @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:122)     @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:505)     @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:169)     @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:103)     @ org.apache.catalina.valves.accesslogvalve.invoke(accesslogvalve.java:956)     @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:116)     @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:423)     @ org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1079)     @ org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:625)     @ org.apache.tomcat.util.net.jioendpoint$socketprocessor.run(jioendpoint.java:316)     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145)     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615)     @ org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61)     @ java.lang.thread.run(thread.java:745) 

hotels.java

@entity @table(name="hotels") public class hotels implements serializable{      private static final long serialversionuid = -5573648649418161369l;     private set<facilities> facilities;     private set<images> images;     private int hotelid;      //other fields     //other getter , setters      @onetomany(fetch = fetchtype.eager, cascade = cascadetype.all, mappedby = "hotels")     public set<images> getimages() {         return images;     }     public void setimages(set<images> images) {         this.images = images;     }       @onetomany(fetch = fetchtype.eager, cascade = cascadetype.all, mappedby = "hotels")     public set<facilities> getfacilities() {         return facilities;     }     public void setfacilities(set<facilities> facilities) {         this.facilities = facilities;     }    } 

facilities.java

@entity @table(name="facilities") public class facilities implements serializable{      private static final long serialversionuid = -552767579935736531l;     private integer facilityid;     private string facilityname;     private timestamp timestamp;     private hotels hotels;       //other getter , setters      @id     @column(name = "facilityid", insertable = true, updatable = true)     @generatedvalue(strategy=generationtype.auto)      @manytoone     @joincolumn(name="hotelid")     public hotels gethotels() {         return hotels;     }     public void sethotels(hotels hotels) {         this.hotels = hotels;     }     public facilities() {         super();         // todo auto-generated constructor stub     }     public facilities(string facilityname) {         super();         this.facilityname = facilityname;     }    } 

images.java

@entity @table(name="images") public class images implements serializable {      private static final long serialversionuid = -4318294155906543400l;      private integer imageid;     private string imageurl;     private timestamp timestamp;     private hotels hotels;      //other getter , setters       @manytoone     @joincolumn(name="hotelid")     public hotels gethotels() {         return hotels;     }     public void sethotels(hotels hotels) {         this.hotels = hotels;     }      public images() {         super();         // todo auto-generated constructor stub     }     public images(string imageurl) {         super();         this.imageurl = imageurl;     } } 

thanks in advance.

in cases error caused when use jdk 8 java.time.localdatetime hibernate , don't have converter registered. (this not case in op's question, other people might stumble this.)


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -