-->
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.  [ 1 post ] 
Author Message
 Post subject: optional OneToOne relation no longer works
PostPosted: Sun Sep 19, 2010 3:45 pm 
Newbie

Joined: Mon Sep 24, 2007 2:55 pm
Posts: 13
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 using these Hibernate components
hibernate-annotations: version="3.2.1.GA"
hibernate-entitymanager: version="3.2.1.GA"
hibernate: version="3.2.4.SP1_CP01-brew"
but migrating to JBoss-6.0.0-SNAPSHOT with
Hibernate Annotations 3.5.5-Final
Hibernate 3.5.5-Final
Hibernate Commons Annotations 3.2.0.Final
Hibernate EntityManager 3.5.5-Final
Hibernate Validator 3.1.0.GA
Hibernate Validator 4.0.2.GA
it fails.

I get this exception if there is no entry in MbiMsgpt:
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]


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.