users@glassfish.java.net

Strange Errors with OneToOne and ManyToOne relations

From: <glassfish_at_javadesktop.org>
Date: Thu, 03 Jul 2008 14:18:37 PDT

Hi!

I searched this forum (and the web) and I didn't find anything so I'm posting this question here:

I'm using the latest Glassfish v2 version and encountered a strange error while programming a rather small enterprise app. I was able to narrow it down and create a small example that suffers from the same error:

I have three entities (Saturn, Jupiter and Mars in this example), a Saturn has many Jupiters and each Jupiter has exactly one Mars. The code that inits and persists a Saturn looks like this:

        Saturn mysat = new Saturn();
        Mars m1 = new Mars();
        Jupiter j1 = new Jupiter();
        j1.setMars(m1);
        mysat.addJupiter(j1);
        em.persist(mysat);

as soon as this is executed (in my case via a small Servlet) I get a very long stack trace with this error seeming to be the core exception:

java.lang.NoSuchMethodError: com.nightspawn.pg.entities.Jupiter._toplink_setmars(Lcom/nightspawn/pg/entities/Mars;)V

Has anyone encountered an error like this before, and if so do you have any pointers on how to fix this?

You can find the entities' source in a .zip file attached to this post.

Thanks in advance for anyone trying to help me, I'm at a total loss here...
[Message sent by forum member 'nsn' (nsn)]

http://forums.java.net/jive/thread.jspa?messageID=284270