On Wed, Sep 16, 2009 at 5:11 PM, C N Davies <[email protected]> wrote:
> Since I am generally using
> REFRESH when attaching entities, when I persist/merge an entity,
I don't want to derail the thread, but why are you using REFRESH? (For the
most part I'm not using CascadeType.XXXX anywhere until I get a better feel
for these "automatic" operations.) I believe an object has to be managed to
refresh, no? That means you need to find() with the same em that you
persist()/merge() with. I generally find()/query in one em, then
merge/persist in another.
What I found before
> was that if one of those references was pointing to an entity that longer
> existed in the DB
>
I would have considered this as a possibility with the production crash but
my development crash was very simple soI don't think this is my case, but
I'll play with it anyway.
I also noticed that if I attach a null entity to my main entity, this null
> entity ends up being non-null inside the OpenJPA code
It seems like I have the opposite: I have an existing, non-null, detached
entity where it thinks the entity is new - like the ID is null when it isn't
(or shouldn't be).
>
> Regarding the Ant script, I am using eclipse and exported my project out to
> an ANT build file, I can hack that into shape if you can send me your
> enhancement step I am happy to stick it in and give it a shot.
>
Wow, that's hard-core! I just use Eclipse to build with a build step from
Ant. Anyway, here's the interesting part. The biggest trouble I had was with
the class path. This version fails now with 1.2.1 due to me using enums. If
it fails on an enum, let me know and I'll give you a different version. You
need to set the paths, of course.
<?xml version="1.0"?>
<project name="Build" default="Enhance" basedir=".">
<taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask"/>
<target name="Enhance">
<openjpac>
<classpath path="${classes}" />
<classpath path="${lib}/other_stuff.jar" />
<config propertiesFile="${src}/META-INF/persistence.xml"
connectionUserName="postgres"
connectionPassword=""
connectionURL="jdbc:postgresql://localhost/mydb"
connectionDriverName="org.postgresql.Driver" />
<fileset dir=".">
<include name="**/model/*.java" />
</fileset>
</openjpac>
</target>
</project>
--
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:[email protected]