Persistence Error - Unable to find solution [message #892060] |
Wed, 27 June 2012 03:12 |
Josh Toepfer Messages: 3 Registered: June 2012 Location: Milwaukee, WI |
Junior Member |
|
|
I have an Entity A which has a OneToOne relationship with Entity B. I use the Springframework to setup the EntityManager. When I create a new Entity A and set anything on this Entity it throws an throwable error.
java.lang.NoSuchMethodError: com.sample.EntityA._persistence_checkFetched(Ljava/lang/String;)V
I'm looking for some direction on how to solve the problem.
try {
EntityA entityA = buildEntityA(criteria);
persistEntity(entityA);
}
catch(Throwable th) {
logger.error("", th);
}
private EntityA buildEntityA(criteria) {
EntityA entityA = new EntityA();
EntityB entityB = resolveEntityB(criteria);
entityA.setEntityB(entityB); // <-- location of when the error is thrown
}
@Entity
public class EntityA implements Serializable {
private Long id;
private EntityB entityB;
... accessors/mutators
}
@Entity
public class EntityB implements Serializable {
private Long id;
... accessors/mutators
}
|
|
|
|
Re: Persistence Error - Unable to find solution [message #892617 is a reply to message #892490] |
Thu, 28 June 2012 18:21 |
Josh Toepfer Messages: 3 Registered: June 2012 Location: Milwaukee, WI |
Junior Member |
|
|
So after dumping the StaticWeaveAntTask stack trace from ANT build I found that when building the EntityA class, I get the following weaving stack trace:
[weave] [EL Finest]: 2012-06-28 12:48:33.652--ServerSession(14803635)--Thread(Thread[main,5,main])--Begin weaver class transformer processing class [com/foo/domain/EntityA].
[weave] [EL Finest]: 2012-06-28 12:48:33.653--ServerSession(14803635)--Thread(Thread[main,5,main])--Weaved change tracking (ChangeTracker) [com/foo/domain/EntityA].
[weave] [EL Finest]: 2012-06-28 12:48:33.653--ServerSession(14803635)--Thread(Thread[main,5,main])--Weaved lazy (ValueHolder indirection) [com/foo/domain/EntityA].
[weave] [EL Finest]: 2012-06-28 12:48:33.653--ServerSession(14803635)--Thread(Thread[main,5,main])--Weaved fetch groups (FetchGroupTracker) [com/foo/domain/EntityA].
[weave] [EL Finest]: 2012-06-28 12:48:33.653--ServerSession(14803635)--Thread(Thread[main,5,main])--End weaver class transformer processing class [com/foo/domain/EntityA].
However, on EntityB I found that the weaving trace produces the following stack:
[weave] [EL Finest]: 2012-06-28 12:48:33.652--ServerSession(14803635)--Thread(Thread[main,5,main])--Begin weaver class transformer processing class [com/foo/domain/EntityB].
[weave] [EL Finest]: 2012-06-28 12:48:33.653--ServerSession(14803635)--Thread(Thread[main,5,main])--Weaved persistence (PersistenceEntity) [com/foo/domain/EntityB].
[weave] [EL Finest]: 2012-06-28 12:48:33.653--ServerSession(14803635)--Thread(Thread[main,5,main])--Weaved change tracking (ChangeTracker) [com/foo/domain/EntityB].
[weave] [EL Finest]: 2012-06-28 12:48:33.653--ServerSession(14803635)--Thread(Thread[main,5,main])--Weaved lazy (ValueHolder indirection) [com/foo/domain/EntityB].
[weave] [EL Finest]: 2012-06-28 12:48:33.653--ServerSession(14803635)--Thread(Thread[main,5,main])--Weaved fetch groups (FetchGroupTracker) [com/foo/domain/EntityB].
[weave] [EL Finest]: 2012-06-28 12:48:33.653--ServerSession(14803635)--Thread(Thread[main,5,main])--End weaver class transformer processing class [com/foo/domain/EntityB].
So, the highlighted step is not executed for what ever reason.... AND THEN IT CLICKED....
If you take a look at this post --> www.eclipse.org/forums/index.php/m/383826/?srch=_checkFetched#msg_383826. [NOTE: They won't let me post a link until I have posted more than 25 messages.] They had problems with subclass, which I totally missed. We have a homegrown OptimisticLock class which is @MappedSuperclass and EntityA extends.
So, I removed this subclass, and everything works as I expected. I think there needs to be some digging into why the StaticWeaveAntTask misses this persistence step.
I hope this helps anyone with this same issue.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03851 seconds