[jboss-user] [EJB 3.0] - optional OneToOne relation

Frank Langelage do-not-reply at jboss.com
Sat Sep 18 16:25:08 EDT 2010


Frank Langelage [http://community.jboss.org/people/lafr] created the discussion

"optional OneToOne relation"

To view the discussion, visit: http://community.jboss.org/message/562556#562556

--------------------------------------------------------------
I have a entity with an optional unidirectional one-to-one relationship.

@Entity
@IdClass( value = MbiMsgpa.PK.class )
@Table( name = "mbi_msgpa" )
public class MbiMsgpa implements Serializable, Comparable<MbiMsgpa>
...
/** Relation with MbiMsgpt. */
    @OneToOne( cascade = { CascadeType.PERSIST, CascadeType.REMOVE }, fetch = FetchType.LAZY )
    @Cascade( value = org.hibernate.annotations.CascadeType.DELETE_ORPHAN )
    @NotFound( action = NotFoundAction.IGNORE )
    @PrimaryKeyJoinColumns( {
        @PrimaryKeyJoinColumn( name = "msghd_serial", referencedColumnName = "msghd_serial" ),
        @PrimaryKeyJoinColumn( name = "part_no", referencedColumnName = "part_no" )
    } )
    private MbiMsgpt mbiMsgpt;
...
}

This worked using JBoss-4.2.4, but migrating to JBoss-6.0.0.

But using JBoss6 I get an exception like this:
2010-09-18 22:00:15,055 ERROR [biz.mbisoftware.common.XmlHelper] (Thread-2 (group:HornetQ-client-global-threads-21860387))
    javax.persistence.EntityNotFoundException : Unable to find biz.mbisoftware.fn.ejb.entity.MbiMsgpt with id [MsghdSerial=7741;PartNo=1;]
    java.lang.reflect.InvocationTargetException : null
    biz.mbisoftware.common.exceptions.MbiException : java.lang.reflect.InvocationTargetException
    biz.mbisoftware.fn.ejb.entity.MbiMsgpt_$$_javassist_155(-1).getAdditionalData
    biz.mbisoftware.common.XmlHelper(291).methods2Xml
    biz.mbisoftware.common.XmlHelper(370).bean2Xml
    biz.mbisoftware.common.XmlHelper(301).methods2Xml
    biz.mbisoftware.common.XmlHelper(370).bean2Xml
    biz.mbisoftware.common.XmlHelper(123).collectionMethod2Xml
    biz.mbisoftware.common.XmlHelper(286).methods2Xml
    biz.mbisoftware.common.XmlHelper(368).bean2Xml
    biz.mbisoftware.fn.ejb.session.MessageDistributorType(73).buildTheXmlDocument
    biz.mbisoftware.fn.ejb.message.core.MessageDistributor(123).onMessage
    biz.mbisoftware.common.ParameterInterceptor(108).parameters: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_21]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_21]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_21]
    at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_21]
    at biz.mbisoftware.common.XmlHelper.methods2Xml(XmlHelper.java:291) [:]
    at biz.mbisoftware.common.XmlHelper.bean2Xml(XmlHelper.java:370) [:]
    at biz.mbisoftware.common.XmlHelper.methods2Xml(XmlHelper.java:301) [:]
    at biz.mbisoftware.common.XmlHelper.bean2Xml(XmlHelper.java:370) [:]
    at biz.mbisoftware.common.XmlHelper.collectionMethod2Xml(XmlHelper.java:123) [:]
    at biz.mbisoftware.common.XmlHelper.methods2Xml(XmlHelper.java:286) [:]
    at biz.mbisoftware.common.XmlHelper.bean2Xml(XmlHelper.java:368) [:]
    at biz.mbisoftware.fn.ejb.session.MessageDistributorType.buildTheXmlDocument(MessageDistributorType.java:73) [:]
    at biz.mbisoftware.fn.ejb.message.core.MessageDistributor.onMessage(MessageDistributor.java:123) [:]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_21]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_21]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_21]
    at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_21]
    at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122) [jboss-aop.jar:2.2.1.Alpha3]
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111) [jboss-aop.jar:2.2.1.Alpha3]
    at org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java:72) [:1.0.8]
    at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor$InvocationContext.proceed(InvocationContextInterceptor.java:138) [:1.0.8]
    at biz.mbisoftware.common.ParameterInterceptor.parameters(ParameterInterceptor.java:108) [:]
    at sun.reflect.GeneratedMethodAccessor459.invoke(Unknown Source) [:1.6.0_21]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_21]
    at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_21]
    at org.jboss.ejb3.interceptors.aop.EJB3InterceptorInterceptor.invoke(EJB3InterceptorInterceptor.java:83) [:1.0.8]
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/562556#562556]

Start a new discussion in EJB 3.0 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100918/adb44541/attachment.html 


More information about the jboss-user mailing list