Hi,
I'm using Hibernate with Envers 1.2.1 and Seam 2.2.0GA to version certain entities of my system.
When I try to load all versions of an entity I get an EntityNotFoundException while fetching a ManyToOne relation where the FK is null.
I've already tried to add the @NotFound annotation with no help.
Does anybody know a solution to my problem?
EntityCode:
@Entity
@Table(name = "REACTION")
@Audited
public class Reaction implements java.io.Serializable {
...
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "FK_SUBSYSTEM")
@NotFound(action = NotFoundAction.IGNORE)
public Subsystem getSubsystem() {
return this.subsystem;
}
...
}
Referenced Entity:Code:
@Entity
@Table(name = "SUBSYSTEM")
@Audited
public class Subsystem implements java.io.Serializable {
...
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "subsystem")
public Set<Reaction> getReactions() {
return this.reactions;
}
...
}
Exception:Code:
javax.persistence.EntityNotFoundException: Unable to find at.tugraz.genome.memosys.subsystem.entity.Subsystem with id null
at org.hibernate.ejb.Ejb3Configuration$Ejb3EntityNotFoundDelegate.handleEntityNotFound(Ejb3Configuration.java:113)
at org.hibernate.proxy.AbstractLazyInitializer.checkTargetState(AbstractLazyInitializer.java:108)
at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:97)
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:140)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190)
at at.tugraz.genome.memosys.subsystem.entity.Subsystem_$$_javassist_11.equals(Subsystem_$$_javassist_11.java)
at at.tugraz.genome.memosys.reaction.entity.Reaction.getDifference(Reaction.java:531)
at at.tugraz.genome.memosys.seam.EntityHomeVersioning.getAllVersions(EntityHomeVersioning.java:43)
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.jboss.seam.util.Reflections.invoke(Reflections.java:22)
at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:97)
at org.jboss.seam.util.Work.workInTransaction(Work.java:47)
at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:91)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.security.SecurityInterceptor.aroundInvoke(SecurityInterceptor.java:163)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
at at.tugraz.genome.memosys.session.reaction.ReactionHome_$$_javassist_seam_10.getAllVersions(ReactionHome_$$_javassist_seam_10.java)
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 javax.el.BeanELResolver.getValue(BeanELResolver.java:62)
at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
at org.jboss.el.parser.AstPropertySuffix.getValue(AstPropertySuffix.java:53)
at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
Thanks for your help
Stephan