You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Jean-Baptiste BRIAUD -- Novlog <j-...@novlog.com> on 2010/08/10 16:55:30 UTC

Enhancing with Eclipse

Hi,

I'm trying to set an OpenJPA project with Eclipse (I'm currently using IntelliJ).

I checked that page :
http://openjpa.apache.org/enhancement-with-eclipse.html
and decided to go with custom Ant builder.

Where is the persistent.xml file ?
Unfortunately, the file is not mentioned in the example gray zone.

I used to have several persistent.xml files : one for build-time enhancing and another slightly different one as runtime-time config.
How can I manage that ?


Thanks !

Re: Enhancing with Eclipse

Posted by Jean-Baptiste BRIAUD -- Novlog <j-...@novlog.com>.
On 10 août 2010, at 18:16, Rick Curtis wrote:

>> bin is managed by Eclipse : src/META-INF should be OK if I manage to have
> only one persistence.xml file.
> Correct. Eclipse will automatically move src/META-INF to bin.
> 
>> Very good idea, but how to tell openjpac with persistence unit to use ??
> I think you can try something like "-p #[pu_name]". ... I'm not sure how
> nicely that'll play with the eclipse ant configuration, but you should be
> able to get it to work.
> 
> http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_conf_devtools
> 

I don't find the answer in the doc nor in the source code of PCEnhancerTask.
Basically, I'm not able to choose the persistence unit from ant task for the build-time enhancer.

The "-p #[pu_name]" stuff is from the command line, not from ant.

Exploring the source code of PCEnhancerTask doesn't helped me.
I'm not sure but it might confirmed it is just not possible :

    protected ConfigurationImpl newConfiguration() {
        return new OpenJPAConfigurationImpl();
    }

No persistence unit as a parameter ?
On the other hand, this method doesn't appears to be called :
What is that getConfiguration() method ?
Can't find it in the class, so it must be from superclass witch is from Ant, so no possibility to pass the persistence unit ?

    protected void executeOn(String[] files)
        throws IOException {
        flags.directory = (dirName == null) ? null
            : Files.getFile(dirName, getClassLoader());
        OpenJPAConfiguration conf = (OpenJPAConfiguration) getConfiguration();
        MetaDataRepository repos = conf.newMetaDataRepositoryInstance();
        PCEnhancer.run(conf, files, flags, repos, null, getClassLoader ());
	}

Any idea ? I'm totally in the dark ...


Re: Enhancing with Eclipse

Posted by Rick Curtis <cu...@gmail.com>.
> bin is managed by Eclipse : src/META-INF should be OK if I manage to have
only one persistence.xml file.
Correct. Eclipse will automatically move src/META-INF to bin.

> Very good idea, but how to tell openjpac with persistence unit to use ??
I think you can try something like "-p #[pu_name]". ... I'm not sure how
nicely that'll play with the eclipse ant configuration, but you should be
able to get it to work.

http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_conf_devtools

Thanks,
Rick

On Tue, Aug 10, 2010 at 11:04 AM, Jean-Baptiste BRIAUD -- Novlog <
j-b.briaud@novlog.com> wrote:

>
> On 10 août 2010, at 17:19, Rick Curtis wrote:
>
> >> Where is the persistent.xml file ?
> > It needs be in bin/META-INF.
> >
>
> bin is managed by Eclipse : src/META-INF should be OK if I manage to have
> only one persistence.xml file.
>
> >> I used to have several persistent.xml files : one for build-time
> enhancing
> > and another slightly different one as runtime-time config. How can I
> manage
> > that ?
> > I'd think you could get away with a single persistence.xml file but with
> two
> > different persistence units. One for the buildtime enhancement and the
> other
> > to be used at runtime.
>
> Very good idea, but how to tell openjpac with persistence unit to use ??
>
> >
> > Thanks,
> > Rick
> >
> > On Tue, Aug 10, 2010 at 9:55 AM, Jean-Baptiste BRIAUD -- Novlog <
> > j-b.briaud@novlog.com> wrote:
> >
> >> Hi,
> >>
> >> I'm trying to set an OpenJPA project with Eclipse (I'm currently using
> >> IntelliJ).
> >>
> >> I checked that page :
> >> http://openjpa.apache.org/enhancement-with-eclipse.html
> >> and decided to go with custom Ant builder.
> >>
> >> Where is the persistent.xml file ?
> >> Unfortunately, the file is not mentioned in the example gray zone.
> >>
> >> I used to have several persistent.xml files : one for build-time
> enhancing
> >> and another slightly different one as runtime-time config.
> >> How can I manage that ?
> >>
> >>
> >> Thanks !
>
>

Re: Enhancing with Eclipse

Posted by Jean-Baptiste BRIAUD -- Novlog <j-...@novlog.com>.
On 10 août 2010, at 17:19, Rick Curtis wrote:

>> Where is the persistent.xml file ?
> It needs be in bin/META-INF.
> 

bin is managed by Eclipse : src/META-INF should be OK if I manage to have only one persistence.xml file.

>> I used to have several persistent.xml files : one for build-time enhancing
> and another slightly different one as runtime-time config. How can I manage
> that ?
> I'd think you could get away with a single persistence.xml file but with two
> different persistence units. One for the buildtime enhancement and the other
> to be used at runtime.

Very good idea, but how to tell openjpac with persistence unit to use ??

> 
> Thanks,
> Rick
> 
> On Tue, Aug 10, 2010 at 9:55 AM, Jean-Baptiste BRIAUD -- Novlog <
> j-b.briaud@novlog.com> wrote:
> 
>> Hi,
>> 
>> I'm trying to set an OpenJPA project with Eclipse (I'm currently using
>> IntelliJ).
>> 
>> I checked that page :
>> http://openjpa.apache.org/enhancement-with-eclipse.html
>> and decided to go with custom Ant builder.
>> 
>> Where is the persistent.xml file ?
>> Unfortunately, the file is not mentioned in the example gray zone.
>> 
>> I used to have several persistent.xml files : one for build-time enhancing
>> and another slightly different one as runtime-time config.
>> How can I manage that ?
>> 
>> 
>> Thanks !


Re: Enhancing with Eclipse

Posted by Rick Curtis <cu...@gmail.com>.
> Where is the persistent.xml file ?
It needs be in bin/META-INF.

> I used to have several persistent.xml files : one for build-time enhancing
and another slightly different one as runtime-time config. How can I manage
that ?
I'd think you could get away with a single persistence.xml file but with two
different persistence units. One for the buildtime enhancement and the other
to be used at runtime.

Thanks,
Rick

On Tue, Aug 10, 2010 at 9:55 AM, Jean-Baptiste BRIAUD -- Novlog <
j-b.briaud@novlog.com> wrote:

> Hi,
>
> I'm trying to set an OpenJPA project with Eclipse (I'm currently using
> IntelliJ).
>
> I checked that page :
> http://openjpa.apache.org/enhancement-with-eclipse.html
> and decided to go with custom Ant builder.
>
> Where is the persistent.xml file ?
> Unfortunately, the file is not mentioned in the example gray zone.
>
> I used to have several persistent.xml files : one for build-time enhancing
> and another slightly different one as runtime-time config.
> How can I manage that ?
>
>
> Thanks !