-->
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: Problem with @OneToOne bidirectional Hibernate Core 3.5.0-CR
PostPosted: Thu Feb 25, 2010 10:55 am 
Newbie

Joined: Thu Nov 22, 2007 8:37 am
Posts: 2
Have problem with @OneToOne bidirectional looking google but not found
Code:
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;

@Entity(name = "company")
public class Company extends Trackable {
       private static final long serialVersionUID = 1L;

      @OneToOne(mappedBy = "company")
       private Administarator administrator;


       public void setAdministrator(Administarator administrator) {
               this.administrator = administrator;
       }

       public Administarator getAdministrator() {
               return administrator;
       }

}


Code:
@Entity(name = "administarator")
public class Administarator extends User {

       private static final long serialVersionUID = 1L;



       @OneToOne
       @JoinColumn(name = "company_id")
       private Company company;

       public void setCompany(Company company) {
               this.company = company;
       }

       public Company getCompany() {
               return company;
       }
}

Code:
org.hibernate.AssertionFailure: non-transient entity has a null id
       at org.hibernate.type.EntityType.replace(EntityType.java:287)
       at org.hibernate.type.AbstractType.replace(AbstractType.java:177)
       at org.hibernate.type.TypeFactory.replaceAssociations(TypeFactory.java:614)
       at org.hibernate.event.def.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:522)
       at org.hibernate.event.def.DefaultMergeEventListener.mergeTransientEntity(DefaultMergeEventListener.java:352)
       at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:282)
       at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:237)
       at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:84)
       at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:859)
       at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:843)
       at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:847)
       at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:611)
       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.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240)
       at $Proxy21.merge(Unknown Source)
       at com.menesty.gxt.server.dao.impl.IdentifiableDAOImpl.save(IdentifiableDAOImpl.java:45)
       at com.menesty.gxt.server.dao.impl.TrackableDAOImpl.save(TrackableDAOImpl.java:22)
       at com.menesty.gxt.server.dao.impl.TrackableDAOImpl.save(TrackableDAOImpl.java:11)
       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:307)
       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:108)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
       at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
       at $Proxy23.save(Unknown Source)
       at com.menesty.gxt.server.service.impl.AbstractServiceImpl.save(AbstractServiceImpl.java:23)
       at ua.com.kvad.server.service.rpc.SystemPanelRemoteServiceImpl.save(SystemPanelRemoteServiceImpl.java:92)
       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.gwtwidgets.server.spring.gilead.GileadRPCServiceExporter.invokeMethodOnService(GileadRPCServiceExporter.java:149)
       at com.menesty.gxt.server.service.rpc.ApplicationRPCServiceExporter.invokeMethodOnService(ApplicationRPCServiceExporter.java:27)
       at org.gwtwidgets.server.spring.GWTRPCServiceExporter.processCall(GWTRPCServiceExporter.java:338)
       at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:224)
       at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
       at org.gwtwidgets.server.spring.GWTRPCServiceExporter.handleRequest(GWTRPCServiceExporter.java:407)
       at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:49)
       at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
       at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
       at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
       at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
       at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
       at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
       at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
       at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
       at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
       at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
       at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
       at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
       at org.mortbay.jetty.Server.handle(Server.java:324)
       at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
       at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
       at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
       at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
       at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
       at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
       at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
93929 INFO  net.sf.gilead.core.PersistentBeanManager  - Third party
instance, not cloned : org.hibernate.AssertionFailure: non-transient
entity has a null id
Starting Jetty on port 8888
  [WARN] Exception while dispatching incoming RPC call
java.lang.RuntimeException:
com.google.gwt.user.server.rpc.UnexpectedException: Service method
'public abstract int
ua.com.kvad.client.rpc.SystemPanelRemoteService.save(ua.com.kvad.entity.Company)
throws com.menesty.gxt.exception.RegistrationExeption' threw an
unexpected exception: org.hibernate.AssertionFailure: non-transient
entity has a null id
       at org.gwtwidgets.server.spring.GWTRPCServiceExporter.handleExporterProcessingException(GWTRPCServiceExporter.java:384)
       at org.gwtwidgets.server.spring.GWTRPCServiceExporter.processCall(GWTRPCServiceExporter.java:353)
       at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:224)
       at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
       at org.gwtwidgets.server.spring.GWTRPCServiceExporter.handleRequest(GWTRPCServiceExporter.java:407)
       at org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:49)
       at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
       at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
       at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
       at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:563)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
       at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
       at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
       at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
       at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
       at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
       at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
       at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
       at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
       at org.mortbay.jetty.Server.handle(Server.java:324)
       at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
       at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
       at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
       at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
       at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
       at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
       at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Caused by: com.google.gwt.user.server.rpc.UnexpectedException: Service
method 'public abstract int
ua.com.kvad.client.rpc.SystemPanelRemoteService.save(ua.com.kvad.entity.Company)
throws com.menesty.gxt.exception.RegistrationExeption' threw an
unexpected exception: org.hibernate.AssertionFailure: non-transient
entity has a null id
       at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:378)
       at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:361)
       at org.gwtwidgets.server.spring.GWTRPCServiceExporter.encodeResponseForFailure(GWTRPCServiceExporter.java:223)
       at org.gwtwidgets.server.spring.gilead.GileadRPCServiceExporter.encodeResponseForFailure(GileadRPCServiceExporter.java:169)
       at org.gwtwidgets.server.spring.GWTRPCServiceExporter.handleInvocationTargetException(GWTRPCServiceExporter.java:256)
       at org.gwtwidgets.server.spring.GWTRPCServiceExporter.processCall(GWTRPCServiceExporter.java:344)
       ... 27 more
Caused by: org.hibernate.AssertionFailure: non-transient entity has a null id
       at org.hibernate.type.EntityType.replace(EntityType.java:287)
       at org.hibernate.type.AbstractType.replace(AbstractType.java:177)
       at org.hibernate.type.TypeFactory.replaceAssociations(TypeFactory.java:614)
       at org.hibernate.event.def.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:522)
       at org.hibernate.event.def.DefaultMergeEventListener.mergeTransientEntity(DefaultMergeEventListener.java:352)
       at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:282)
       at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:237)
       at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:84)
       at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:859)
       at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:843)
       at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:847)
       at org.hibernate.ejb.AbstractEntityManagerImpl.merge(AbstractEntityManagerImpl.java:611)
       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.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:240)
       at $Proxy21.merge(Unknown Source)
       at com.menesty.gxt.server.dao.impl.IdentifiableDAOImpl.save(IdentifiableDAOImpl.java:45)
       at com.menesty.gxt.server.dao.impl.TrackableDAOImpl.save(TrackableDAOImpl.java:22)
       at com.menesty.gxt.server.dao.impl.TrackableDAOImpl.save(TrackableDAOImpl.java:11)
       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:307)
       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:108)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
       at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
       at $Proxy23.save(Unknown Source)
       at com.menesty.gxt.server.service.impl.AbstractServiceImpl.save(AbstractServiceImpl.java:23)
       at ua.com.kvad.server.service.rpc.SystemPanelRemoteServiceImpl.save(SystemPanelRemoteServiceImpl.java:92)
       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.gwtwidgets.server.spring.gilead.GileadRPCServiceExporter.invokeMethodOnService(GileadRPCServiceExporter.java:149)
       at com.menesty.gxt.server.service.rpc.ApplicationRPCServiceExporter.invokeMethodOnService(ApplicationRPCServiceExporter.java:27)
       at org.gwtwidgets.server.spring.GWTRPCServiceExporter.processCall(GWTRPCServiceExporter.java:338)
       ... 27 more


Top
 Profile  
 
 Post subject: Re: Problem with @OneToOne bidirectional Hibernate Core 3.5.0-CR
PostPosted: Fri Feb 26, 2010 3:37 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Did the identical thing work with a version prior to Core 3.5.0-CR?


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.