-->
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.  [ 3 posts ] 
Author Message
 Post subject: EntityNotFoundException - with id null
PostPosted: Fri Aug 07, 2009 4:17 am 
Newbie

Joined: Fri Aug 07, 2009 3:56 am
Posts: 2
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?

Entity
Code:
@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


Top
 Profile  
 
 Post subject: Re: EntityNotFoundException - with id null
PostPosted: Mon Aug 10, 2009 8:49 am 
Newbie

Joined: Fri Aug 07, 2009 3:56 am
Posts: 2
I think I've found a corresponding JIRA entry:
https://jira.jboss.org/jira/browse/ENVERS-73

Is there a fix for it?

Best regards
Stephan


Top
 Profile  
 
 Post subject: Re: EntityNotFoundException - with id null
PostPosted: Fri Aug 14, 2009 4:34 am 
Newbie

Joined: Fri Aug 14, 2009 4:29 am
Posts: 1
Start by checking that all your _AUD tables have some data. When envers is looking for entities related to the versioned entity, it only looks from the _AUD table.

For example in case of the ENVERS-73 it might be that the nationality_aud table is empty, if the nationality itself has not been modified or created via Hibernate.

This can easily happen if you bring in envers in the middle of the project, or if you add things directly to database (without going via envers). If you insert things directly to database, then you also need to manually insert the same stuff to the _aud tables.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.