openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Dick" <>
Subject Re: openjpac Ant task
Date Fri, 14 Dec 2007 10:05:36 GMT
Hi Dan,

Enhancement is not database specific. The PCEnhancer ant task requires a
configuration to be specified and one of the convenient ways to do so is to
use persistence.xml. The PCEnahncer task should be able to handle a missing
configuration file, but unfortunately it doesn't at this time.

You can work around the problem by specifying a different configuration file
when you run the enhancer. Something like this should work :

    <taskdef name="enhance" classname="org.apache.openjpa.ant.PCEnhancerTask
            <path refid="jpa.provider.cp"/>

    <target name="enhance">
            <!-- <config
            <config propertiesFile="openjpa-dev.xml"/>
                <path refid="entity.cp"/>
                <path refid="jpa.used.cp"/>
            <fileset dir="${classes.location}">
                <include name="**/*.class"/>

contents of openjpa-dev.xml :
<?xml version="1.0"?>
<persistence xmlns=""
    <persistence-unit name="none"/>

I believe that will work for you., even though it is a bit kludgy. Would you
mind opening a JIRA issue at report the problem?

There are some configuration properties which do pertain to enhancement, for
example openjpa.DetachState so there are cases where a configuration is
desirable. The task should be able to handle the absence of one though, or
at least handle something like

    <target name="enhance">

If you don't override the defaults.

Hope this helps,

On Dec 13, 2007 10:34 PM, Daniel Dyer <> wrote:

> I've been using the runtime agent approach for enhancing my classes and
> now I would like to switch to build-time enhancement.
> I'd appreciate it if somebody could help me understand exactly what is
> required.
> What I would like to know is what does the openjpac Ant task need the
> persistence.xml for?  Is enhancement specific to the particular database
> that I am using?  There is apparently no other information in there that
> could be useful (I already specify which classes to look at by providing a
> fileset to the Ant task).
> My problem is that when I add the persistence.xml to the Ant task, it
> fails because I have specified the <jar-file> element and the JAR file it
> references does not exist yet (how can it? I have to enhance the classes
> before packaging them in a JAR).  If I don't provide the persistence.xml
> it fails because "MetaDataFactory could not be configured".  I suppose I
> could create a different persistence.xml just for this step, but is it
> necessary?
> Also, currently (with the runtime agent enhancement) I am using the same
> entity classes with 2 different databases (I use H2 for the unit tests and
> MySQL for the actual application).  If enhancement is database specific, I
> guess I can't do this with build-time enhancement (I would need 2 versions
> of the enhanced classes).
> Thanks for any insights you can give me,
> Dan.
> --
> Daniel Dyer

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message