-->
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: SerializationException on bidirectional association
PostPosted: Tue Dec 18, 2012 6:35 pm 
Newbie

Joined: Tue Dec 18, 2012 6:16 pm
Posts: 2
Hello,

I'm currently using Hibernate 4.1.5 Final and PostreSQL 9.1.
I'm facing a SerializationException with the following case.

I have the 2 followings tables:

Code:
CREATE TABLE authorsnote
(
  id numeric NOT NULL DEFAULT nextval('seq_authorsnote'::regclass),
  photo numeric NOT NULL,
  locale character varying(100) NOT NULL,
  note text NOT NULL,
  CONSTRAINT pk_authorsnote PRIMARY KEY (id ),
  CONSTRAINT fk_authorsnote_photo FOREIGN KEY (photo)
      REFERENCES photo (id) MATCH SIMPLE
      ON UPDATE RESTRICT ON DELETE RESTRICT,
  CONSTRAINT ak_unique_authorsnote_language UNIQUE (photo , locale )
);

Code:
CREATE TABLE photo
(
  id numeric NOT NULL DEFAULT nextval('seq_photo'::regclass),
  code character varying(23) NOT NULL,
  shootingdate timestamp with time zone NOT NULL,
  direction character varying(9) NOT NULL,
  titlekey character varying(255) NOT NULL,
  latitude numeric(9,7) NOT NULL,
  longitude numeric(10,7) NOT NULL
  -- some other fields
  CONSTRAINT pk_photo PRIMARY KEY (id ),
  CONSTRAINT ak_unique_photo_code_photo UNIQUE (code )
);


Here are the related entities:

Code:
@Entity
@Table(name = "authorsnote", uniqueConstraints = { @UniqueConstraint(columnNames = "photo"), @UniqueConstraint(columnNames = "locale") })
public class AuthorsNote extends BaseEntity implements Serializable {

   private static final long serialVersionUID = -5889199204519711451L;

   @ManyToOne
   private Photo photo;

   private EnumMemberLocale locale;

   @Basic(optional = false)
   @Column(nullable = false)
   @NotNull
   private String note;

   @GeneratedValue(generator = "seq_authorsnote")
   @Id
   @SequenceGenerator(name = "seq_authorsnote", sequenceName = "seq_authorsnote")
   public Integer getId() {
      return id;
   }

   public Photo getPhoto() { return photo; }

   public void setPhoto(Photo photo) { this.photo = photo; }

   @Basic(optional = false)
   @Column(length = 100, nullable = false)
   @Enumerated(EnumType.STRING)
   @NotNull
   public EnumMemberLocale getLocale() {
      return locale;
   }

   public void setLocale(EnumMemberLocale locale) { this.locale = locale; }

   public String getNote() { return note; }

   public void setNote(String note) { this.note = note; }


Code:
@Entity
@Table(name = "photo", uniqueConstraints = @UniqueConstraint(columnNames = "code"))
public class Photo extends BaseEntity implements Serializable {

   private static final long serialVersionUID = 277036452407154796L;

   @Basic(optional = false)
   @Column(length = 23, nullable = false)
   @NotNull
   @Size(max = 23)
   private String code;

   @Basic(optional = false)
   @Column(nullable = false)
   @NotNull
   @Temporal(TemporalType.TIMESTAMP)
   private Date shootingDate;

   private EnumDirection direction;

   @Basic(optional = false)
   @Column(length = 255, nullable = false)
   @NotNull
   @Size(max = 255)
   private String titleKey;

   @Basic(optional = false)
   @Column(nullable = false)
   @Digits(integer = 2, fraction = 7)
   @NotNull
   private BigDecimal latitude;

   @Basic(optional = false)
   @Column(nullable = false)
   @Digits(integer = 3, fraction = 7)
   @NotNull
   private BigDecimal longitude;

   private Set<AuthorsNote> authorsNotes = new HashSet<AuthorsNote>();

   @GeneratedValue(generator = "seq_photo")
   @Id
   @SequenceGenerator(name = "seq_photo", sequenceName = "seq_photo")
   public Integer getId() { return id; }

   public String getCode() { return code; }

   public void setCode(String code) { this.code = code; }

   public Date getShootingDate() { return shootingDate; }

   public void setShootingDate(Date shootingDate) { this.shootingDate = shootingDate; }

   @Basic(optional = false)
   @Column(nullable = false, length = 9)
   @Enumerated(EnumType.STRING)
   @NotNull
   @Size(max = 9)
   public EnumDirection getDirection() { return direction; }

   public void setDirection(EnumDirection direction) { this.direction = direction; }

   public String getTitleKey() { return titleKey; }

   public void setTitleKey(String titleKey) { this.titleKey = titleKey; }

   public BigDecimal getLatitude() { return latitude; }

   public void setLatitude(BigDecimal latitude) { this.latitude = latitude; }

   public BigDecimal getLongitude() { return longitude; }

   public void setLongitude(BigDecimal longitude) { this.longitude = longitude; }

   @OneToMany(fetch = FetchType.EAGER, mappedBy = "photo")
   public Set<AuthorsNote> getAuthorsNotes() { return authorsNotes; }

   public void setAuthorsNotes(Set<AuthorsNote> authorsNotes) { this.authorsNotes = authorsNotes; }


And the super class code:
Code:
public abstract class BaseEntity {

   protected Integer id;

   protected BaseEntity() {}

   @Override
   public boolean equals(Object obj) {return EqualsBuilder.reflectionEquals(this, obj);}

   public void setId(Integer id) {this.id = id;}

}


By using the get method, I try to retrieve a photo with its list of author's notes.
But I get the following stacktrace:

Quote:
18 déc. 2012 23:18:01 com.sun.faces.lifecycle.InvokeApplicationPhase execute
ATTENTION: #{technicalDataSheetBean.onSheetAccess}: org.hibernate.type.SerializationException: could not deserialize
javax.faces.FacesException: #{technicalDataSheetBean.onSheetAccess}: org.hibernate.type.SerializationException: could not deserialize
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:117)
at javax.faces.component.UICommand.broadcast(UICommand.java:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: javax.faces.el.EvaluationException: org.hibernate.type.SerializationException: could not deserialize
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:101)
... 51 more
Caused by: org.hibernate.type.SerializationException: could not deserialize
at org.hibernate.internal.util.SerializationHelper.doDeserialize(SerializationHelper.java:262)
at org.hibernate.internal.util.SerializationHelper.deserialize(SerializationHelper.java:306)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.fromBytes(SerializableTypeDescriptor.java:131)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:117)
at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:39)
at org.hibernate.type.descriptor.sql.VarbinaryTypeDescriptor$2.doExtract(VarbinaryTypeDescriptor.java:67)
at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:65)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:269)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:265)
at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:238)
at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:357)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2705)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1544)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1476)
at org.hibernate.loader.Loader.getRow(Loader.java:1376)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:643)
at org.hibernate.loader.Loader.doQuery(Loader.java:853)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:292)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:262)
at org.hibernate.loader.Loader.loadEntity(Loader.java:1976)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:82)
at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:72)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3720)
at org.hibernate.event.internal.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:458)
at org.hibernate.event.internal.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:427)
at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:204)
at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:260)
at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:148)
at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1079)
at org.hibernate.internal.SessionImpl.access$2200(SessionImpl.java:172)
at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.load(SessionImpl.java:2425)
at org.hibernate.internal.SessionImpl.get(SessionImpl.java:975)
at com.clementheliou.cheliou.dal.dao.generic.impl.GenericDAO.get(GenericDAO.java:33)
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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy49.get(Unknown Source)
at com.clementheliou.cheliou.business.photo.impl.PhotoService.getPhotoById(PhotoService.java:60)
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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:319)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy50.getPhotoById(Unknown Source)
at com.clementheliou.cheliou.web.controller.technicaldatasheet.TechnicalDataSheetBean.onSheetAccess(TechnicalDataSheetBean.java:155)
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.apache.el.parser.AstValue.invoke(AstValue.java:278)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:274)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
... 52 more
Caused by: java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2280)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2749)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:779)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:279)
at org.hibernate.internal.util.SerializationHelper$CustomObjectInputStream.<init>(SerializationHelper.java:328)
at org.hibernate.internal.util.SerializationHelper$CustomObjectInputStream.<init>(SerializationHelper.java:318)
at org.hibernate.internal.util.SerializationHelper.doDeserialize(SerializationHelper.java:237)
... 116 more


Activating the TRACE level on Hibernate's logs, I get the following trace:

Quote:
23:17:59 [DEBUG] o.h.internal.SessionImpl - Opened session at timestamp: 13558690796
23:17:59 [TRACE] o.h.e.j.i.p.ConnectionProxyHandler - Handling invocation of connection method [setReadOnly]
23:17:59 [DEBUG] o.h.e.j.i.LogicalConnectionImpl - Obtaining JDBC connection
23:17:59 [DEBUG] o.h.e.j.i.LogicalConnectionImpl - Obtained JDBC connection
23:17:59 [TRACE] o.h.internal.SessionImpl - Setting flush mode to: MANUAL
23:17:59 [DEBUG] o.h.e.t.s.AbstractTransactionImpl - begin
23:17:59 [DEBUG] o.h.e.t.i.jdbc.JdbcTransaction - initial autocommit status: true
23:17:59 [DEBUG] o.h.e.t.i.jdbc.JdbcTransaction - disabling autocommit
23:17:59 [DEBUG] o.h.e.t.s.AbstractTransactionImpl - committing
23:17:59 [TRACE] o.h.internal.SessionImpl - before transaction completion
23:17:59 [DEBUG] o.h.e.t.i.jdbc.JdbcTransaction - committed JDBC Connection
23:17:59 [DEBUG] o.h.e.t.i.jdbc.JdbcTransaction - re-enabling autocommit
23:17:59 [TRACE] o.h.e.t.i.TransactionCoordinatorImpl - after transaction completion
23:17:59 [TRACE] o.h.internal.SessionImpl - after transaction completion
23:17:59 [TRACE] o.h.e.j.i.p.ConnectionProxyHandler - Handling invocation of connection method [isReadOnly]
23:17:59 [TRACE] o.h.e.j.i.p.ConnectionProxyHandler - Handling invocation of connection method [setReadOnly]
23:17:59 [TRACE] o.h.internal.SessionImpl - Closing session
23:17:59 [TRACE] o.h.e.j.i.LogicalConnectionImpl - Closing logical connection
23:17:59 [TRACE] o.h.e.j.i.JdbcResourceRegistryImpl - Closing JDBC container [org.hibernate.engine.jdbc.internal.JdbcResourceRegistryImpl@1aba72e]
23:17:59 [DEBUG] o.h.e.j.i.LogicalConnectionImpl - Releasing JDBC connection
23:17:59 [DEBUG] o.h.e.j.i.LogicalConnectionImpl - Released JDBC connection
23:17:59 [DEBUG] o.h.e.j.i.p.ConnectionProxyHandler - HHH000163: Logical connection releasing its physical connection
23:17:59 [DEBUG] o.h.e.j.i.p.ConnectionProxyHandler - HHH000163: Logical connection releasing its physical connection
23:17:59 [DEBUG] o.h.e.j.i.p.ConnectionProxyHandler - HHH000163: Logical connection releasing its physical connection
23:17:59 [TRACE] o.h.e.j.i.LogicalConnectionImpl - Logical connection closed
23:18:01 [DEBUG] c.c.c.w.c.t.TechnicalDataSheetBean - Put the photo with 3 id in the cache map.
23:18:01 [DEBUG] o.h.internal.SessionImpl - Opened session at timestamp: 13558690815
23:18:01 [TRACE] o.h.e.j.i.p.ConnectionProxyHandler - Handling invocation of connection method [setReadOnly]
23:18:01 [DEBUG] o.h.e.j.i.LogicalConnectionImpl - Obtaining JDBC connection
23:18:01 [DEBUG] o.h.e.j.i.LogicalConnectionImpl - Obtained JDBC connection
23:18:01 [TRACE] o.h.internal.SessionImpl - Setting flush mode to: MANUAL
23:18:01 [DEBUG] o.h.e.t.s.AbstractTransactionImpl - begin
23:18:01 [DEBUG] o.h.e.t.i.jdbc.JdbcTransaction - initial autocommit status: true
23:18:01 [DEBUG] o.h.e.t.i.jdbc.JdbcTransaction - disabling autocommit
23:18:01 [DEBUG] c.c.c.b.photo.impl.PhotoService - Get photo with 3 id.
23:18:01 [TRACE] o.h.e.i.DefaultLoadEventListener - Loading entity: [com.clementheliou.cheliou.dal.model.photo.Photo#3]
23:18:01 [TRACE] o.h.e.i.DefaultLoadEventListener - Attempting to resolve: [com.clementheliou.cheliou.dal.model.photo.Photo#3]
23:18:01 [TRACE] o.h.e.i.DefaultLoadEventListener - Object not resolved in any cache: [com.clementheliou.cheliou.dal.model.photo.Photo#3]
23:18:01 [TRACE] o.h.p.e.AbstractEntityPersister - Fetching entity: [com.clementheliou.cheliou.dal.model.photo.Photo#3]
23:18:01 [DEBUG] org.hibernate.loader.Loader - Loading entity: [com.clementheliou.cheliou.dal.model.photo.Photo#3]
23:18:01 [TRACE] o.h.e.j.i.p.ConnectionProxyHandler - Handling invocation of connection method [prepareStatement]
23:18:01 [DEBUG] org.hibernate.SQL - select photo0_.id as id4_1_, photo0_.additionDate as addition2_4_1_, photo0_.blackAndWhite as blackAnd3_4_1_, photo0_.brightness as brightness4_1_, photo0_.camera as camera4_1_, photo0_.city as city4_1_, photo0_.code as code4_1_, photo0_.contrast as contrast4_1_, photo0_.country as country4_1_, photo0_.department as department4_1_, photo0_.direction as direction4_1_, photo0_.exposureTime as exposur12_4_1_, photo0_.flashMode as flashMode4_1_, photo0_.focal as focal4_1_, photo0_.focalDistance as focalDi15_4_1_, photo0_.focalDistance35mm as focalDi16_4_1_, photo0_.iso as iso4_1_, photo0_.latitude as latitude4_1_, photo0_.layers as layers4_1_, photo0_.longitude as longitude4_1_, photo0_.model as model4_1_, photo0_.modelName as modelName4_1_, photo0_.relativeAperture as relativ23_4_1_, photo0_.shootingDate as shootin24_4_1_, photo0_.straighteningUp as straigh25_4_1_, photo0_.titleKey as titleKey4_1_, photo0_.whiteBalance as whiteBa27_4_1_, authorsnot1_.photo as photo4_3_, authorsnot1_.id as id3_, authorsnot1_.id as id3_0_, authorsnot1_.locale as locale3_0_, authorsnot1_.note as note3_0_, authorsnot1_.photo as photo3_0_ from photo photo0_ left outer join authorsnote authorsnot1_ on photo0_.id=authorsnot1_.photo where photo0_.id=?
Hibernate: select photo0_.id as id4_1_, photo0_.additionDate as addition2_4_1_, photo0_.blackAndWhite as blackAnd3_4_1_, photo0_.brightness as brightness4_1_, photo0_.camera as camera4_1_, photo0_.city as city4_1_, photo0_.code as code4_1_, photo0_.contrast as contrast4_1_, photo0_.country as country4_1_, photo0_.department as department4_1_, photo0_.direction as direction4_1_, photo0_.exposureTime as exposur12_4_1_, photo0_.flashMode as flashMode4_1_, photo0_.focal as focal4_1_, photo0_.focalDistance as focalDi15_4_1_, photo0_.focalDistance35mm as focalDi16_4_1_, photo0_.iso as iso4_1_, photo0_.latitude as latitude4_1_, photo0_.layers as layers4_1_, photo0_.longitude as longitude4_1_, photo0_.model as model4_1_, photo0_.modelName as modelName4_1_, photo0_.relativeAperture as relativ23_4_1_, photo0_.shootingDate as shootin24_4_1_, photo0_.straighteningUp as straigh25_4_1_, photo0_.titleKey as titleKey4_1_, photo0_.whiteBalance as whiteBa27_4_1_, authorsnot1_.photo as photo4_3_, authorsnot1_.id as id3_, authorsnot1_.id as id3_0_, authorsnot1_.locale as locale3_0_, authorsnot1_.note as note3_0_, authorsnot1_.photo as photo3_0_ from photo photo0_ left outer join authorsnote authorsnot1_ on photo0_.id=authorsnot1_.photo where photo0_.id=?
23:18:01 [TRACE] o.h.e.j.i.JdbcResourceRegistryImpl - Registering statement [org.hibernate.engine.jdbc.internal.proxy.PreparedStatementProxyHandler@be95bf[valid=true]]
23:18:01 [TRACE] o.h.e.j.i.JdbcResourceRegistryImpl - Registering last query statement [org.hibernate.engine.jdbc.internal.proxy.PreparedStatementProxyHandler@be95bf[valid=true]]
23:18:01 [TRACE] o.h.e.j.i.p.AbstractStatementProxyHandler - Handling invocation of statement method [getWrappedObject]
23:18:01 [TRACE] o.h.e.j.i.JdbcResourceRegistryImpl - Registering last query statement [select photo0_.id as id4_1_, photo0_.additionDate as addition2_4_1_, photo0_.blackAndWhite as blackAnd3_4_1_, photo0_.brightness as brightness4_1_, photo0_.camera as camera4_1_, photo0_.city as city4_1_, photo0_.code as code4_1_, photo0_.contrast as contrast4_1_, photo0_.country as country4_1_, photo0_.department as department4_1_, photo0_.direction as direction4_1_, photo0_.exposureTime as exposur12_4_1_, photo0_.flashMode as flashMode4_1_, photo0_.focal as focal4_1_, photo0_.focalDistance as focalDi15_4_1_, photo0_.focalDistance35mm as focalDi16_4_1_, photo0_.iso as iso4_1_, photo0_.latitude as latitude4_1_, photo0_.layers as layers4_1_, photo0_.longitude as longitude4_1_, photo0_.model as model4_1_, photo0_.modelName as modelName4_1_, photo0_.relativeAperture as relativ23_4_1_, photo0_.shootingDate as shootin24_4_1_, photo0_.straighteningUp as straigh25_4_1_, photo0_.titleKey as titleKey4_1_, photo0_.whiteBalance as whiteBa27_4_1_, authorsnot1_.photo as photo4_3_, authorsnot1_.id as id3_, authorsnot1_.id as id3_0_, authorsnot1_.locale as locale3_0_, authorsnot1_.note as note3_0_, authorsnot1_.photo as photo3_0_ from photo photo0_ left outer join authorsnote authorsnot1_ on photo0_.id=authorsnot1_.photo where photo0_.id=?]
23:18:01 [TRACE] o.h.t.d.sql.BasicBinder - binding parameter [1] as [INTEGER] - 3
23:18:01 [TRACE] o.h.e.j.i.p.AbstractStatementProxyHandler - Handling invocation of statement method [setInt]
23:18:01 [TRACE] o.h.e.j.i.p.PreparedStatementProxyHandler - Binding via setInt: [1, 3]
23:18:01 [TRACE] org.hibernate.loader.Loader - Bound [2] parameters total
23:18:01 [TRACE] o.h.e.j.i.p.AbstractStatementProxyHandler - Handling invocation of statement method [executeQuery]
23:18:01 [TRACE] o.h.e.j.i.JdbcResourceRegistryImpl - Registering result set [org.hibernate.engine.jdbc.internal.proxy.ResultSetProxyHandler@29626a[valid=true]]
23:18:01 [TRACE] o.h.e.j.i.p.AbstractResultSetProxyHandler - Handling invocation of ResultSet method [getStatement]
23:18:01 [TRACE] o.h.e.j.i.p.AbstractResultSetProxyHandler - Handling invocation of ResultSet method [getStatement]
23:18:01 [TRACE] org.hibernate.loader.Loader - Processing result set
23:18:01 [TRACE] o.h.e.j.i.p.AbstractResultSetProxyHandler - Handling invocation of ResultSet method [next]
23:18:01 [DEBUG] org.hibernate.loader.Loader - Result set row: 0
23:18:01 [TRACE] o.h.e.j.i.p.AbstractResultSetProxyHandler - Handling invocation of ResultSet method [getInt]
23:18:01 [TRACE] o.h.e.j.i.p.AbstractResultSetProxyHandler - Handling invocation of ResultSet method [wasNull]
23:18:01 [TRACE] o.h.t.d.sql.BasicExtractor - Found [2] as column [id3_0_]
23:18:01 [DEBUG] org.hibernate.loader.Loader - Result row: EntityKey[com.clementheliou.cheliou.dal.model.photo.AuthorsNote#2], EntityKey[com.clementheliou.cheliou.dal.model.photo.Photo#3]
23:18:01 [TRACE] org.hibernate.loader.Loader - Initializing object from ResultSet: [com.clementheliou.cheliou.dal.model.photo.AuthorsNote#2]
23:18:01 [TRACE] o.h.p.e.AbstractEntityPersister - Hydrating entity: [com.clementheliou.cheliou.dal.model.photo.AuthorsNote#2]
23:18:01 [TRACE] o.h.e.j.i.p.AbstractResultSetProxyHandler - Handling invocation of ResultSet method [getObject]
23:18:01 [TRACE] o.h.e.j.i.p.AbstractResultSetProxyHandler - Handling invocation of ResultSet method [wasNull]
23:18:01 [TRACE] org.hibernate.type.EnumType - Returning {0} as column locale3_0_
23:18:01 [TRACE] o.h.e.j.i.p.AbstractResultSetProxyHandler - Handling invocation of ResultSet method [getString]
23:18:01 [TRACE] o.h.e.j.i.p.AbstractResultSetProxyHandler - Handling invocation of ResultSet method [wasNull]
23:18:01 [TRACE] o.h.t.d.sql.BasicExtractor - Found [Plop ma note] as column [note3_0_]
23:18:01 [TRACE] o.h.e.j.i.p.AbstractResultSetProxyHandler - Handling invocation of ResultSet method [getBytes]
23:18:01 [TRACE] o.h.i.util.SerializationHelper - Starting deserialization of object

23:18:01 [TRACE] o.h.e.j.i.p.AbstractStatementProxyHandler - Handling invocation of statement method [close]
23:18:01 [TRACE] o.h.e.j.i.JdbcResourceRegistryImpl - Releasing statement [org.hibernate.engine.jdbc.internal.proxy.PreparedStatementProxyHandler@be95bf[valid=true]]
23:18:01 [TRACE] o.h.e.j.i.JdbcResourceRegistryImpl - Closing result set [org.hibernate.engine.jdbc.internal.proxy.ResultSetProxyHandler@29626a[valid=true]]
23:18:01 [TRACE] o.h.e.j.i.p.AbstractResultSetProxyHandler - Handling invocation of ResultSet method [getWrappedObject]
23:18:01 [TRACE] o.h.e.j.i.JdbcResourceRegistryImpl - Closing result set [org.postgresql.jdbc4.Jdbc4ResultSet@29626a]
23:18:01 [TRACE] o.h.e.j.i.p.AbstractResultSetProxyHandler - Handling invocation of ResultSet method [invalidate]
23:18:01 [TRACE] o.h.e.j.i.JdbcResourceRegistryImpl - Closing prepared statement [org.hibernate.engine.jdbc.internal.proxy.PreparedStatementProxyHandler@be95bf[valid=true]]
23:18:01 [TRACE] o.h.e.j.i.p.AbstractStatementProxyHandler - Handling invocation of statement method [getWrappedObject]
23:18:01 [TRACE] o.h.e.j.i.JdbcResourceRegistryImpl - Closing prepared statement [select photo0_.id as id4_1_, photo0_.additionDate as addition2_4_1_, photo0_.blackAndWhite as blackAnd3_4_1_, photo0_.brightness as brightness4_1_, photo0_.camera as camera4_1_, photo0_.city as city4_1_, photo0_.code as code4_1_, photo0_.contrast as contrast4_1_, photo0_.country as country4_1_, photo0_.department as department4_1_, photo0_.direction as direction4_1_, photo0_.exposureTime as exposur12_4_1_, photo0_.flashMode as flashMode4_1_, photo0_.focal as focal4_1_, photo0_.focalDistance as focalDi15_4_1_, photo0_.focalDistance35mm as focalDi16_4_1_, photo0_.iso as iso4_1_, photo0_.latitude as latitude4_1_, photo0_.layers as layers4_1_, photo0_.longitude as longitude4_1_, photo0_.model as model4_1_, photo0_.modelName as modelName4_1_, photo0_.relativeAperture as relativ23_4_1_, photo0_.shootingDate as shootin24_4_1_, photo0_.straighteningUp as straigh25_4_1_, photo0_.titleKey as titleKey4_1_, photo0_.whiteBalance as whiteBa27_4_1_, authorsnot1_.photo as photo4_3_, authorsnot1_.id as id3_, authorsnot1_.id as id3_0_, authorsnot1_.locale as locale3_0_, authorsnot1_.note as note3_0_, authorsnot1_.photo as photo3_0_ from photo photo0_ left outer join authorsnote authorsnot1_ on photo0_.id=authorsnot1_.photo where photo0_.id='3']
23:18:01 [TRACE] o.h.e.j.i.p.AbstractStatementProxyHandler - Handling invocation of statement method [invalidate]
23:18:01 [TRACE] o.h.e.j.i.LogicalConnectionImpl - Starting after statement execution processing [ON_CLOSE]
23:18:01 [INFO ] o.h.e.i.DefaultLoadEventListener - HHH000327: Error performing load command : org.hibernate.type.SerializationException: could not deserialize
23:18:01 [DEBUG] o.h.e.t.s.AbstractTransactionImpl - rolling back
23:18:01 [DEBUG] o.h.e.t.i.jdbc.JdbcTransaction - rolled JDBC Connection
23:18:01 [DEBUG] o.h.e.t.i.jdbc.JdbcTransaction - re-enabling autocommit
23:18:01 [TRACE] o.h.e.t.i.TransactionCoordinatorImpl - after transaction completion
23:18:01 [TRACE] o.h.internal.SessionImpl - after transaction completion
23:18:01 [TRACE] o.h.e.j.i.p.ConnectionProxyHandler - Handling invocation of connection method [isReadOnly]
23:18:01 [TRACE] o.h.e.j.i.p.ConnectionProxyHandler - Handling invocation of connection method [setReadOnly]
23:18:01 [TRACE] o.h.internal.SessionImpl - Closing session
23:18:01 [TRACE] o.h.e.j.i.LogicalConnectionImpl - Closing logical connection
23:18:01 [TRACE] o.h.e.j.i.p.ConnectionProxyHandler - Handling invocation of connection method [close]
23:18:01 [TRACE] o.h.e.j.i.p.ConnectionProxyHandler - Invalidating connection handle
23:18:01 [TRACE] o.h.e.j.i.JdbcResourceRegistryImpl - Closing JDBC container [org.hibernate.engine.jdbc.internal.JdbcResourceRegistryImpl@adb165]
23:18:01 [DEBUG] o.h.e.j.i.LogicalConnectionImpl - Releasing JDBC connection
23:18:01 [DEBUG] o.h.e.j.i.LogicalConnectionImpl - Released JDBC connection
23:18:01 [DEBUG] o.h.e.j.i.p.ConnectionProxyHandler - HHH000163: Logical connection releasing its physical connection
23:18:01 [DEBUG] o.h.e.j.i.p.ConnectionProxyHandler - HHH000163: Logical connection releasing its physical connection
23:18:01 [DEBUG] o.h.e.j.i.p.ConnectionProxyHandler - HHH000163: Logical connection releasing its physical connection
23:18:01 [DEBUG] o.h.e.j.i.p.ConnectionProxyHandler - HHH000163: Logical connection releasing its physical connection
23:18:01 [TRACE] o.h.e.j.i.LogicalConnectionImpl - Logical connection closed


It seems that the error occurs when Hibernate try to bind the foreign key inside the Photo object (see the bold part above) but I can't figure why.
I'm googling but didn't find anything that works for me.
Any help would be appreciate.

I can provide more details if necessary.
Thanks.
Clément


Top
 Profile  
 
 Post subject: Re: SerializationException on bidirectional association
PostPosted: Thu Dec 20, 2012 6:02 pm 
Newbie

Joined: Tue Dec 18, 2012 6:16 pm
Posts: 2
I have found my mistake!
I hope it will helps you if you faces the same exception.

In my authorsnote table, I had a column named photo.
And in the related entity, the related field had the same name.
It seems that it causes the exception.

I just renamed the column as photo_id, add a
Code:
@JoinColumn(name="photo-id")
and it works like a charm!


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.