RE: [torrque-maven-plugin] Colliding parameters for different goals.

2009-11-11 Thread Ludwig Magnusson
Thank you for the link.
It cleared up a lot for me.
The project now works as I want.
/Ludwig

-Original Message-
From: Thomas Fischer [mailto:fisc...@seitenbau.net] 
Sent: den 10 november 2009 11:40
To: Apache Torque Users List
Subject: RE: [torrque-maven-plugin] Colliding parameters for different
goals.

Oops- sorry. My example was wrong, did not look careful enough. These tags
were meant to be id /tags. The phase should be generate-sources. So it
should read:

   execution
 idgenerate-om/id
 phasegenerate-sources/id
 goals
   goalom/goal
   goalsql/goal
 /goals
   /execution

and the same for the following execution definitions.

There are more phases than you think. See the list at the bottom of
http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.ht
ml
for the available phases.

Thomas

 RE: [torrque-maven-plugin] Colliding parameters for different goals.

 Then I was mislead by the maven documentation.
 I thought the only valid values for phase/ were clean, compile, test,
 build, install, verify.

 But the phases generate-om and generate-sql are defined in torque?
 Are there any documentation on what phases there are in torque?
 I can't find it on the plugin page.
 /Ludwig


 -Original Message-
 From: Thomas Fischer [mailto:fisc...@seitenbau.net]
 Sent: den 10 november 2009 11:06
 To: Apache Torque Users List
 Subject: RE: [torrque-maven-plugin] Colliding parameters for different
 goals.

  I have encountered a problem running the M2 plugin for torque. The
goals
 I
  run are basically om, sql and sqlExec. There are a lot of parameters
that
  can be specified for these goals so I do it in my projects pom.xml.
 However,
  all these three goals have some parameters that have the same name, e.g
 the
  outputDir parameter. For om, I want this to point to my source
directory,
  for sql I want another directory where the sql-file will be generated.
 But
  Maven2 is limited here and it is not possible to map different values
for
  the same parameter to different goals.

 This is not true. You need to define more than one execution.
 In principle, you have the following options:

 1) use the same configuration for all goals (this is what you currently
do)
   plugin
 groupIdorg.apache.torque/groupId
 artifactIdtorque-maven-plugin/artifactId
 version3.3/version
 configuration
   ...
 /configuration
 executions
   execution
 phasegenerate-om/phase
 goals
   goalom/goal
   goalsql/goal
 /goals
   /execution
 /executions
   /plugin
 2) define different executions, and define the complete configuration for
 each execution
   plugin
 groupIdorg.apache.torque/groupId
 artifactIdtorque-maven-plugin/artifactId
 version3.3/version
 executions
   execution
 phasegenerate-om/phase
 goals
   goalom/goal
 /goals
 configuration
   ...
 /configuration
   /execution
   execution
 phasegenerate-sql/phase
 goals
   goalsql/goal
 /goals
 configuration
   ...
 /configuration
   /execution
 /executions
   /plugin
 The following does not work:
 3) Define some parameters for all executions and some for a specific
 execution
   plugin
 groupIdorg.apache.torque/groupId
 artifactIdtorque-maven-plugin/artifactId
 version3.3/version
 configuration
   ...
 /configuration
 executions
   execution
 phasegenerate-om/phase
 goals
   goalom/goal
 /goals
 configuration
   ...
 /configuration
   /execution
   execution
 phasegenerate-sql/phase
 goals
   goalsql/goal
 /goals
 configuration
   ...
 /configuration
   /execution
 /executions
   /plugin

 As 1) does not meet your requiremets your only option is 2)

Thomas


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


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



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



Re: Criteria needs write permissions?

2009-11-11 Thread Thomas Fischer
The null ointer exception seems to come from reading the table or column
map. Can you put a breakpoint in SQLBuilder.java:497 and see whether the
table or the column cannot be found (and why it is not found)?

Thomas

 Ok so I was trying to make our site a little safer from sql injections,
 so I made a database connection that connects with a user that only has
 SELECT permissions. And edited Criteria like such

 public Criteria()
 {
 this(DEFAULT_CAPACITY);
 this.setDbName(readonlydatabase);
 }

 Now it seems to work for must things, but a couple queries fail with

 throws java.lang.Exception java.lang.NullPointerException
 at org.apache.torque.util.SQLBuilder.processOrderBy
(SQLBuilder.java:497)
 at
 org.apache.torque.util.SQLBuilder.buildQueryClause(SQLBuilder.java:302)
 at org.apache.torque.util.BasePeer.createQuery(BasePeer.java:730)

 This error disappears as soon as I let the criteria use a database
 connection with write privileges.
 I know the user that it connects with has select privileges on every
 public table in the database.

 Does criteria need update privileges to work or something?

 The query the criteria constructs work fine when I connect as the
 readonly user and run it manually.

 Any thoughts?

 Thanks

 --
 Sheldon Ross



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



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