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 Torsten Eberl <ne...@vstar.de> on 2004/04/07 18:57:51 UTC

Generation Problem with Maven

Hi,

I have a problem generating java classes with maven.

After I started the process with "maven torque" I will get the correct sql-file but instead
of java classes with the table names I get correctly looking files with the name of
an object. For instance 

org.apache.commons.jelly.expression.ConstantExpression@d5eb7[value=Base]Rbacrole.java

The correct name would be BaseRbacrole.java

I have the same problem with torque-gen-3.1 and yesterdays torque-gen-3.2-dev.
I'm using maven 1.0-rc2.

I guess the schema is correct, because it worked fine with ant.

Has anybody an idea what version conflict this might be?
Or could there something else be wrong?

Torsten


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


Re: JOIN vs WHERE

Posted by Andras Balogh <an...@reea.net>.
    Hello Alexandru,

    Torque does support join by using criteria.addJoin().
What is  not supported (as far as i know) to specify the join type 
(left, right etc.)
The Sql that is generated is something like:
select * from table1,table2 where table1.id= table2.other_id
    This will be interpreted by the Database as a inner join.

Best wishes,
Andras.

PS. Happy Easter!
 (Paste Fericit!:))


Alexandru Dovlecel wrote:

>Hi all,
>
>Question: does the Torque generate queries with JOIN??? Or when it cames to
>joining tables, it creates an where clause???
>
>AFAIK, if generating where clauses instead of joins, IT COULD LEAD to
>performance problems. Using JOIN is recommended instead of plain where
>clauses. Am I right? In case of large tables (lots of data), a couple of
>where clauses to join some tables would slow down the application quite
>allot.
>
>Pls correct me if I am wrong. Better to find out now that I am wrong than
>having wrong ideas in my mind.
>
>10q,
>Alex
>
>
>---------------------------------------------------------------------
>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: JOIN vs WHERE

Posted by Florian Fray <fl...@compuserve.de>.
Hi Alexandru,

Torque does neither support explicit inner joins in the form
JOIN x ON x.id = y.fk nor left nor right joins.
Im currently working on this feature.
I've done it two weeks ago for my company but I have to rewrite it before
contributing the code.
So if you can be patient for a few days ...

Happy Eastern to all of you.

F. Fray
Wuppertal, Germany

----- Original Message ----- 
From: "Alexandru Dovlecel" <al...@siemens.com>
To: "'Apache Torque Users List'" <to...@db.apache.org>
Sent: Friday, April 09, 2004 11:00 AM
Subject: JOIN vs WHERE


> Hi all,
>
> Question: does the Torque generate queries with JOIN??? Or when it cames
to
> joining tables, it creates an where clause???
>
> AFAIK, if generating where clauses instead of joins, IT COULD LEAD to
> performance problems. Using JOIN is recommended instead of plain where
> clauses. Am I right? In case of large tables (lots of data), a couple of
> where clauses to join some tables would slow down the application quite
> allot.
>
> Pls correct me if I am wrong. Better to find out now that I am wrong than
> having wrong ideas in my mind.
>
> 10q,
> Alex
>
>
> ---------------------------------------------------------------------
> 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: JOIN vs WHERE

Posted by Florin Vancea <fv...@maxiq.ro>.
(Hi Alex! How are you lately?)

Maybe it's a vendor-related issue. For example Oracle gets away very well
with WHERE (actually I cannot tell if there's a way to support JOIN, at
least not in older releases...)

IMHO, the DB should figure its way offering the same level of performance,
either when using JOIN or WHERE, as long as they are both supported in the
first place. But then maybe this is only common sense and not supported by
some standard I did not bother to read.

Florin

----- Original Message ----- 
From: "Alexandru Dovlecel" <al...@siemens.com>
To: "'Apache Torque Users List'" <to...@db.apache.org>
Sent: Friday, April 09, 2004 12:00 PM
Subject: JOIN vs WHERE


> Hi all,
>
> Question: does the Torque generate queries with JOIN??? Or when it cames
to
> joining tables, it creates an where clause???
>
> AFAIK, if generating where clauses instead of joins, IT COULD LEAD to
> performance problems. Using JOIN is recommended instead of plain where
> clauses. Am I right? In case of large tables (lots of data), a couple of
> where clauses to join some tables would slow down the application quite
> allot.
>
> Pls correct me if I am wrong. Better to find out now that I am wrong than
> having wrong ideas in my mind.
>
> 10q,
> Alex
>
>
> ---------------------------------------------------------------------
> 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


JOIN vs WHERE

Posted by Alexandru Dovlecel <al...@siemens.com>.
Hi all,

Question: does the Torque generate queries with JOIN??? Or when it cames to
joining tables, it creates an where clause???

AFAIK, if generating where clauses instead of joins, IT COULD LEAD to
performance problems. Using JOIN is recommended instead of plain where
clauses. Am I right? In case of large tables (lots of data), a couple of
where clauses to join some tables would slow down the application quite
allot.

Pls correct me if I am wrong. Better to find out now that I am wrong than
having wrong ideas in my mind.

10q,
Alex


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


RE: Problem with torque.addSaveMethod

Posted by Alexandru Dovlecel <al...@siemens.com>.
Hi,

> 1. create your own BaseObject class, which is NOT a subclass of
> org.apache.torque.om.BaseObject and does not contain the
> save() signatures.

I have tried but does not work. The BaseXYZ is done oki (only extending
my.base.Object), but the XYZ class is extending BaseXYZ (which is OKI) but
also states that implements the Persistent interface (OUCH) that (also)
defines the save method. So I can change the templates, but I don't know if
is going to work... because the Torque might cast some obj to Persistent :(.

> 2. extend org.apache.torque.om.BaseObject and implement these
> abstract methods as "do-nothing methods".
That would work for shure :))). And seems to be the most appropriate thing
to do in this circumstances. But my intent was to remove some extra methods
from the XYZ (so that when I use an autoComplete java editor like eclipse I
won't have to see the save method and who knows what other methods).


>
> so long
And thanks for all tha fish,
> Micha
Alex


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


RE: Problem with torque.addSaveMethod

Posted by netseeker <ne...@manskes.de>.
Hi,

i guess this is a inconsistency but there exists some possible
"workarounds":

1. create your own BaseObject class, which is NOT a subclass of
org.apache.torque.om.BaseObject and does not contain the save() signatures.
http://db.apache.org/torque/generator/schema-reference.html:
"Attribute: baseClass
The base class to use when generating the Object Model.
This class does not have to extend org.apache.torque.om.BaseObject"

2. extend org.apache.torque.om.BaseObject and implement these
abstract methods as "do-nothing methods".

With both soulutions you have to add the attribute "baseClass" to your
torque schema:
<database
	name="MY_DATABASE"
	baseClass="mypyackage.BaseObject"
	...
</database>

so long
Micha

PS.: It's just a suggestion - i didn't test if this really will work.


> -----Original Message-----
> From: Alexandru Dovlecel [mailto:alexandru.dovlecel@siemens.com]
> Sent: Thursday, April 08, 2004 10:18 AM
> To: 'Apache Torque Users List'
> Subject: Problem with torque.addSaveMethod
>
>
> Hi all,
>
> I am trying to clean the model generated by torque (don't want to have
> myobj.save, myobj.insert and so on, Peer classes are just enough for me).
> How can I achieve this.
>
> I have tried setting
> addSaveMethod = false
> complexObjectModel = false
>
> It really generates cleaner code (only POJO), but... they are not
> compilable
> :(((. Because the BaseMyObj extends the BaseObject, which defines three
> abstract methods: save(...) x 3.
>
> Is this a problem with the Torque generator or I want to do something that
> torque is not supposed to support? Or, am I doing something wrong???
>
> Pls help. Thanks,
> Alex
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.651 / Virus Database: 417 - Release Date: 05.04.2004
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.651 / Virus Database: 417 - Release Date: 05.04.2004


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


Problem with torque.addSaveMethod

Posted by Alexandru Dovlecel <al...@siemens.com>.
Hi all,

I am trying to clean the model generated by torque (don't want to have
myobj.save, myobj.insert and so on, Peer classes are just enough for me).
How can I achieve this.

I have tried setting
addSaveMethod = false
complexObjectModel = false

It really generates cleaner code (only POJO), but... they are not compilable
:(((. Because the BaseMyObj extends the BaseObject, which defines three
abstract methods: save(...) x 3.

Is this a problem with the Torque generator or I want to do something that
torque is not supposed to support? Or, am I doing something wrong???

Pls help. Thanks,
Alex


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


Re: RE: Generation Problem with Maven

Posted by Torsten Eberl <ne...@vstar.de>.
I already use these properties.
Also with the same values.
My project.properties looks like this:

# -------------------------------------------------------------------
# P R O J E C T  P R O P E R T I E S
# -------------------------------------------------------------------

# -------------------------------------------------------------------
#
#  X D O C   P R O P E R T I E S
#
# -------------------------------------------------------------------

maven.xdoc.date=left
maven.xdoc.date.locale=de


# -------------------------------------------------------------------
#
#  B A S I C   P R O P E R T I E S
#
# -------------------------------------------------------------------

project = dreamdate
database = mysql
targetPackage = de.dreamdate.service.db.torque

torque.project = ${project}
torque.database = ${database}
torque.targetPackage = ${targetPackage}
torque.runOnlyOnSchemaChange = false

# -------------------------------------------------------------------
#
#  D I R E C T O R I E S
#
# -------------------------------------------------------------------

outputDirectory = ${maven.build.dest}
schemaDirectory = ${maven.src.dir}/schema
templatePath = ${maven.src.dir}/torque/templates

torque.output.dir = ${outputDirectory}
torque.schema.dir = ${schemaDirectory}
torque.templatePath = ${templatePath}

torque.doc.dir = ${torque.output.dir}/doc/schema
torque.java.dir = ${maven.src.dir}/java
torque.ojb.dir = ${maven.src.dir}/ojb
torque.sql.dir = ${torque.output.dir}/sql
torque.omzip.dir = ${torque.output.dir}


# -------------------------------------------------------------------
#
#  D A T A B A S E   S E T T I N G S
#
# -------------------------------------------------------------------

createDatabaseUrl = jdbc:mysql://localhost:3306/mysql
buildDatabaseUrl = jdbc:mysql://localhost:3306/dreamdate
databaseUrl = jdbc:mysql://localhost:3306/dreamdate
databaseDriver = org.gjt.mm.mysql.Driver
databaseUser = user
databasePassword = password
databaseHost = localhost

databaseSchema = dreamdate-schema.xml
databaseName = dreamdate
database.manual.creation = false
sameJavaName = false

torque.database.createUrl = ${createDatabaseUrl}
torque.database.buildUrl = ${buildDatabaseUrl}
torque.database.url = ${databaseUrl}
torque.database.driver = ${databaseDriver}
torque.database.user = ${databaseUser}
torque.database.password = ${databasePassword}
torque.database.host = ${databaseHost}

torque.database.schema = ${databaseSchema}
torque.database.name = ${databaseName}
torque.database.manualCreation = ${database.manual.creation}
torque.sameJavaName = ${sameJavaName}


# -------------------------------------------------------------------
#
#  T E M P L A T E   V A R I A B L E S
#
# -------------------------------------------------------------------

addGetByNameMethod = true
addIntakeRetrievable = false
addSaveMethod = true
addTimeStamp = true
basePrefix = Base
complexObjectModel = true
useManagers = true
useClasspath = true

torque.addGetByNameMethod = ${addGetByNameMethod}
torque.addIntakeRetrievable = ${addIntakeRetrievable}
torque.retrievableInterface = org.apache.turbine.om.Retrievable
torque.addSaveMethod = ${addSaveMethod}
torque.addTimeStamp = ${addTimeStamp}
torque.basePrefix = ${basePrefix}
torque.complexObjectModel = ${complexObjectModel}
torque.saveException = Exception
torque.useClasspath = ${useClasspath}
torque.useManagers = ${useManagers}

torque.omzip.src.base = false
torque.omzip.src.extension = false
torque.omzip.bin.base = false
torque.omzip.bin.extension = false
torque.omzip.deleteFiles = false

torque.generateDeprecated = true

# -------------------------------------------------------------------
#
#  M I S C .   S E T T I N G S
#
# -------------------------------------------------------------------

idTableXMLFile =
documentationFormat = html
initialID = 101

torque.idTableXMLFile = ${idTableXMLFile}
torque.doc.format = ${documentationFormat}
torque.doc.html.normalFont = font-family: Verdana; font-size: 10pt;
torque.doc.html.fkColor = afe295
torque.initialID = ${initialID}


# -------------------------------------------------------------------
#
#  C O N T R O L   T E M P L A T E S
#
# -------------------------------------------------------------------

SQLControlTemplate = sql/base/Control.vm
OMControlTemplate = om/Control.vm
idTableControlTemplate = sql/id-table/Control.vm
DataDTDControlTemplate = data/Control.vm
DataDumpControlTemplate = data/dump/Control.vm
DataSQLControlTemplate = sql/load/Control.vm
DocControlTemplate = doc/Control.vm

torque.template.sql = ${SQLControlTemplate}
torque.template.om = ${OMControlTemplate}
torque.template.idTable = ${idTableControlTemplate}
torque.template.dataDtd = ${DataDTDControlTemplate}
torque.template.dataDump = ${DataDumpControlTemplate}
torque.template.dataSql = ${DataSQLControlTemplate}
torque.template.doc = ${DocControlTemplate}
torque.template.sqlDbInit = sql/db-init/Control.vm
torque.template.ojb = ojb/repository/Control.vm
torque.template.ojbModel = ojb/model/Control.vm


# -------------------------------------------------------------------
#
#  C O M P I L E   S E T T I N G S
#
# -------------------------------------------------------------------

src.dir = ${torque.java.dir}
build.dest = bin/classes
debug = on
deprecation = off
optimize = off

torque.compile.src.dir = ${src.dir}
torque.compile.build.dir = ${build.dest}
torque.compile.debug = ${debug}
torque.compile.deprecation = ${deprecation}
torque.compile.optimize = ${optimize}


# -------------------------------------------------------------------
#
#  I N C L U D E   A N D   E X C L U D E   S E T T I N G S
#
# -------------------------------------------------------------------

torque.schema.sql.includes = *-schema.xml
torque.schema.sql.excludes =
torque.schema.doc.includes = *-schema.xml
torque.schema.doc.excludes =
torque.schema.createdb.includes = *-schema.xml
torque.schema.createdb.excludes =
torque.schema.initsql.includes = *-schema.xml
torque.schema.initsql.excludes = id-table-schema.xml
torque.schema.om.includes = *-schema.xml
torque.schema.om.excludes = id-table-schema.xml
torque.schema.ojb.includes = *-schema.xml
torque.schema.ojb.excludes =

 
Torsten

--------------------------------------------------
from Brent Atkins
to torque-user@db.apache.org
at Wed, 7 Apr 2004 12:59:38 -0400
RE: Generation Problem with Maven
--------------------------------------------------
> Here are the properties that I had to set to get it to work.
> 
> Note: I use IDMethod = native, if you use the IDBroker you may need to set 2 other properties, but
> since I don't use it, I don't know what they are (I found them somewhere in the archive though...).
> 
> torque.basePrefix = Base
> torque.addSaveMethod = true
> torque.saveException = Exception
> 
> Just stick them in your project.properties
> 
> -----Original Message-----
> From: Torsten Eberl [mailto:newsgroup@vstar.de]
> Sent: Wednesday, April 07, 2004 12:58 PM
> To: Apache Torque Users List
> Subject: Generation Problem with Maven
> 
> 
> Hi,
> 
> I have a problem generating java classes with maven.
> 
> After I started the process with "maven torque" I will get the correct sql-file but instead
> of java classes with the table names I get correctly looking files with the name of
> an object. For instance 
> 
> org.apache.commons.jelly.expression.ConstantExpression@d5eb7[value=Base]Rbacrole.java
> 
> The correct name would be BaseRbacrole.java
> 
> I have the same problem with torque-gen-3.1 and yesterdays torque-gen-3.2-dev.
> I'm using maven 1.0-rc2.
> 
> I guess the schema is correct, because it worked fine with ant.
> 
> Has anybody an idea what version conflict this might be?
> Or could there something else be wrong?
> 
> Torsten
> 
> 
> ---------------------------------------------------------------------
> 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: Generation Problem with Maven

Posted by Brent Atkins <Br...@Pro-Sys.biz>.
Here are the properties that I had to set to get it to work.

Note: I use IDMethod = native, if you use the IDBroker you may need to set 2 other properties, but
since I don't use it, I don't know what they are (I found them somewhere in the archive though...).

torque.basePrefix = Base
torque.addSaveMethod = true
torque.saveException = Exception

Just stick them in your project.properties

-----Original Message-----
From: Torsten Eberl [mailto:newsgroup@vstar.de]
Sent: Wednesday, April 07, 2004 12:58 PM
To: Apache Torque Users List
Subject: Generation Problem with Maven


Hi,

I have a problem generating java classes with maven.

After I started the process with "maven torque" I will get the correct sql-file but instead
of java classes with the table names I get correctly looking files with the name of
an object. For instance 

org.apache.commons.jelly.expression.ConstantExpression@d5eb7[value=Base]Rbacrole.java

The correct name would be BaseRbacrole.java

I have the same problem with torque-gen-3.1 and yesterdays torque-gen-3.2-dev.
I'm using maven 1.0-rc2.

I guess the schema is correct, because it worked fine with ant.

Has anybody an idea what version conflict this might be?
Or could there something else be wrong?

Torsten


---------------------------------------------------------------------
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