openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Baptiste BRIAUD -- Novlog <>
Subject Re: After statting the server login time taking 2 minutes
Date Tue, 27 Apr 2010 09:22:59 GMT
Enhance at buildtime.

Enhancing at runtime might be OK to start learning as it quicker to start coding but it comes
with lots of problems and limitations.

I would say enhancing at build time is not an option for any serious developments.
Finally, enhancing at build time is only a matter of one simple ant task, so there are no
excuse :-)

You can use that macrodef I setup for my project :
macrodef is really (really really) powerfull ant concept.

    <macrodef name="enhance"
              description="This will enhance annotated Java entity classes.">

        <attribute name="class-dir"
                   description="The class folder where to find .class file annotated and enhanced
using OpenJPA"/>
        <attribute name="persistence-xml-file" description="The full path to the persistence.xml
        <attribute name="lib-dir"
                   description="Folder where to find /openjpa and /jpa folders that contains
all the .jar"/>

            <taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask">
                    <fileset dir="@{lib-dir}">
                        <include name="**/*.jar"/>
                    <pathelement location="@{class-dir}"/>
                <config propertiesFile="@{persistence-xml-file}"/>
                    <fileset dir="@{lib-dir}">
                        <include name="**/*.jar"/>
                    <pathelement location="@{class-dir}"/>
            <mkdir dir="@{class-dir}/META-INF"/>
            <copy todir="@{class-dir}/META-INF" description="Copy persistence.xml to META-INF"
                <fileset file="@{persistence-xml-file}"/>

To use that macro :

    <target name="enhance-build">
        <echo message="Enhancing build ..."/>
        <enhance class-dir="${build-class-dir}" persistence-xml-file="${persistence-xml-file}"
        <echo message="Enhancing build complete."/>

Hope this helps.

On Apr 27, 2010, at 06:14 , SreeAsh wrote:

> Hi Ravi,
>        thanks for reply...
>      At runtime, i am not done any enhance my application, by default it's
> enhancing at run time.Please suggest the is its right or we need to do any
> enhancer before deploy.
> regards
> Srini
> -- 
> View this message in context:
> Sent from the OpenJPA Users mailing list archive at

View raw message