Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Persistence Error - Unable to find solution(Need help getting past mind block...)
Persistence Error - Unable to find solution [message #892060] Tue, 26 June 2012 23:12 Go to next message
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 #892490 is a reply to message #892060] Thu, 28 June 2012 08:44 Go to previous messageGo to next message
Josh Toepfer
Messages: 3
Registered: June 2012
Location: Milwaukee, WI
Junior Member
So I downloaded JODE decompiler, and cracked open my compiled/statically weaved code. I have found that EntityA does not contain the method "_persistence_checkFetched(java.lang.String)", however it is referenced several times in the class. I am currently using using Ant (StaticWeaveAntTask) to statically weave the code, other classes in the same package hove this method. Any in site would be greatly appreciated.

Using:
Eclipselink 2.0.2
Re: Persistence Error - Unable to find solution [message #892617 is a reply to message #892490] Thu, 28 June 2012 14:21 Go to previous messageGo to next message
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.
Re: Persistence Error - Unable to find solution [message #892629 is a reply to message #892617] Thu, 28 June 2012 15:56 Go to previous message
Chris Delahunt is currently offline Chris Delahunt
Messages: 995
Registered: July 2009
Senior Member
Does adding the mappedsuperclass to the list of classes in the persistence.xml cause it to be woven? Can you show the properties used in the static weaving task and where the mappedsuperclass is in relation to the paths setup?

Best Regards,
Chris
Previous Topic:Need some help with eclipselink versions
Next Topic:Connect with MS-SQL "lock"
Goto Forum:
  


Current Time: Sun Apr 20 09:34:13 EDT 2014

Powered by FUDForum. Page generated in 0.05738 seconds