You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Bernhard Daubner <be...@googlemail.com> on 2007/09/26 22:03:37 UTC

O/R-Mapping with Torque 3.3-RC2 and Maven 2.0.7

Hello!

I am trying to implement a simple database application using Torque as
O/R-Mapper. I followed the instructions within the "Torque-Tutorial"
(http://db.apache.org/torque/releases/torque-3.3/tutorial/index.html)
and modified them to work with maven2.

So far the torque-maven-plugin goals "torque:om", "torque:sql" and
"torque:sqlExec" work as expected.

But now I struggle with the compilation of the persistence classes.
The java files are created within the folders
- src/main/generated-java  and
- target/generated-sources/torque ,
while my application code resides in
- src/main/java

How do I tell maven that it has to look at several source folders? Do
I have to use the "Build Helper Maven Plugin"
(http://mojo.codehaus.org/build-helper-maven-plugin)?

Has someone a complete pom.xml showing not only the configuration of
the torque plugin but also the configuration of a project using
Torque-O/R-Mapping? I looked at the sources of the
torque-maven-plugin. But also within the unit tests there was no such
example.

And what about Eclipse? Is there a way to automatically create the
corresponding Eclipse .classpath file for the several source folders?
I don`t believe that the eclipse plugin is able to do this job.

And finally I wonder how the dataXmlFiles for the "torque:datasql"
goal has to be defined. Is there an example for such a file?

Thanks in advance

Bernhard

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: O/R-Mapping with Torque 3.3-RC2 and Maven 2.0.7

Posted by Bernhard Daubner <be...@googlemail.com>.
Thank you for your response!

2007/9/27, Thomas Fischer <tf...@apache.org>:
> On Wed, 26 Sep 2007, Bernhard Daubner wrote:
>
> > How do I tell maven that it has to look at several source folders? Do
> > I have to use the "Build Helper Maven Plugin"
> > (http://mojo.codehaus.org/build-helper-maven-plugin)?
>
> The torque plugin tells maven which additional paths to use; no need to
> worry about that. Just try mvn compile and see what it does (by the way,
> this also generates the om classes if you have configured the
> torque-maven-plugin's om goal in the pom)

This was the point. I have not configured the torque goals within the
pom, but executed the goals manually. With the goals configured the
computation of the classpath and also the eclipse-plugin worked.

>
> > And finally I wonder how the dataXmlFiles for the "torque:datasql"
> > goal has to be defined. Is there an example for such a file?
> >
>
> Again, the dataxml config parameters are described in
> http://db.apache.org/torque/releases/torque-3.3/maven2-plugin/plugin-info.html
> If that is not enough: A very complicated example is in the test project's
> pom:
>
> http://svn.apache.org/viewvc/db/torque/test/trunk/test-project/pom.xml
>
> but it might help you to figure out which config parameters are needed.
>

Maybe I interpreted something in the wrong way. I thought the
torque:datasql plugin is intended to fill data items (i.e. table rows)
into the database tables and the data items would be defined within a
data.xml file. But it seems it would only create sql commands for the
table definitions. But what is then the difference between the
torque:sql goal and the torque:datasql goal?

Best regards
Bernhard

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: O/R-Mapping with Torque 3.3-RC2 and Maven 2.0.7

Posted by Thomas Fischer <tf...@apache.org>.
On Wed, 26 Sep 2007, Bernhard Daubner wrote:

> Hello!
>
> I am trying to implement a simple database application using Torque as
> O/R-Mapper. I followed the instructions within the "Torque-Tutorial"
> (http://db.apache.org/torque/releases/torque-3.3/tutorial/index.html)
> and modified them to work with maven2.
>
> So far the torque-maven-plugin goals "torque:om", "torque:sql" and
> "torque:sqlExec" work as expected.
>
> But now I struggle with the compilation of the persistence classes.
> The java files are created within the folders
> - src/main/generated-java  and
> - target/generated-sources/torque ,
> while my application code resides in
> - src/main/java
>
> How do I tell maven that it has to look at several source folders? Do
> I have to use the "Build Helper Maven Plugin"
> (http://mojo.codehaus.org/build-helper-maven-plugin)?

The torque plugin tells maven which additional paths to use; no need to 
worry about that. Just try mvn compile and see what it does (by the way, 
this also generates the om classes if you have configured the 
torque-maven-plugin's om goal in the pom)

> Has someone a complete pom.xml showing not only the configuration of
> the torque plugin but also the configuration of a project using
> Torque-O/R-Mapping? I looked at the sources of the
> torque-maven-plugin. But also within the unit tests there was no such
> example.
>
Its really simple, just add the torque plugin as a plugin and configure it
as described in
http://db.apache.org/torque/releases/torque-3.3/maven2-plugin/plugin-info.html
If you still have problems, re-write to the list, I have a simple example 
at work.

>
> And what about Eclipse? Is there a way to automatically create the
> corresponding Eclipse .classpath file for the several source folders?
> I don`t believe that the eclipse plugin is able to do this job.

Believe it or not, but it works :-) Did you try it ?

> And finally I wonder how the dataXmlFiles for the "torque:datasql"
> goal has to be defined. Is there an example for such a file?
>

Again, the dataxml config parameters are described in
http://db.apache.org/torque/releases/torque-3.3/maven2-plugin/plugin-info.html
If that is not enough: A very complicated example is in the test project's 
pom:

http://svn.apache.org/viewvc/db/torque/test/trunk/test-project/pom.xml

but it might help you to figure out which config parameters are needed.

     Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org