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 Marc Kannegiesser <ma...@gmx.de> on 2007/09/14 13:36:41 UTC

Torque Maven2 Plugin and idBroker

Hi Everyone. 

I am currently porting the built-process of an application from Maven1 to Maven 2. 

We used the maven-torque-plugin and - of course - we are planning to use the maven2 MOJO-Based version now. This works quite well already but I'm currently having some problems with the IDBroker feature. 
For maven1 there was a goal named torque:id-table-init-sql to init the ID-Broker table. This goal is missing in the maven2 version and I am wondering how to realize that the corresponding table gets created correctly.

The only thing I could find was the config-option of the torque:sql goal named idTableXmlFile which I alrady set. 

But this seems to be ignored and I am wondering if i need any additional (undocumented) parameters or even an additional plugin?

My configuration in the pom.xml file:

<plugin>
  <groupId>org.apache.db.torque</groupId>
  <artifactId>torque-maven-plugin</artifactId>
  <version>3.3-RC2</version>
  <configuration>
    <url>jdbc:mysql://localhost/minos</url>
    <reportFile>report.${project.artifact.artifactId}.sql.generation</reportFi                     
    <runOnlyOnSchemaChange>false</runOnlyOnSchemaChange>
    <targetDatabase>mysql</targetDatabase>
    <schemaDir>${basedir}/src/torque-schemas</schemaDir>
    <templatePath>${basedir}/src/torque-templates</templatePath>
    <driver>org.gjt.mm.mysql.Driver</driver>
    <user>root</user>
    <password></password>
    <schemaIncludes>*schema.xml</schemaIncludes>
    <schemaExcludes>id-table-schema.xml</schemaExcludes>
    <targetPackage>com.synyx.minos.om</targetPackage>
    <idTableXmlFile>id-table-schema.xml</idTableXmlFile>
  </configuration>
  <dependencies>
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>3.1.12</version>
      <type>jar</type>
    </dependency>
  </dependencies>
  <executions>
    <execution>
      <id>Creating .sql files</id>
      <phase>process-resources</phase>
      <goals>
         <goal>sql</goal>
      </goals>
    </execution>
    <execution>
      <id>OM Goal (Generating Classes, Beans, ...)</id>
      <phase>process-resources</phase>
      <goals>
        <goal>om</goal>
      </goals>
      <configuration>
        <enableJava5Features>true</enableJava5Features>
        <complexObjectModel>true</complexObjectModel>
        <generateBeans>true</generateBeans>
        <beanSuffix>Bean</beanSuffix>
      </configuration>
    </execution>
    <execution>
      <id>Fire sql to the database!!!</id>
      <phase>process-resources</phase>
      <goals>
         <goal>sqlExec</goal>
      </goals>
    </execution>
  </executions>
</plugin>

With the maven1 plugin in the sql goal files like table-idbroker.sql were generated and executed during the insert-sql goal. This seems not to be happening with the maven2 plugin. 

Hopefully anybody can help me and tell me what I forgot ;)

Thanks in advance, 


Marc

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


RE: Torque Maven2 Plugin and idBroker

Posted by Thomas Fischer <fi...@seitenbau.net>.
"Marc Kannegiesser" <ma...@gmx.de> schrieb am 14.09.2007
14:40:02:

> Hi.
>
> Thanks in advance for your fast answer, Thomas.
>
> > The goal id-table-init-sql does not exist in the maven2 plugin; I'd
> > consider it a missing feature (please add a feature request to jira).
If I
> > understand you correctly, the sql file gets created, and the problem is
to
> > execute it ? If this is the case, then the sqlExec goal would be the
>
> No, thats not quite correct. What I ment that with the maven1 version of
the
> plugin the id-table-init-sql goal created a .sql-file for each schemafile

> (where the idbroker is defined using defaultIdMethod="idbroker" ) which
then
> was executed within the torque:insert-sql goal.
> These files contained the initialisation of the IDBroker table
> e.g. lines like:
>
> insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES
> (5101, 'poll', 1000, 10);
>
> Neither the creation of the .sql files nor the creation of the ID_TABLE
is not
> at all using the maven2 plugin.
>

Ok the problem is to insert the initial data. I'm afraid that it is
probably a missing feature:-( Please submit a jira issue. For the meantime,
I hope you can create a workaround, possibly using the antrun plugin and
the torque ant task.

> > correct goal; however, it executes all sql file in a single directory
(I'm
> > not sure whether this is what you want).
> > Maybe you can run the sql goal twice, once for creating the normal sql,
> > and
> > the second time creating the sql file for the id broker ?
>
> I think the ID_TABLE gets created on a different way (at least not
somehow explicit).
> I am wondering why there is a option to set the schemafile for the
> IDBrokertable and this feature is not used in any way.

The underlying ant task needs this property, no idea what it does. I would
have to look in the source code.

> ...

   Hope this helps,

     Thomas


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


Re: RE: Torque Maven2 Plugin and idBroker

Posted by Marc Kannegiesser <ma...@gmx.de>.
Hi. 

Thanks in advance for your fast answer, Thomas. 

> The goal id-table-init-sql does not exist in the maven2 plugin; I'd
> consider it a missing feature (please add a feature request to jira). If I
> understand you correctly, the sql file gets created, and the problem is to
> execute it ? If this is the case, then the sqlExec goal would be the

No, thats not quite correct. What I ment that with the maven1 version of the plugin the id-table-init-sql goal created a .sql-file for each schemafile (where the idbroker is defined using defaultIdMethod="idbroker" ) which then was executed within the torque:insert-sql goal.
These files contained the initialisation of the IDBroker table
e.g. lines like:

insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES (5101, 'poll', 1000, 10);

Neither the creation of the .sql files nor the creation of the ID_TABLE is not at all using the maven2 plugin. 

> correct goal; however, it executes all sql file in a single directory (I'm
> not sure whether this is what you want).
> Maybe you can run the sql goal twice, once for creating the normal sql,
> and
> the second time creating the sql file for the id broker ?

I think the ID_TABLE gets created on a different way (at least not somehow explicit).
I am wondering why there is a option to set the schemafile for the IDBrokertable and this feature is not used in any way.

I can create the sql for the ID_TABLE by setting something like:
<schemaExcludes>foobarhuar.doesnotexist</schemaExcludes> (because the defaultvalue for schemaExcludes seems to be id-table-schema.xml (what is the name of my id-table schema).

This creates the ID_TABLE for me (in the torque:sqlExec goal) but it does not initialize the table, because the files mentioned above are missing.


Thanks for your help,


Marc
> 
>     Thomas
> 
> "Marc Kannegiesser" <ma...@gmx.de> schrieb am 14.09.2007
> 13:36:41:
> 
> > Hi Everyone.
> >
> > I am currently porting the built-process of an application from Maven1
> to
> Maven 2.
> >
> > We used the maven-torque-plugin and - of course - we are planning to use
> the
> > maven2 MOJO-Based version now. This works quite well already but I'm
> currently
> > having some problems with the IDBroker feature.
> > For maven1 there was a goal named torque:id-table-init-sql to init the
> ID-
> > Broker table. This goal is missing in the maven2 version and I am
> wondering
> > how to realize that the corresponding table gets created correctly.
> >
> > The only thing I could find was the config-option of the torque:sql goal
> named
> > idTableXmlFile which I alrady set.
> >
> > But this seems to be ignored and I am wondering if i need any additional
> > (undocumented) parameters or even an additional plugin?
> >
> > My configuration in the pom.xml file:
> >
> > <plugin>
> >   <groupId>org.apache.db.torque</groupId>
> >   <artifactId>torque-maven-plugin</artifactId>
> >   <version>3.3-RC2</version>
> >   <configuration>
> >     <url>jdbc:mysql://localhost/minos</url>
> >
> <reportFile>report.${project.artifact.artifactId}.sql.generation</reportFi
> 
> >     <runOnlyOnSchemaChange>false</runOnlyOnSchemaChange>
> >     <targetDatabase>mysql</targetDatabase>
> >     <schemaDir>${basedir}/src/torque-schemas</schemaDir>
> >     <templatePath>${basedir}/src/torque-templates</templatePath>
> >     <driver>org.gjt.mm.mysql.Driver</driver>
> >     <user>root</user>
> >     <password></password>
> >     <schemaIncludes>*schema.xml</schemaIncludes>
> >     <schemaExcludes>id-table-schema.xml</schemaExcludes>
> >     <targetPackage>com.synyx.minos.om</targetPackage>
> >     <idTableXmlFile>id-table-schema.xml</idTableXmlFile>
> >   </configuration>
> >   <dependencies>
> >     <dependency>
> >       <groupId>mysql</groupId>
> >       <artifactId>mysql-connector-java</artifactId>
> >       <version>3.1.12</version>
> >       <type>jar</type>
> >     </dependency>
> >   </dependencies>
> >   <executions>
> >     <execution>
> >       <id>Creating .sql files</id>
> >       <phase>process-resources</phase>
> >       <goals>
> >          <goal>sql</goal>
> >       </goals>
> >     </execution>
> >     <execution>
> >       <id>OM Goal (Generating Classes, Beans, ...)</id>
> >       <phase>process-resources</phase>
> >       <goals>
> >         <goal>om</goal>
> >       </goals>
> >       <configuration>
> >         <enableJava5Features>true</enableJava5Features>
> >         <complexObjectModel>true</complexObjectModel>
> >         <generateBeans>true</generateBeans>
> >         <beanSuffix>Bean</beanSuffix>
> >       </configuration>
> >     </execution>
> >     <execution>
> >       <id>Fire sql to the database!!!</id>
> >       <phase>process-resources</phase>
> >       <goals>
> >          <goal>sqlExec</goal>
> >       </goals>
> >     </execution>
> >   </executions>
> > </plugin>
> >
> > With the maven1 plugin in the sql goal files like table-idbroker.sql
> were
> 
> > generated and executed during the insert-sql goal. This seems not to be
> > happening with the maven2 plugin.
> >
> > Hopefully anybody can help me and tell me what I forgot ;)
> >
> > Thanks in advance,
> >
> >
> > Marc
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: torque-user-help@db.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org

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


RE: Torque Maven2 Plugin and idBroker

Posted by Thomas Fischer <fi...@seitenbau.net>.
The goal id-table-init-sql does not exist in the maven2 plugin; I'd
consider it a missing feature (please add a feature request to jira). If I
understand you correctly, the sql file gets created, and the problem is to
execute it ? If this is the case, then the sqlExec goal would be the
correct goal; however, it executes all sql file in a single directory (I'm
not sure whether this is what you want).
Maybe you can run the sql goal twice, once for creating the normal sql, and
the second time creating the sql file for the id broker ?

    Thomas

"Marc Kannegiesser" <ma...@gmx.de> schrieb am 14.09.2007
13:36:41:

> Hi Everyone.
>
> I am currently porting the built-process of an application from Maven1 to
Maven 2.
>
> We used the maven-torque-plugin and - of course - we are planning to use
the
> maven2 MOJO-Based version now. This works quite well already but I'm
currently
> having some problems with the IDBroker feature.
> For maven1 there was a goal named torque:id-table-init-sql to init the
ID-
> Broker table. This goal is missing in the maven2 version and I am
wondering
> how to realize that the corresponding table gets created correctly.
>
> The only thing I could find was the config-option of the torque:sql goal
named
> idTableXmlFile which I alrady set.
>
> But this seems to be ignored and I am wondering if i need any additional
> (undocumented) parameters or even an additional plugin?
>
> My configuration in the pom.xml file:
>
> <plugin>
>   <groupId>org.apache.db.torque</groupId>
>   <artifactId>torque-maven-plugin</artifactId>
>   <version>3.3-RC2</version>
>   <configuration>
>     <url>jdbc:mysql://localhost/minos</url>
>
<reportFile>report.${project.artifact.artifactId}.sql.generation</reportFi

>     <runOnlyOnSchemaChange>false</runOnlyOnSchemaChange>
>     <targetDatabase>mysql</targetDatabase>
>     <schemaDir>${basedir}/src/torque-schemas</schemaDir>
>     <templatePath>${basedir}/src/torque-templates</templatePath>
>     <driver>org.gjt.mm.mysql.Driver</driver>
>     <user>root</user>
>     <password></password>
>     <schemaIncludes>*schema.xml</schemaIncludes>
>     <schemaExcludes>id-table-schema.xml</schemaExcludes>
>     <targetPackage>com.synyx.minos.om</targetPackage>
>     <idTableXmlFile>id-table-schema.xml</idTableXmlFile>
>   </configuration>
>   <dependencies>
>     <dependency>
>       <groupId>mysql</groupId>
>       <artifactId>mysql-connector-java</artifactId>
>       <version>3.1.12</version>
>       <type>jar</type>
>     </dependency>
>   </dependencies>
>   <executions>
>     <execution>
>       <id>Creating .sql files</id>
>       <phase>process-resources</phase>
>       <goals>
>          <goal>sql</goal>
>       </goals>
>     </execution>
>     <execution>
>       <id>OM Goal (Generating Classes, Beans, ...)</id>
>       <phase>process-resources</phase>
>       <goals>
>         <goal>om</goal>
>       </goals>
>       <configuration>
>         <enableJava5Features>true</enableJava5Features>
>         <complexObjectModel>true</complexObjectModel>
>         <generateBeans>true</generateBeans>
>         <beanSuffix>Bean</beanSuffix>
>       </configuration>
>     </execution>
>     <execution>
>       <id>Fire sql to the database!!!</id>
>       <phase>process-resources</phase>
>       <goals>
>          <goal>sqlExec</goal>
>       </goals>
>     </execution>
>   </executions>
> </plugin>
>
> With the maven1 plugin in the sql goal files like table-idbroker.sql were

> generated and executed during the insert-sql goal. This seems not to be
> happening with the maven2 plugin.
>
> Hopefully anybody can help me and tell me what I forgot ;)
>
> Thanks in advance,
>
>
> Marc
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>


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