Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Weaving (static and dynamic)

585384Jun 27 2007 — edited Jun 28 2007
I'm having a lot of difficulty setting up weaving (for entities with OneToOne lazy load relationships). I have searched all day on forums here and else where but to no avail on how to get this correctly setup.

I am using Netbeans 5.5.1 for a standalone Java SE desktop applications, with JPA and toplink for the database access. This is what I have tried so far:

1) Dynamically weaving using the <property name="toplink.weaving" value = "true" /> in the persistence.xml file and the "-javaagent:C:\libs\toplink-essentials-agent.jar" as the VM option at runtime. When doing this, the program begins but as soon as something is done to query an entity with a OneToOne relationship, an exception is thrown because methods on the "woven" entities are not found. It appears that the entity's methods are changed in one place but not in another perhaps?

However, I would really like to statically weave these entities since ultimately deployment will be done using Java WebStart. I have tried to create an ant script to do this in the netbeans project build.xml file. This is what I have so far:

<target name="define.task" description="New task definition for toplink static weaving">
<taskdef name="weave" classname="oracle.toplink.essentials.weaving.StaticWeaveAntTask"
classpath="libs/toplink-essentials.jar"/>
</target>
<target name="weaving" description="perform weaving" depends="define.task">
<weave source="C:/JavaDev/projectName/dist/projectName.jar"
target="C:/JavaDev/projectName/dist/projectName1.jar"

loglevel="FINER">
<classpath>
<pathelement path="C:/JavaDev/projectName/libs/toplink-essentials.jar"/>
</classpath>
</weave>
</target>

(I am working of an example from an Oracle page.) The problems that I am running into with this are as follows:
1) I don't really know what I am supposed to put in the <classpath> tag.
2) When I run this through Netbeans (right click -> Run Target) it tries to run but at the first entity that it tries to weave none of the annotations appear to be recognized because it complains about the entity not having an @Id, etc.

I am REALLY stumped on this and have spent a lot of time. Any help in regards to setting up static weaving with a Netbeans project would be GREATLY appreciated.
Thanks in advance!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 26 2007
Added on Jun 27 2007
4 comments
875 views