RE: get the SQL to be executed

2012-01-19 Thread Greg Monroe
Or, if the info you're exporting maps to your Torque app's 
tables, you could probably just add "toSQL()" methods to
the record stubs that creates the INSERT statements.

E.g. if you have a User record object, modify the User.java
Torque created with something like:

Public String toSQL() {
   StringBuffer sql = new StringBuffer;
   
// Build SQL statement from current object contents

   return sql.toString();
}

Then just do a normal Torque query to get the data you're 
interested in and loop thru the results calling toSQL to 
create your output file.

Note that once the "stub" classes are built, Torque will not
replace them if your regenerate the code. So the toSQL() code 
is safe.

It would also be possible to create some generic Torque record to
SQL code by using the "map" information.  This lets you determine
the column info in a table.  So you could look up the table info 
for a record object, then create the sql by iterating over the 
column names and using the column type to determine the string 
format to use.

But for a few table objects, it might be easier to just do the 
manually created toSQL() methods.

-Original Message-
From: Thomas Vandahl [mailto:t...@apache.org] 
Sent: Thursday, January 19, 2012 12:51 PM
To: Apache Torque Users List
Subject: Re: get the SQL to be executed

On 19.01.12 18:38, Ivano Luberti wrote:
> Thanks all for your responses.
> Just to clarify, I need to generate sql commands inside my code to
> generate a file that can be used by another software (not written by me)
> to import data.
> 
> I would like not to execute commands but only write them (because this
> is what I need).
> If I cannot find alternatives, I can execute them and use one of the
> logging facilities that have been suggested.

Well, inserts are sort of tricky because the actual SQL generation
happens deep inside Village. If you have control over your class loader,
you may modify a copy of the com.workingdogs.village.Record class and
put that first in the chain. Look for the saveWithInsert() method. This
is probably the closest you can get, IMHO.

Bye, Thomas.

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

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

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



RE: get the SQL to be executed

2012-01-19 Thread Greg Monroe
If you are trying to generate an initial data scripts rather
than a "audit log", you might look at the dumpdata and datasql
tasks that Torque supplies.  I have used these to create 
initial data sets that applications need (e.g. initial user
entry, rights entry, etc.)

If you need to do this inside the code, you might look at
the apache ddlutils project db.apache.com/ddlutils.  This has
some code callable functions to generate various SQL scripts.

If you don't need SQL, but are really looking for a way to 
export/import data between Torque applications, look at
sf.net/projects/torque-addons.  This has a framework for 
easily creating XML exports of records.  You may need to
write some record handler code to deal with foreign keys.

Greg 

-Original Message-
From: Joe Carter [mailto:joe.car...@gmail.com] 
Sent: Thursday, January 19, 2012 3:32 AM
To: Apache Torque Users List
Subject: Re: get the SQL to be executed

You can use a logging driver such as p6spy to see your SQL statements.
http://sourceforge.net/projects/p6spy/

On 19 January 2012 08:25, Thomas Fox  wrote:
> Perhaps you can use the log output (with some tweaks to the log4j
> configuration). However I'm not sure how and if Torque 3.3 logs the update
> statements. But then again I've heard of drivers which at as a bridge
> between the application and the real driver (e.g
> http://www.squirrelsql.org/) and which can do the logging for you.
>
> Torque 4 will not work because it uses prepared statements for updates,
> this will not give you any sensible sql.
>
>    Thomas
>
>> Hello all, is there a way in Torque to get the SQL that is sent to the
> DB.
>> I have to generate a txt file where I save queries basically INSERT
>> statements of long records.
>> I was thinking of create the Torque classes, populate the objects with
>> data that I get from a local instance of the DB and then, instead of
>> using a save command, get the SQL that would be executed and store it in
>> a file.
>>
>> Alternatively I could use this:
>>
>> http://openhms.sourceforge.net/sqlbuilder/
>>
>> but has dependencies that requires GPL license and I would avoid in this
>> case that kind of license.
>
>
> -
> 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

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

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



RE: Revisited: Oracle and the empty string

2010-10-04 Thread Greg Monroe
You might handle this by defining fields which allow null to be optional in 
your XML.  E.g., tag not in XML = NULL / tag exists and is empty = "".  I think
the XML parsers can differentiate between these with some extra code.

FYI - You might want to take a look at:

http://torque-addons.sourceforge.net/XML-Import-Export/index.html

This is some code I wrote a while back to support import/export of data into
one of my systems.  I've also used it as a basis for some REST services I 
added.

> -Original Message-
> From: Thomas Fischer [mailto:fisc...@seitenbau.net]
> Sent: Friday, October 01, 2010 4:29 PM
> To: Apache Torque Users List
> Subject: Re: Revisited: Oracle and the empty string
> 
> Thomas Vandahl  wrote:
> > On 01.10.10 21:47, Thomas Fischer wrote:
> > > In my experience, it is no problem if you keep that fact in mind. It
> just
> > > makes the code non-portable to another database (you only query for
> not
> > > null and know it's also not empty in oracle, but not dor other
> databases).
> > > Is it a problem for yaou if "" and null get mapped to the same value
> ?
> >
> > Unfortunately it is. The XML processing is different for these cases.
> > Suggestions are welcome. Patch it in the template to some strange
> value?
> > Other ideas?
> 
> I do not understand the problem well enough (perhaps you can provide a
> little code example ?) but what you could do is to use the first characte
> of the String in the database as a flag: "N" for null and "O" for other
> (not null). You can overwrite the setters and getters such that they add
> and remove the flag automatically.
> 
> You could use the template override mechanism in Torque4 to do this with
> minimum impact. There is a similar example in the torque4 test project
> (use
> the overrideConfigDir to override certain template settings). If you look
> at it and there is not enough documentation just open a jira issue.
> 
> Thomas
> 
> 
> -
> To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
> For additional commands, e-mail: torque-user-h...@db.apache.org

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

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



RE: Excessive database queries on postgresql: village metadata queries

2010-07-07 Thread Greg Monroe
Torque has been using Village pretty much since day 1.. and AFAIK the 
Village has been using metadata as long.  If you didn't have performance
problems before, it's probably a JDBC version problem.

FWIW, getting rid of Village (or highly modifying it) is a 4.0 goal.  But
AFAIK, the Village use of metadata is a sticky problem to tackle.  It's used
to determine what type of object to use in retrieving columns.  Probably 
the correct fix is to use the *Map classes to do this and not the DB Meta
data.

It looks like the actual call to the ResultSet.getMetatData() is only done
once per query. Plus, there is a todo item in on the PostGres JDBC website
about caching the metadata rather than doing selects for each column.

IMHO, it's a PostGres JDBC driver issue, since other drivers seem to cache
this info.

> -Original Message-
> From: Graham Leggett [mailto:minf...@sharp.fm]
> Sent: Tuesday, July 06, 2010 9:19 PM
> To: torque-user@db.apache.org
> Subject: Excessive database queries on postgresql: village metadata
> queries
> 
> Hi all,
> 
> I have been trying to hunt down a performance issue with an existing
> torque based system against a postgresql database. Interspersed
> between each query are thousands and thousands of metadata queries,
> which have slowed our database down by a few orders of magnitude.
> 
> I have managed to trace the key problems down to
> com.workingdogs.village.Column.populate(ResultSetMetaData rsmd, int
> colNum, String tableName), where the following lines cause SQL queries
> to be generated to the database as below:
> 
>  this.columnTypeName = rsmd.getColumnTypeName(columnNumber);
>  this.columnType = rsmd.getColumnType(columnNumber);
>  this.nullAllowed = rsmd.isNullable(columnNumber) == 1;
>  this.autoIncrement = rsmd.isAutoIncrement(columnNumber);
> 
> Has anyone encountered this before and managed to work out how to stop
> the metadata queries being translated into database queries? I would
> expect either the JDBC driver to cache these, or if not for Village to
> cache these.
> 
> I am not 100% of the exact change that introduced this problem, it
> could have been a move from torque v3.2 to torque v3.3, alternatively
> it could have been an update in JDBC driver to
> postgresql-8.4-701.jdbc4.jar. The problem was picked up after a large
> refactoring job, so I am not 100% sure of the cause unfortunately.
> 
> Has anyone seen this problem before?
> 
> A sample of the queries include the following:
> 
> 2010-07-03 23:49:31 SAST LOG:  execute : SELECT attnotnull
> FROM pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2
> 2010-07-03 23:49:31 SAST DETAIL:  parameters: $1 = '29427', $2 = '4'
> 2010-07-03 23:49:31 SAST LOG:  execute : SELECT def.adsrc
> FROM pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON
> (a.attrelid=c.oid) LEFT JOIN pg_catalog.pg_attrdef def ON
> (a.attrelid=def.adrelid AND a.attnum = def.adnum) WHERE c.oid = $1 and
> a.attnum = $2 AND def.adsrc LIKE '%nextval(%'
> 2010-07-03 23:49:31 SAST DETAIL:  parameters: $1 = '29427', $2 = '4'
> 2010-07-03 23:49:31 SAST LOG:  execute : SELECT attnotnull
> FROM pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2
> 2010-07-03 23:49:31 SAST DETAIL:  parameters: $1 = '29427', $2 = '5'
> 2010-07-03 23:49:31 SAST LOG:  execute : SELECT def.adsrc
> FROM pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON
> (a.attrelid=c.oid) LEFT JOIN pg_catalog.pg_attrdef def ON
> (a.attrelid=def.adrelid AND a.attnum = def.adnum) WHERE c.oid = $1 and
> a.attnum = $2 AND def.adsrc LIKE '%nextval(%'
> 2010-07-03 23:49:31 SAST DETAIL:  parameters: $1 = '29427', $2 = '5'
> 2010-07-03 23:49:31 SAST LOG:  execute : SELECT attnotnull
> FROM pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2
> 2010-07-03 23:49:31 SAST DETAIL:  parameters: $1 = '29427', $2 = '8'
> 2010-07-03 23:49:31 SAST LOG:  execute : SELECT def.adsrc
> FROM pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON
> (a.attrelid=c.oid) LEFT JOIN pg_catalog.pg_attrdef def ON
> (a.attrelid=def.adrelid AND a.attnum = def.adnum) WHERE c.oid = $1 and
> a.attnum = $2 AND def.adsrc LIKE '%nextval(%'
> 2010-07-03 23:49:31 SAST DETAIL:  parameters: $1 = '29427', $2 = '8'
> 2010-07-03 23:49:31 SAST LOG:  execute : SELECT attnotnull
> FROM pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2
> 2010-07-03 23:49:31 SAST DETAIL:  parameters: $1 = '29427', $2 = '9'
> 2010-07-03 23:49:31 SAST LOG:  execute : SELECT def.adsrc
> FROM pg_catalog.pg_class c JOIN pg_catalog.pg_attribute a ON
> (a.attrelid=c.oid) LEFT JOIN pg_catalog.pg_attrdef def ON
> (a.attrelid=def.adrelid AND a.attnum = def.adnum) WHERE c.oid = $1 and
> a.attnum = $2 AND def.adsrc LIKE '%nextval(%'
> 2010-07-03 23:49:31 SAST DETAIL:  parameters: $1 = '29427', $2 = '9'
> 2010-07-03 23:49:31 SAST LOG:  execute : SELECT attnotnull
> FROM pg_catalog.pg_attribute WHERE attrelid = $1 AND attnum = $2
> 2010-07-03 23:49:31 SAST DETAIL:  parameters: $1 = '29427', $

RE: CountHelper and criteria.clone()

2010-07-07 Thread Greg Monroe
The Criteria clone method comes from its Hashtable superclass.  The problem 
is probably because Hashtable is doing a shallow copy and the underlying 
objects are the same. FWIW, there is a JIRA wish list item for this to be 
redone as a deep copy.  But this probably will be a 4.0 item.

In general, it's best to create or .clear() Criteria objects for each 
action.  This is usually not a big coding / overhead issue. 

However, if you have complex queries that are done frequently, you can
look at using the Criteria.Criterion subclass to create a reusable 
query definition.  See the Using Criterion... section in the docs at:

http://db.apache.org/torque/releases/torque-3.3/runtime/reference/read-from-db.html

FYI - I have to put a plug in for the SummaryHelper class that is in the 3.x 
CVS Head but not in a release yet.  It can be used instead of the CountHelper
class and has a lot more functionality. Here's the Javadoc in the 4.0 test
site (same as in the 3.3. tree). 

http://db.apache.org/torque/releases/torque-4.0/documentation/modules/runtime/apidocs/org/apache/torque/util/SummaryHelper.html



> -Original Message-
> From: Luca Ciocci [mailto:l.cio...@askweb.it]
> Sent: Tuesday, July 06, 2010 11:52 AM
> To: torque-user@db.apache.org
> Subject: CountHelper and criteria.clone()
> 
> Hello,
>  I discover the CountHelper object and I think that could be very
> usefull, but I have seen that it modify the original criteria object
> adding a select count(*) to the query.
> 
> So my question is: exist a way to real copy the criteria object before
> use the CountHelper (or exists another trick?)
> 
> A simple code like this not work:
> 
> List list=new LinkedList();
> Criteria criteria=new Criteria();
> criteria.add(MyTablePeer.MyColumn,'MyValue'); //Adding a simple column
> 
> Criteria criteriacount=(Criteria)criteria.clone(); //Important
> CountHelper counthelper=new CountHelper(criteriacount);
> int recordcount=counthelper.count();
> 
> if (recordcount<1000) {
>   list=MyTablePeer.doSelect(criteria);
>   //This instruction fail and throw DataSetException
> }
> 
> 
> Thanks in advance.
> Luca
> 
> 
> --
> Ing. Luca Ciocci
> ASK srl
> tel 059 271417
> fax 059 3683560
> 
> 
> -
> To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
> For additional commands, e-mail: torque-user-h...@db.apache.org

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.et

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



RE: Count using torque 3.1.1

2010-05-03 Thread Greg Monroe
D'oh.. should have paid more attention to version number...

You might be able to do this via a Criteria using addAsColumn
and the CUSTOM SqlEnum.  Then use BasePeer createQueryString and
executeQuery methods to get the results as a Village Record set.

A quicker "hack" might be to just create the SQL statement 
manually (e.g no Criteria) and call the executeQuery method.

Finally, if this is something done frequently, you might consider
creating a DB view that contains the summary information and then
create the Torque objects to access this view as a normal table.


> -Original Message-
> From: Ludwig Magnusson [mailto:lud...@itcatapult.com]
> Sent: Monday, May 03, 2010 10:41 AM
> To: 'Apache Torque Users List'
> Subject: RE: Count using torque 3.1.1
> 
> Well, no it's not there and the reason I ask is because my customer is
> using
> torque 3.1.1 and an upgrade is out of my hands (and not an option here
> anyway).
> Was it impossible to do counts before CountHelper.
> /Ludwig
> 
> -Original Message-
> From: Greg Monroe [mailto:greg.mon...@dukece.com]
> Sent: den 3 maj 2010 16:36
> To: 'Apache Torque Users List'
> Subject: RE: Count using torque 3.1.1
> 
> I think CountHelper is in 3.1.1... but if you're looking for an
> alternative
> or it doesn't work, you might try getting the current head version and
> trying
> the new SummaryHelper class.  This didn't quite get into 3.1.1.. but was
> checked in after the release.
> 
> Here's some info on it:
> 
> http://mail-archives.apache.org/mod_mbox/db-torque-
> dev/200802.mbox/%3C8F5843
> b903f59d4c8c6806bb49a39119057d7...@dukece-mail3.dukece.com%3e
> 
> 
> 
> > -Original Message-
> > From: Ludwig Magnusson [mailto:lud...@itcatapult.com]
> > Sent: Monday, May 03, 2010 10:19 AM
> > To: 'Apache Torque Users List'
> > Subject: Count using torque 3.1.1
> >
> > Hi!
> >
> > How can I create a SQL count statement using torque 3.1.1. Counthelper
> is
> > not available.
> >
> > /Ludwig
> 
> DukeCE Privacy Statement:
> Please be advised that this e-mail and any files transmitted with
> it are confidential communication or may otherwise be privileged or
> confidential and are intended solely for the individual or entity
> to whom they are addressed. If you are not the intended recipient
> you may not rely on the contents of this email or any attachments,
> and we ask that you please not read, copy or retransmit this
> communication, but reply to the sender and destroy the email, its
> contents, and all copies thereof immediately. Any unauthorized
> dissemination, distribution or copying of this communication is
> strictly prohibited.
> 
> -
> 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: Count using torque 3.1.1

2010-05-03 Thread Greg Monroe
I think CountHelper is in 3.1.1... but if you're looking for an alternative
or it doesn't work, you might try getting the current head version and trying
the new SummaryHelper class.  This didn't quite get into 3.1.1.. but was 
checked in after the release. 

Here's some info on it:

http://mail-archives.apache.org/mod_mbox/db-torque-dev/200802.mbox/%3c8f5843b903f59d4c8c6806bb49a39119057d7...@dukece-mail3.dukece.com%3e



> -Original Message-
> From: Ludwig Magnusson [mailto:lud...@itcatapult.com]
> Sent: Monday, May 03, 2010 10:19 AM
> To: 'Apache Torque Users List'
> Subject: Count using torque 3.1.1
> 
> Hi!
> 
> How can I create a SQL count statement using torque 3.1.1. Counthelper is
> not available.
> 
> /Ludwig

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

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



RE: Can I use torque over ssh?

2010-03-04 Thread Greg Monroe
All true... but remember that interaction with an SQL Server (regardless 
of the method) is generally net traffic intensive.  Using a method like
this has two possible "gotchas".

First, the added complexity may cause communication problems.  SQL Servers
are not built around handling frequently dropping packets/clients.  Your
code will need to do a lot of transaction protection and you will need to
be prepared to clear out deadlocks created by clients dropping.

Also, distance and SSH are both going to add some lag factors.  So don't 
expect the normal SQL rapid response.  Make sure all your users are 
aware of this too.

Bottom line, IMHO, this is probably OK for something that just retrieves
a little bit of data... with a nice stable network connection and users
who don't mind lag/variable response times.  But I wouldn't build a 
fully interactive app that allows data modification, etc with it.


> -Original Message-
> From: Emmanuel Bardet [mailto:ebar...@bardet-u2ee.com]
> Sent: Thursday, March 04, 2010 3:16 AM
> To: Apache Torque Users List
> Subject: Re: Can I use torque over ssh?
> 
> Hello Ludwig,
> 
> It's not really Torque related but more to your jdbc driver.  From an
> ssh perspective, as long as it uses TCP/IP to connect to your database
> server AND IF your ssh server allows ssh-tunneling (ana ssh-port-
> forwarding) then you should be fine.  There's a few how-to available.
> 
> E
> 
> Le 4 mars 10 à 04/03-08:56, Ludwig Magnusson a écrit :
> 
> > Hi!
> >
> > If I have a database on a server that I can connect to via ssh, can
> > I use
> > torque to access that database? I.e write a java program that runs
> > on my
> > compyter but reads/writes to the database.
> >
> > Can I also run maven goals like torque:datadump that connects to the
> > remote
> > database?
> >
> > /Ludwig
> >
> 
> 
> -
> To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
> For additional commands, e-mail: torque-user-h...@db.apache.org

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

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



RE: [IP Clearance] Db Torque Generator

2010-02-08 Thread Greg Monroe
Puts on irony hat...

Ah, afraid those of us who know you would see through to your 
Machiavellian plot here and vote against you.  So you're
changing the venue... lol

> -Original Message-
> From: Thomas Fischer [mailto:fisc...@seitenbau.net]
> Sent: Sunday, February 07, 2010 6:32 AM
> To: Apache Torque Users List
> Subject: RE: [IP Clearance] Db Torque Generator
> 
> oops, wrong list, sorry...
> should have gone to incubator-general...
> 
>Thomas
> 
> > [IP Clearance] Db Torque Generator
> >
> > I have written a replacement for some DB Torque modules that I would
> like
> > to donate to the ASF.
> >
> > The code base can be found at http://people.apache.org/~tfischer/
> > torque-generator-4-0-proposal.zip, the IP clearance form is available
> at
> > http://incubator.apache.org/ip-clearance/db-torque-generator.html.
> >
> > If anybody thinks it is inappropriate that the person who wrote the
> code
> > also does the IP clearance, please vote -1 and I'll find someone else.
> >
> > The vote closes at Wednesday 10th Feb 18:00 MEZ
> >
> >  Thomas
> 
> 
> -
> To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
> For additional commands, e-mail: torque-user-h...@db.apache.org

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

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



RE: Criteria.or not working?

2010-02-05 Thread Greg Monroe
Whoops, looked at the code and I think my answer was wrong.  The 
code is actually behaving as documented.  E.g. the docs say:

"This method adds a new criterion to the list of criterias. If a
 criterion for the requested column already exists, it is
 "OR"ed to the existing criterion"

You are using two different columns in the or statements.  Therefore,
they are being treated as an add and not an or condition for each
column.

Not intuitive, but correctly documented. Sigh. Use the criterion 
method to create mix column or statements.

FWIW, the underlying cause is that criteria object was initially
created under Java 1.2 or 1.3 and all the Collections interfaces
where not defined.  So it is based on Hashtable.  This has caused 
some long term issues like this.  One of the goals of the 4.0 
version is to replace this with a HashList.  This will allow 
looking at the last added criterion and applying conditionals to 
it.  

> -Original Message-----
> From: Greg Monroe
> Sent: Friday, February 05, 2010 9:35 AM
> To: 'Apache Torque Users List'
> Subject: RE: Criteria.or not working?
> 
> I think the proper syntax would be to "add" the left hand operator
> and then or the conditional with this.  Rather than 2 ors which
> are right hand conditionals. E.g., the proper syntax would be:
> 
> Criteria criteria = new Criteria();
> criteria.add("user.first_name", "John");
> criteria.or("user.last_name", "Doe");
> UserPeer.doSelect(criteria);
> 
> The syntax using two the .or methods is like trying to write an SQL
> statement like:
> 
> Select * from user where or user.first='John' or user.last='Doe';
> 
> The SQL parser would choke on this.  I suspect the code is assuming
> that since there is no right hand conditional the or should be treated
> as an and statement. E.g. "Null or X" is translated to just X.   It
> probably should throw an invalid syntax error here.
> 
> FWIW, using Criterion is really only "required" if you are using the
> same column or need parenthetical nesting.
> 
> 
> > -Original Message-
> > From: Ivano Luberti [mailto:lube...@archicoop.it]
> > Sent: Friday, February 05, 2010 9:08 AM
> > To: Apache Torque Users List
> > Subject: Re: Criteria.or not working?
> >
> > Sorry never tried that, I only now that is not the way the Criteria
> > class is meant to be used.
> > So I let developers talk about that.
> > Alternatively you can dig into the peer classes source code: I have
> done
> > a few times to understand Torque behaviour and is quite well written
> and
> > readable
> >
> > Ludwig Magnusson ha scritto:
> > > Yes that works, but that was not what I asked.
> > > My question was, how can the methods and(), add() and or() all
> generate
> > the
> > > same result?
> > >
> > > -Original Message-
> > > From: Ivano Luberti [mailto:lube...@archicoop.it]
> > > Sent: den 5 februari 2010 14:10
> > > To: Apache Torque Users List
> > > Subject: Re: Criteria.or not working?
> > >
> > > If you want to combine clauses mixinn and and or operators you should
> > > use Criterion.
> > >
> > > Look here for an introduction to how build queries using Criteria and
> > > Criterion
> > >
> > > http://db.apache.org/torque/releases/torque-
> 3.3/runtime/reference/read-
> > from-
> > > db.html
> > >
> > > Ludwig Magnusson ha scritto:
> > >
> > >> Hi!
> > >>
> > >> I have done some testing during development of a project here and it
> > seems
> > >> that criteria.and([parameters]), criteria.add([parameters]) and
> > >> criteria.or([parameters]) all generate the same query to the
> database.
> > >>
> > >>
> > >>
> > >> E.g these three code snippets:
> > >>
> > >> Criteria criteria = new Criteria();
> > >>
> > >> criteria.and("user.first_name", "John");
> > >>
> > >> criteria.and("user.last_name", "Doe");
> > >>
> > >> UserPeer.doSelect(criteria);
> > >>
> > >>
> > >>
> > >> Criteria criteria = new Criteria();
> > >>
> > >> criteria.add("user.first_name", "John");
> > >>
> > >> criteria.add("user.last_name", "Doe");
> > >>
> > >> UserPeer.doSelect(criteria);
> > >>
> > >&g

RE: Criteria.or not working?

2010-02-05 Thread Greg Monroe
I think the proper syntax would be to "add" the left hand operator 
and then or the conditional with this.  Rather than 2 ors which 
are right hand conditionals. E.g., the proper syntax would be:

Criteria criteria = new Criteria();
criteria.add("user.first_name", "John");
criteria.or("user.last_name", "Doe");
UserPeer.doSelect(criteria);

The syntax using two the .or methods is like trying to write an SQL
statement like:

Select * from user where or user.first='John' or user.last='Doe';

The SQL parser would choke on this.  I suspect the code is assuming
that since there is no right hand conditional the or should be treated
as an and statement. E.g. "Null or X" is translated to just X.   It 
probably should throw an invalid syntax error here.

FWIW, using Criterion is really only "required" if you are using the
same column or need parenthetical nesting. 


> -Original Message-
> From: Ivano Luberti [mailto:lube...@archicoop.it]
> Sent: Friday, February 05, 2010 9:08 AM
> To: Apache Torque Users List
> Subject: Re: Criteria.or not working?
> 
> Sorry never tried that, I only now that is not the way the Criteria
> class is meant to be used.
> So I let developers talk about that.
> Alternatively you can dig into the peer classes source code: I have done
> a few times to understand Torque behaviour and is quite well written and
> readable
> 
> Ludwig Magnusson ha scritto:
> > Yes that works, but that was not what I asked.
> > My question was, how can the methods and(), add() and or() all generate
> the
> > same result?
> >
> > -Original Message-
> > From: Ivano Luberti [mailto:lube...@archicoop.it]
> > Sent: den 5 februari 2010 14:10
> > To: Apache Torque Users List
> > Subject: Re: Criteria.or not working?
> >
> > If you want to combine clauses mixinn and and or operators you should
> > use Criterion.
> >
> > Look here for an introduction to how build queries using Criteria and
> > Criterion
> >
> > http://db.apache.org/torque/releases/torque-3.3/runtime/reference/read-
> from-
> > db.html
> >
> > Ludwig Magnusson ha scritto:
> >
> >> Hi!
> >>
> >> I have done some testing during development of a project here and it
> seems
> >> that criteria.and([parameters]), criteria.add([parameters]) and
> >> criteria.or([parameters]) all generate the same query to the database.
> >>
> >>
> >>
> >> E.g these three code snippets:
> >>
> >> Criteria criteria = new Criteria();
> >>
> >> criteria.and("user.first_name", "John");
> >>
> >> criteria.and("user.last_name", "Doe");
> >>
> >> UserPeer.doSelect(criteria);
> >>
> >>
> >>
> >> Criteria criteria = new Criteria();
> >>
> >> criteria.add("user.first_name", "John");
> >>
> >> criteria.add("user.last_name", "Doe");
> >>
> >> UserPeer.doSelect(criteria);
> >>
> >>
> >>
> >> Criteria criteria = new Criteria();
> >>
> >> criteria.or("user.first_name", "John");
> >>
> >> criteria.or("user.last_name", "Doe");
> >>
> >> UserPeer.doSelect(criteria);
> >>
> >>
> >>
> >> . would all generate the Sql query
> >>
> >> SELECT * FROM USER WHERE first_name = "John" AND last_name = "Doe";
> >>
> >>
> >>
> >> How can this be?
> >>
> >> /Ludwig
> >>
> >>
> >>
> >>
> >
> >
> 
> --
> ==
> dott. Ivano Mario Luberti
> Archimede Informatica societa' cooperativa a r. l.
> Sede Operativa
> Via Gereschi 36 - 56126- Pisa
> tel.: +39-050- 580959
> tel/fax: +39-050-9711344
> web: www.archicoop.it
> ==
> 
> 
> -
> To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
> For additional commands, e-mail: torque-user-h...@db.apache.org

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
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-17 Thread Greg Monroe
The schema databasemap name (e.g. defaultDB) will always be hard coded to the
name in the XML file.  So, it will never be found in another "Database" object.

Your code snippet doesn't connect the "nondefaultDB" pool name to anything
the criteria/SQLBuilder uses.  But your debugging showed it was looking for 
this name. I suspect this is because your runtime torque.database.default 
property set to "nondefaultDB".

This property is the "name" that Torque uses for the default if none is 
specified.

Try either changing your runtime settings to use "defaultDB" or specify the 
"defaultDB" name on your criteria constructor, e.g. new Criteria("defaultDB").
This will make sure that the "name" used will match the schema name.

> -Original Message-
> From: Sheldon Ross [mailto:sr...@simmgene.com]
> Sent: Monday, November 16, 2009 5:19 PM
> To: Apache Torque Users List
> Subject: Re: Criteria needs write permissions?
> 
> "Second, create all criteria element using the *Peer objects.  The
> DatabaseMap is populated when a *Peer class is loaded (static init).
> So, all tables "Maps" you will be referencing will exist in a Database
> object keyed to the DB Schema Name."
> 
> This seems to be where I'm failing. Yes some queries will work. But I
> don't think
> the metadata areas will work. If this is what you meant, then I
> apologize.
> 
> For example. Use an OrderBy clause for selecting from a database
> connection pool
> that is not from the default schema for that object.
> 
> Connection srcConn = Torque.getConnection("nondefaultDB");
> Criteria critera = new Criteria();
> criteria.addAscendingOrderByColumn(TableAPeer.COLA);
> TableAPeer.doSelect(criteria,srcConn);
> 
> This doesn't work for me because TableA does not exist in the dbMap
> for "nondefaultDB". It does exist in the dbMap for "defaultDB" because
> that's
> what's coded via the schema name.
> 
> SQLBuilder succeeds at building the query for
> 
> c.add(TableAPeer.COLA, 4);
> 
> because it doesn't reference any metadata.
> 
> It fails on the processOrderBy(db, dbMap, crit, query);
> because this function assumes the metadata is there.
> 
> 
> Ross
> 
> 
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
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-16 Thread Greg Monroe
Sorry for the delay, out for a long weekend (gotta stay in bed on Fri 13th!).

Simple Torque Objects CAN be used with two different connection pools.  
I have done this myself.  However, there are some special limitations. I 
spent some time wandering the code and refreshing my memory and here's 
what I found.

First, you need to understand some definitions:

Simple Torque Objects - Just the core record information methods. The methods 
generated by the complexObjectModel build property (e.g. the ones which 
generate the methods to get the related foreign key and children objects) 
do not work. The autogenerated code assumes a lot about which connection
to use.

DBSchema Name - This is a string key defined via the XML schema database 
name attribute. It is used internally by Torque to tie together all the
schema "metadata" in a "DatabaseMap".  This is used by Torque to determine
things like table names, column attributes, and the like.  

DatabaseMap - This is the object that contains all the meta data *Map 
objects related to a specific DBSchema name.

DB Connection Pool Name - This is a string key that is defined in the 
Torque runtime properties, e.g. the torque.dsfactory..*
properties.  This is eventually stored in a Database object in the 
TorqueInstance.

Database Object - This is a container for information relating to a 
database, e.g. the connection pool info, the dbmap, the idbroker info,
and the like.  However, you can have a Database Object that does not
contain all this info (e.g. a Database object with just connection 
info).

Because of historical design purposes lost in antiquity, the DB Schema
name and the DB Connection Name tend to be considered to be the same.
Many of the references to "DBName" are not clearly labeled as to which
name is meant. This has lead to some poor internal coding and a lot of 
confusion.  One of the goals of Torque 4.0 is to try to correct this.

So, how do you use Simple Torque objects with multiple DBs...

First, set up your connection pools in the runtime properties.  E.g.
torque.dsfactory.databaseA.* and torque.dsfactory.databaseB.

Second, create all criteria element using the *Peer objects.  The
DatabaseMap is populated when a *Peer class is loaded (static init).
So, all tables "Maps" you will be referencing will exist in a Database 
object keyed to the DB Schema Name.  

NOTE: The dbName parameter on the Criteria constructor refers to the
DB Schema Name and NOT directly to a DB Connection Pool Name.  If there
is a DB Connection Pool defined with the same name, this will be used.

You need to write your code to use the methods that have a connection 
parameter.  E.g., TablePeer.doSelect(Criteria, Connection).

You get the connection object to use with this via the 
Toque.getConnection(String name) static method.  The name here is the
DB Connection Pool name.

To tie this all together with some sample code that will move data
from one DB to another one:

Criteria c = new Criteria();  
c.add(TableAPeer.COLA, 4);
Connection srcConn = Torque.getConnection("databaseA");
Connection destConn = Torque.getConnection("databaseB");
try {
List results = TableAPeer.doSelect(c,srcConn);
Iterator rIt = results.iterator();
while( rIt.hasNext() ) {
TableA rec = (TableA) rIt.next();
rec.save(destConn);  
}
  
} finally {
Torque.closeConnection(srcConn);
  Torque.closeConnection(destConn);
}



> -Original Message-
> From: Alvaro Coronel [mailto:alvarocorone...@yahoo.com]
> Sent: Friday, November 13, 2009 10:50 AM
> To: Apache Torque Users List
> Subject: Re: Criteria needs write permissions?
> 
> Does that mean that a Torque object can be used with two different
> connections as long as no pool is involved?
> 
> 
> 
> 
> From: Thomas Vandahl 
> To: torque-user@db.apache.org
> Sent: Fri, November 13, 2009 1:27:26 PM
> Subject: Re: Criteria needs write permissions?
> 
> On 13.11.09 08:12, Thomas Fischer wrote:
> > I'm not sure whether this is a bug or not, I need to think about it. If
> i
> > remember correctly, the database name is used for the database
> connection
> > (including credentials) and the table layout. Probably there are some
> cases
> > where this wants to be treated differently.
> 
> As I see it, the limitation is that a Torque object can only be used
> with one database connection pool. This might or might not be considered
> a bug, however, the given application type does not look typical to me.
> 
> Bye, Thomas.
> 
> -
> To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
> For additional commands, e-mail: torque-user-h...@db.apache.org
> 
> 
> 
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addresse

RE: Criteria needs write permissions?

2009-11-12 Thread Greg Monroe
OK, I think I understand what's going on here.  It's really a semi-bug
part but part a definitional issue.  This is because the term database 
name/dbname actually has two meaning in Torque.  

The first is the "schema database name", i.e. the name in your schema 
XML.  This is used to group all the database schema's Metadata in the
Database structure. 

The second meaning for this is the "database connection pool name".  This
is the name used in the runtime config to define the DB connection info.

Unfortunately, for historical reasons, these two names are "tied" 
together.  Mostly for convenience reasons... but there are a few cases 
in the utility classes where a subquery or something needs to be done
and the default DB name is used.

So, people get confused when it seems like you can't use the DB objects
with more than one database connection.  But that's not true.  To use
more than one connection pool, you need to use the methods that take a
connection object. 

To get an alternate connection, you define this in your runtime with 
a different name.  E.g. set up a different set of torque.dsfactory.
properties.

Then use the Torque.getConnection(String) to get a connection from this
pool. 

FWIW, I put forth a plan for Torque 4 to separate the connection pool
name from the schema name.  This would require objects and criteria
to track which pool they came from.
  

> -Original Message-
> From: Sheldon Ross [mailto:sr...@simmgene.com]
> Sent: Thursday, November 12, 2009 4:28 PM
> To: Apache Torque Users List
> Subject: Re: Criteria needs write permissions?
> 
> Ok, I think this maybe a bug. After watching the addTable method in
> DatabaseMap, It appears to add the table to the default database dbMap
> even if the criteria is querying against a different database.
> 
> 
> Sheldon Ross wrote:
> > That would probably work, but It seems a little overkill. Do you know
> > where the lazy loading happens?
> > When I run with r/w connection, the dbmap tables hash does appear to
> > load that way.
> > However when I run the readonly connection, it just stays empty.
> >
> > Thanks
> >
> > Greg Monroe wrote:
> >> FWIW, the dbMap object get populated in a "lazy" manner by default.
> >> However,
> >> there is a way to force it to be fully loaded via a code call.  You
> >> do this by calling:
> >>
> >> org.apache.torque.linkage.DefaultMapInit.init();
> >>
> >> Not that this class actually exists in the generated classes and not
> >> in the Torque package.  This is because it provided a "known" class
> >> that "knows" (via extension) the "user settable" om package.
> >>
> >>
> >>> -Original Message-
> >>> From: Sheldon Ross [mailto:sr...@simmgene.com]
> >>> Sent: Thursday, November 12, 2009 3:25 PM
> >>> To: Apache Torque Users List
> >>> Subject: Re: Criteria needs write permissions?
> >>>
> >>> The why is a good question, the table is not found. The tables
> hashmap
> >>> in the dbMap appears to be empty.
> >>> It of course is found when using the other db connection. It looks
> like
> >>> I'm gonna have to dig for awhile.
> >>>
> >>> Thanks.
> >>>
> >>> Thomas Fischer wrote:
> >>>
> >>>> 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 

RE: Criteria needs write permissions?

2009-11-12 Thread Greg Monroe
FWIW, the dbMap object get populated in a "lazy" manner by default.  However,
there is a way to force it to be fully loaded via a code call.  You 
do this by calling:

org.apache.torque.linkage.DefaultMapInit.init();

Not that this class actually exists in the generated classes and not
in the Torque package.  This is because it provided a "known" class
that "knows" (via extension) the "user settable" om package.

> -Original Message-
> From: Sheldon Ross [mailto:sr...@simmgene.com]
> Sent: Thursday, November 12, 2009 3:25 PM
> To: Apache Torque Users List
> Subject: Re: Criteria needs write permissions?
> 
> The why is a good question, the table is not found. The tables hashmap
> in the dbMap appears to be empty.
> It of course is found when using the other db connection. It looks like
> I'm gonna have to dig for awhile.
> 
> Thanks.
> 
> Thomas Fischer wrote:
> > 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
> >
> >
> >
> 
> --
> Sheldon Ross
> Software Development
> American Simmental Association
> sr...@simmgene.com
> (406)587-4531 ext 102
> 
> 
> -
> To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
> For additional commands, e-mail: torque-user-h...@db.apache.org

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

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



RE: Postgresql table aliases

2009-11-12 Thread Greg Monroe
I also wonder if this isn't a PostGres version issue.  If I remember the 
SQL standards correctly, the query that PostGres is choking on is perfectly
valid SQL.  PostGres, like MySQL and the like, have all been working to 
follow the SQL Standard more closely.  This could be a standards bug in
your version of PostGres.

> -Original Message-
> From: Thomas Fischer [mailto:fisc...@seitenbau.net]
> Sent: Thursday, November 12, 2009 3:22 AM
> To: Apache Torque Users List
> Subject: RE: Postgresql table aliases
> 
> I cannot reproduce this. When I run the DataTest.testUpdate in the test
> project I see the following update statement in the save() method of an
> updated author:
> 
> UPDATE author SET name = ? WHERE author_id = ?
> 
> Could you provide more detail how the update clause is produced ?
> 
>Thomas
> 
> > ...
> > Now I'm trying to migrate everything for Postgresql but the main
> problem
> > is that when
> > I execute an UPDATE query I receive an error from torque, because the
> > update query automatically
> > generated are of the form
> > update a set a.b = c;
> > that in PostgreSQL it's an error because table name can't be a prefix
> > for a column in set statement.
> >
> > Do you know how it's possible to say torque to avoid column prefix in
> > this case?
> >
> > Thanks in advance,
> > Andrea.
> >
> >
> > -
> > 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

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

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



RE: [Torque] Using Torque again

2009-11-10 Thread Greg Monroe
ot;,$path,"table",$tbl)
>
> #set ( $fname = "${firstcap}.java" )
> #set ( $path = "${strings.getPackageAsPath($extensionPath)}$fname" )
> #if (!$files.file($basePath,$path).exists())
>   $generator.parse("om/ExtensionObject.vm",$path,"table",$tbl)
> #end
>
> #set ( $fname = "${firstcap}Peer.java" )
> #set ( $path = "${strings.getPackageAsPath($extensionPath)}$fname" )
> #if (!$files.file($basePath,$path).exists())
>   $generator.parse("om/ExtensionPeer.vm",$path,"table",$tbl)
> #end
>
> #if ($tbl.Interface)
>
> #set ( $fname = "${tbl.Interface}.java" )
>     #set ( $path = "${strings.getPackageAsPath($pkbase)}$fname" )
> #if (!$files.file($basePath,$path).exists())
> $generator.parse("om/Interface.vm",$path,"table",$tbl)
> #end
>
> #end
>
> #if ($tbl.ChildrenColumn)
>   #set ($col = $tbl.ChildrenColumn)
>   #if ($col.isEnumeratedClasses())
> #foreach ($child in $col.Children)
> #set ( $fname = "${child.ClassName}.java" )
> #set ( $path = "${strings.getPackageAsPath($package)}$fname" )
> #if (!$files.file($basePath,$path).exists())
>
> $generator.parse("om/MultiExtendObject.vm",$path,"child",$child)
> #end
> #end
>   #end
> #end
>#end
>   #end
> #end
> #end
>
>
> Angela Day
> National Autism Association of Central Texas
>
> http://www.naacentraltexas.org
> formally FEAT Austin
>
>
> 
> From: Greg Monroe 
> To: Apache Torque Users List 
> Sent: Mon, November 9, 2009 5:02:48 PM
> Subject: RE: [Torque] Using Torque again
>
> Read this after I sent all the other stuff...
>
> About templates:
>
> The default is for the templates to come from the torque-gen-
> templates.jar.
> As long as this is in the generator library (e.g. lib directory under
> build-torque.xml file) it should find it.
>
> About build.properties:
>
> This generally should not be empty.  At a minimum, you should copy the
> one from the distro to the same directory as the build-torque.xml file.
> Then go thru that and change basic stuff.  E.g. torque.project,
> torque.database, torque.targetPackage, and the torque.database.*
> properties.
>
> The other stuff you can look at the generator properties reference to
> understand, decide what to do with it.
>
> http://db.apache.org/torque/releases/torque-3.3/generator/properties-
> reference.html
>
> > -Original Message-
> > From: Angela Day [mailto:akc...@yahoo.com]
> > Sent: Monday, November 09, 2009 5:52 PM
> > To: Apache Torque Users List
> > Subject: Re: [Torque] Using Torque again
> >
> > Ok, I see how it works.  templatePath is defined as templates in the
> > default.properties file.  There is a directory called src/templates.  I
> > am assuming that it what it is pointing to.  Do I need to update
> > something in that directory maybe?
> >
> >
> > Angela Day
> > National Autism Association of Central Texas
> >
> > http://www.naacentraltexas.org
> > formally FEAT Austin
> >
> >
> >
> >
> >
> > 
> > From: Angela Day 
> > To: Apache Torque Users List 
> > Sent: Mon, November 9, 2009 4:47:47 PM
> > Subject: Re: [Torque] Using Torque again
> >
> >
> > Sheldon,
> > In reviewing that section of code 'torque.templatePath' is not defined.
> > It is not defined in the template from the zip file, so I am not sure
> > what the value should be.  I think that is the line on which it is
> > failing.
> > Would you know?
> > Thanks,
> >
> >
> > Angela Day
> > National Autism Association of Central Texas
> >
> > http://www.naacentraltexas.org
> > formally FEAT Austin
> >
> >
> >
> >
> >
> > 
> > From: Sheldon Ross 
> > To: Apache Torque Users List 
> > Sent: Mon, November 9, 2009 4:28:24 PM
> > Subject: Re: [Torque] Using Torque again
> >
> > Ok, ant uses xml in order to define tasks. These tasks are called
> > targets. In my file the target around lines 500-530 are the targets for
> > building your OM objects, which I assume you're trying to do.
> >
> > In those targets are references to files and properties that the target
> > needs to execute.
> >
> > From my xml.
> >
> > 

RE: [Torque] Using Torque again

2009-11-09 Thread Greg Monroe
Read this after I sent all the other stuff...

About templates:

The default is for the templates to come from the torque-gen-templates.jar.
As long as this is in the generator library (e.g. lib directory under
build-torque.xml file) it should find it.

About build.properties:

This generally should not be empty.  At a minimum, you should copy the
one from the distro to the same directory as the build-torque.xml file.
Then go thru that and change basic stuff.  E.g. torque.project,
torque.database, torque.targetPackage, and the torque.database.* 
properties.

The other stuff you can look at the generator properties reference to 
understand, decide what to do with it.

http://db.apache.org/torque/releases/torque-3.3/generator/properties-reference.html

> -Original Message-
> From: Angela Day [mailto:akc...@yahoo.com]
> Sent: Monday, November 09, 2009 5:52 PM
> To: Apache Torque Users List
> Subject: Re: [Torque] Using Torque again
> 
> Ok, I see how it works.  templatePath is defined as templates in the
> default.properties file.  There is a directory called src/templates.  I
> am assuming that it what it is pointing to.  Do I need to update
> something in that directory maybe?
> 
> 
> Angela Day
> National Autism Association of Central Texas
> 
> http://www.naacentraltexas.org
> formally FEAT Austin
> 
> 
> 
> 
> 
> 
> From: Angela Day 
> To: Apache Torque Users List 
> Sent: Mon, November 9, 2009 4:47:47 PM
> Subject: Re: [Torque] Using Torque again
> 
> 
> Sheldon,
> In reviewing that section of code 'torque.templatePath' is not defined.
> It is not defined in the template from the zip file, so I am not sure
> what the value should be.  I think that is the line on which it is
> failing.
> Would you know?
> Thanks,
> 
> 
> Angela Day
> National Autism Association of Central Texas
> 
> http://www.naacentraltexas.org
> formally FEAT Austin
> 
> 
> 
> 
> 
> 
> From: Sheldon Ross 
> To: Apache Torque Users List 
> Sent: Mon, November 9, 2009 4:28:24 PM
> Subject: Re: [Torque] Using Torque again
> 
> Ok, ant uses xml in order to define tasks. These tasks are called
> targets. In my file the target around lines 500-530 are the targets for
> building your OM objects, which I assume you're trying to do.
> 
> In those targets are references to files and properties that the target
> needs to execute.
> 
> From my xml.
> 
>  contextProperties="${torque.contextProperties}"
>  controlTemplate="${torque.template.dataDtd}"
>  outputDirectory="${torque.output.dir}"
>  outputFile="report.${torque.project}.datadtd.generation"
>  templatePath="${torque.templatePath}"
>  useClasspath="${torque.useClasspath}"
>  xmlFile="${torque.schema.dir}/${torque.project}-schema.xml"
>/>
> 
> The "${torque.contextProperties}" file must be defined and exist (and
> path be right) for this to execute properly If it doesn't you will get
> errors such as you report.
> 
> Ross
> 
> Angela Day wrote:
> > No, I just replaced the build-torque.xml file with the one from torque-
> 3.3.zip and just made a few little adjustments on the jar files in the
> classpath.  I updated all of my jar files to be at least as high as the
> dependencies list from the torque website.  I updated my xxx-schema.xml
> to point to the correct database_3_3.xml file.  Did I leave anything out?
> >
> > Thanks,
> >
> >  Angela Day
> > National Autism Association of Central Texas
> >
> > http://www.naacentraltexas.org
> > formally FEAT Austin
> >
> >
> >
> >
> >
> > 
> > From: Sheldon Ross 
> > To: Apache Torque Users List 
> > Sent: Mon, November 9, 2009 3:51:30 PM
> > Subject: Re: [Torque] Using Torque again
> >
> > >From what I understand, in newer versions of torque you should really
> not be editing much in the build-torque.xml itself.
> >
> > At the top of your file, there should be something like this.
> >
> > 
> > 
> > 
> >
> > This specifies the properties file torque will use for configuration.
> I'm guessing you either don't have these lines defined correctly, or the
> (in this example) "build.properties" file doesn't exist.
> >
> >
> > Ross
> >
> > Angela Day wrote:
> >
> >> Never mind.  I realized I was missing the torque-gen-templates-
> 3.3.jar.  But I am still getting the original error:
> >>
> >> Exception thrown by 'properties.load'
> >>
> >> I have updated all of my jar files and specified them in the build-
> torque.xml file.  I have updated my (project)-build.xml file.  I am not
> getting any complaints about any of these files.  Any Help would be
> appreciated.
> >>
> >> Thanks,
> >>
> >>  Angela Day
> >> National Autism Association of Central Texas
> >>
> >> http://www.naacentraltexas.org
> >> formally FEAT Austin
> >>
> >>
> >>
> >>
> >>
> >> 
> >> From: Angela Day 
> >> To: Apache Torque Users List 
> >> Sent: Mon, November 9, 2009 3:18:29 PM
> >> Subject: Re: [Torque] Using Torque a

RE: [Torque] Using Torque again

2009-11-09 Thread Greg Monroe
Only things I can think of are:

- Make sure the "default.properties" file is in the same directory as the 
  torque-build.xml.  Not sure this is still used, but it could be needed
  somewhere.

- Find the velocity.log file (probably in your project root directory) and 
  see if there is any more info there.

- Validate your xxx-schema.xml against the new DTD (E.g. load it in IE and 
  see if any errors occur.)

- You said "updated all my jar files"...  Did that include the Texen and 
  Velocity versions used by the generator?  I think Texan and/or Velocity
  have made some changes since 3.3 was released.  There could be a problem
  if newer versions are used.

  Note that the libraries used to run the generator tasks only needed for 
  ant processes and don't need to be there for your application to compile
  or run (but you do need the libraries in the runtime package). You should
  make sure that the generator is only seeing the versions that come with 
  the distribution.

  You can separate the build jars from your compile library by using the
  torque.lib.dir property in the build.properties.  It defaults to "lib"
  but you can set it to something like "genlib" and put all the jars from
  the generator package lib in this.

- Try simplifying what is going on.  E.g. unpack the generator distro
  into a new directory, copy your xxx-schema.xml to the src/schema
  directory.  Modify the default build.properties to meet your needs.
  Then try a few of the ant tasks with ant -f build.torque.xml

  If things work there, look at how you've added torque to your project.
   

> -Original Message-
> From: Angela Day [mailto:akc...@yahoo.com]
> Sent: Monday, November 09, 2009 4:57 PM
> To: Apache Torque Users List
> Subject: Re: [Torque] Using Torque again
> 
> No, I just replaced the build-torque.xml file with the one from torque-
> 3.3.zip and just made a few little adjustments on the jar files in the
> classpath.  I updated all of my jar files to be at least as high as the
> dependencies list from the torque website.  I updated my xxx-schema.xml
> to point to the correct database_3_3.xml file.  Did I leave anything out?
> 
> Thanks,
> 
> 
> Angela Day
> National Autism Association of Central Texas
> 
> http://www.naacentraltexas.org
> formally FEAT Austin
> 
> 
> 
> 
> 
> 
> From: Sheldon Ross 
> To: Apache Torque Users List 
> Sent: Mon, November 9, 2009 3:51:30 PM
> Subject: Re: [Torque] Using Torque again
> 
> From what I understand, in newer versions of torque you should really
> not be editing much in the build-torque.xml itself.
> 
> At the top of your file, there should be something like this.
> 
> 
> 
> 
> 
> This specifies the properties file torque will use for configuration.
> I'm guessing you either don't have these lines defined correctly, or the
> (in this example) "build.properties" file doesn't exist.
> 
> 
> Ross
> 
> Angela Day wrote:
> > Never mind.  I realized I was missing the torque-gen-templates-3.3.jar.
> But I am still getting the original error:
> >
> > Exception thrown by 'properties.load'
> >
> > I have updated all of my jar files and specified them in the build-
> torque.xml file.  I have updated my (project)-build.xml file.  I am not
> getting any complaints about any of these files.  Any Help would be
> appreciated.
> >
> > Thanks,
> >
> >
> > Angela Day
> > National Autism Association of Central Texas
> >
> > http://www.naacentraltexas.org
> > formally FEAT Austin
> >
> >
> >
> >
> >
> > 
> > From: Angela Day 
> > To: Apache Torque Users List 
> > Sent: Mon, November 9, 2009 3:18:29 PM
> > Subject: Re: [Torque] Using Torque again
> >
> > I have been updating the build-torque.xml file and am now getting:
> >
> > C:\workspace\contract\build-torque.xml:96: taskdef class
> org.apache.torque.task.TorqueDataModelTask cannot be found
> > I have warning decoration next to all of the taskdefs.  In what jar are
> these classes found?
> >
> >
> > Thanks,
> >
> > Angela Day
> > National Autism Association of Central Texas
> >
> > http://www.naacentraltexas.org
> > formally FEAT Austin
> >
> >
> >
> >
> >
> > 
> > From: Sheldon Ross 
> > To: Apache Torque Users List 
> > Sent: Mon, November 9, 2009 3:00:29 PM
> > Subject: Re: [Torque] Using Torque again
> >
> > It would appear that there are significant differences in the
> build.properties file (and/or build-torque.xml) from 1.0 to 3.3.
> >
> > My suggestion is to redo your old 1.0 build.properties file and make
> sure it is of the proper form for 3.3 and use xml from 3.3
> >
> > Ross
> >
> > Angela Day wrote:
> >
> >> I am trying to upgrade from Torque 1.0 to 3.3.  I have replaced all of
> the jar files and made sure my dependencies were covered.  It is an
> existing application that
> >> was working until I converted, so I know it is finding the project-
> schema.xml file
> >> correctly.  This question is posted on the
> >> internet mu

RE: Connection parameter

2009-11-09 Thread Greg Monroe
Not exactly sure what you are trying to do here.. but in general, the
Base classes are simply data containers.  The Peer classes are the
ones that fill the Base classes.  These have methods that take will
take a connection object.  The one exception to this is the Base save
method which can take a connection E.g., using some java5 style code...

Connection conn = Torque.getConnection("dbConnectionName");
Criteria c = new Criteria();
c.add(MyTablePeer.ColA, 1);
List results = doSelect(c, conn);

That said, if you're trying to add a "load" type function to the base
class.  You can do this by using code like that above and then
populating the object from the results.

FWIW, I tend to consider stuff like this part of the business logic
and make a quick wrapper class in a different package.  E.g. an
internal MyTable property that is used with get and set methods. This
will have different "load" or constructors to populate it.  The 
advantage to this is that if your business logic or DB structure 
changes so that the Foo object now need to be a combo of info from
different tables, it's easy to modify this object and all other code 
still works.


> -Original Message-
> From: David Urbansky [mailto:davidurban...@googlemail.com]
> Sent: Monday, November 09, 2009 10:25 AM
> To: torque-user@db.apache.org
> Subject: Connection parameter
> 
> Hello,
> 
> I am using torque-gen 3.3 to generate the java model for the database
> (ant
> -f build-torque.xml). I know that it is possible to generate methods for
> the
> Base classes that also allow a connection parameter but I can not find
> the
> setting for that. So what I want is this:
> 
> public void getABC(String t) {
>  ...
> }
> 
> AND also
> 
> public void getABC(String t, Connection conn) {
> ...
> }
> 
> After generating the model I only have the first method without the
> connection parameter, does anybody know what I have to do to get the
> second
> method with the conneciton parameter too?
> 
> Thank you very much,
>   David
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

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



RE: maven torque:insert-sql fails: org/apache/tools/ant/PropertyHelper

2009-10-22 Thread Greg Monroe
Sorry, not a big Maven user so I can't help with the specific Maven setup
problems.

FWIW, Torque isn't tied to Maven. It just makes it easier and has been 
the focus of the folks who document stuff. I've always used it with the 
included Ant xml (build-torque.xml).  It's easy to make calls to this
from our main ant build scripts.  Here's the set up I generally use:

Project Directories:

/build (all things needed just to build but not run stuff).
/build/torque (everything from the torque-gen distro)

In the torque directory is a build.properties file with all the setting
needed to generate stuff.

Here's some code to put in your main ant script to generate the OM code
and DB SQL scripts (if needed).  Just include the om target as a 
dependency in your main compile target(s):


  


  

   

  

  
  

  


==

Now about Hibernate vs Torque... let's see... suppose you make a bunch 
of changes to the DB design.  

With Torque, just change a single XML schema files, recreate the OM layers 
via the build process, solve any compile issues (E.g. columns that
have been dropped or had a name change), use the Apache DDLUtil project to 
update any existing SQL DB server from the new XML (Toque and DDLUtil 
share the XML schema format) or create a new set of tables from the 
generated SQL script (or ant target)   You're done.

With Hibernate... hope you can finds all the places in the XML that refer
to the SQL changes. Hand modify all your code to change the names or 
remove the properties.  Hand write the SQL to create your new tables. 
Create a set of SQL update scripts for any existing DB (OK you can cheat
and use DDLUtil for this...)  Fix all the places that you missed as
bug reports come in...

Bottom line, IMHO, Torque may have a slightly higher start up cost to 
figure out how to get the build environment working... but overall it
will save you LOTS of development time...  But I'm biased :) 

> -Original Message-
> From: Jon August [mailto:j...@internection.com]
> Sent: Thursday, October 22, 2009 8:21 AM
> To: Apache Torque Users List
> Subject: Re: maven torque:insert-sql fails:
> org/apache/tools/ant/PropertyHelper
> 
> 
> I'll take that as a "read up on Hibernate".
> 
> 
> On Oct 22, 2009, at 8:14 AM, Alvaro Coronel wrote:
> 
> > Yeah, I love maven too ... NOT!
> >
> >
> >
> > 
> > From: Jon August 
> > To: Apache Torque Users List 
> > Sent: Thu, October 22, 2009 10:02:58 AM
> > Subject: Re: maven torque:insert-sql fails: org/apache/tools/ant/
> > PropertyHelper
> >
> > Alvaro,
> >
> > Thanks for your response.  My $CLASSPATH is empty and I don't know
> > where maven sets or gets it's classpath.  Where would I look to see
> > if it's duplicating  in the classpath...
> >
> > -Jon
> >
> >
> >
> > On Oct 22, 2009, at 8:00 AM, Alvaro Coronel wrote:
> >
> >> I didn't follow this thread from the start, so forgive me if I am
> >> wrong.
> >>
> >> I have seen many errors related to classes not found that were
> >> triggered by a duplication of the class.
> >>
> >> So not only do you have to check that it is included in the
> >> classpath. You also have to check that it is not included twice or
> >> more in the classpath.
> >>
> >> Hope this helps,
> >> Álvaro
> >>
> >>
> >>
> >> 
> >> From: Jon August 
> >> To: Apache Torque Users List 
> >> Sent: Thu, October 22, 2009 5:36:24 AM
> >> Subject: Re: maven torque:insert-sql fails: org/apache/tools/ant/
> >> PropertyHelper
> >>
> >> I had followed the directions for 3.3, but when I do this:
> >>
> >> maven plugin:download -DartifactId=maven-torque-plugin -
> >> DgroupId=torque -Dversion=3.2
> >>
> >> everything works fine...  Something wrong with 3.3?
> >>
> >>
> >>
> >>
> >>
> >> On Oct 22, 2009, at 1:06 AM, Jon August wrote:
> >>
> >>> I'm really stuck on this.  Clearly from the NoClassDefFound error
> >>> below in my last message, you would assume maven can't find ant...
> >>>
> >>> BUT, here it is in the local maven repository:
> >>> Mac:jars jon$ ls -al
> >>> total 2528
> >>> drwxr-xr-x  4 jon  staff  136 Oct 20 04:09 .
> >>> drwxr-xr-x  3 jon  staff  102 Oct 20 04:09 ..
> >>> -rw-r--r--  1 jon  staff  1289806 Oct 20 04:09 ant-1.7.0.jar
> >>> -rw-r--r--  1 jon  staff   75 Oct 20 04:09 ant-1.7.0.jar.md5
> >>>
> >>> Mac:jars jon$ pwd
> >>> /Users/jon/.maven/repository/org.apache.ant/jars
> >>>
> >>> AND, here it is in the path:
> >>> Mac:BizDirectory jon$ echo $PATH
> >>> /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/
> >>> local/maven-1.0.2/bin:/usr/local/apache-ant-1.7.0/bin:/
> >>> Applications/Mkvtoolnix.app/Contents/MacOS/
> >>>
> >>> AND, the library:
> >>> Mac:BizDirectory jon$ cd /usr/local/apache-ant-1.7.0/lib
> >>>
> >>> Mac:lib jon$ ls -al ant.jar
> >>> -rw-r--r--@ 1 jon  staff  1289806 Dec 13  2006 ant.jar
> >>>
> >>> Mac:lib jon$ jar -tvf ant.jar |grep PropertyHelper
> >>> 7526 Wed Dec 13 07:15:02 EST 2006 org/ap

RE: Primary key is set to the foreign key value

2009-09-03 Thread Greg Monroe
Hmm, only thing that I can think of is that you are using the
id broker method to autoincrement the numeric ids.  This may be
replacing the SSN with a number when you save the object.  Try 
adding the following attribute to your SSN column:

autoIncrement="false"

You might also consider using the "native" mode for autoincrement
as most modern SQL servers support this and it's faster and more
reliable than the idBroker code.

Also, from a general design perspective, you might want to add a 
separate ID column the Person_SSN table rather than use the SSN as 
the primary key. You can get into legal trouble is you pass SSN's 
around as keys and they become visible.  Much safer to have a 
unique ID not related to the SSN that can be passed.

> -Original Message-
> From: levko [mailto:lev.koza...@yahoo.com]
> Sent: Thursday, September 03, 2009 4:44 PM
> To: torque-user@db.apache.org
> Subject: Primary key is set to the foreign key value
> 
> 
> I have very simple DB schema, where the 1st table (Person) has PK 'id'
> and
> the 2nd table (Person_SSN) has FK 'person_id' referring to the 'id' field
> of
> the 'Person' table. The 'Person_SSN' table has its own PK 'ssn':
> 
> 
>   
>javaName="PersonId"
>   required="true"
>   primaryKey="true"
>   type="INTEGER"
>   description="Person ID"/>
>javaName="FullName"
>   required="true"
>   type="VARCHAR" size="128"
>   description="Full Name"/>
>javaName="EMailAddress"
>   required="true"
>   type="VARCHAR" size="128"
>   description="EMail Address"/>
> 
>   
> 
>   
>   
>javaName="PersonId"
>   required="true"
>   type="INTEGER"
>   description="Foreign key Person"/>
>required="true"
>   primaryKey="true"
>   type="CHAR" size="9"
>   description="SSN"/>
> 
>   
> 
>   
> 
> 
> When I create 'PersonSsn' object, I set SSN to '123456789', but the DB
> record shows that  SSN value is the same as the PERSON_ID value. I use
> Torque 3.3 and PostgreSQL 8.4.0.
> 
> Could you, please, help me to understand what's the problem here?
> I've uploaded the source files. The test driver is in the lk.test.TestOM
> class.
> 
> Thanks in advance for any idea,
> -- Lev http://www.nabble.com/file/p25283761/Test.zip Test.zip
> --
> View this message in context: http://www.nabble.com/Primary-key-is-set-
> to-the-foreign-key-value-tp25283761p25283761.html
> Sent from the Apache DB - Torque Users mailing list archive at
> Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
> For additional commands, e-mail: torque-user-h...@db.apache.org

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

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



RE: Fwd: no DataSourceFactory configured for the connection

2009-08-26 Thread Greg Monroe
Based on the fact that the "no DataSourceFactory configured.." message 
is probably using the Torque.getDefaultDB() to get the "DATABASE" string,
I think that you are probably not getting the config file you think your 
are.

You mentioned Turbine. I don't use this so there may be some config 
file related to this that needs to include or point to your Torque config
file info.  The generic word "DATABASE" makes me think this is some 
default placeholder in Turbine.  I know it's not in Torque.

One thing that might be happening is that the commons Configuration
objects used by Torque (and probably Turbine) may do some searching
thru the classpath and other locations to find a file.  

As to the "SQL not complete" message, this is as designed.  A Criteria
object is a template for an SQL string.  It is combined with the 
specific Table object to create the final SQL string.  So, a 
Criteria.toString() call will show you the template but this 
may not be a working SQL string that you can use to test with.

> -Original Message-
> From: Emmanuel Bardet [mailto:ebar...@bardet-u2ee.com]
> Sent: Wednesday, August 26, 2009 3:24 AM
> To: Apache Torque Users List
> Subject: Re: Fwd: no DataSourceFactory configured for the connection
> 
> Hello there,
> 
> As per the criteria not showing any sql statement, this is all fine as
> you
> did not provide any information to the Criteria object.  Hence, it does
> not show anything.  Have a look at the way you can use it at
> http://db.apache.org/torque/releases/torque-3.3/tutorial/step5.html
> 
> Hope that helps.
> 
> E
> 
> > Sir
> > Very very thanks Greg Monroe to reply
> > I did all changes according to the given doc on below link:
> > http://db.apache.org/torque/releases/torque-
> 3.3/runtime/reference/initialisation-configuration.html
> > Still i am facing that torque is not initialized.
> >
> > torque.properties are as below
> >
> > torque.database.default=brihaspati
> > torque.database.brihaspati.adapter=mysql
> >
> >
> torque.dsfactory.brihaspati.factory=org.apache.torque.dsfactory.SharedPoo
> lDataSourceFactory
> > torque.dsfactory.brihaspati.connection.driver = org.gjt.mm.mysql.Driver
> > torque.dsfactory.brihaspati.connection.url =
> > jdbc:mysql://localhost:3306/brihaspati
> > torque.dsfactory.brihaspati.connection.user = etrg
> > torque.dsfactory.brihaspati.connection.password = brihaspatigroup
> > torque.dsfactory.brihaspati.pool.maxActive=10
> > torque.dsfactory.brihaspati.pool.testOnBorrow=true
> > torque.dsfactory.brihaspati.pool.validationQuery=SELECT 1
> > Second thing is that while i am using and trying to write
> > org.apache.torque.util.Criteria  obj to debug like below,
> > Criteria crit = new Criteria();
> > It is showing :
> > crit.=Criteria::
> > Current Query SQL (may not be complete or applicable):
> >
> >
> > On 8/25/09, Greg Monroe  wrote:
> >>
> >> By migrated I assume you mean from an older version of Torque.
> >> Most likely it was a version prior to the properties file revamp
> >> that took place in Version 3.1 (I think).
> >>
> >> If this is true, you will need to modify your Torque runtime
> >> configuration properties file to the new format. See:
> >>
> >>
> >> http://db.apache.org/torque/releases/torque-
> 3.3/runtime/reference/initialisation-configuration.html
> >>
> >> If this isn't the case, please supply more details.
> >>
> >>
> >> > -Original Message-
> >> > From: Shaista Shekh [mailto:shaista.sh...@gmail.com]
> >> > Sent: Tuesday, August 25, 2009 1:25 AM
> >> > To: torque-user@db.apache.org
> >> > Subject: no DataSourceFactory configured for the connection
> >> >
> >> > I have migrated turbine 2.3.3 with ant.
> >> > While I start the webserver/applicationserver everything works fine
> >> >  i am trying to logged in it is showing below given error in log
> file.
> >> >
> >> > "There was no DataSourceFactory configured for the connection
> >> > DATABASE"
> >> > Please guide me in this regard
> >> > Thanking you
> >>
> >> DukeCE Privacy Statement:
> >> Please be advised that this e-mail and any files transmitted with
> >> it are confidential communication or may otherwise be privileged or
> >> confidential and are intended solely for the individual or entity
> >> to whom they are addressed. If you are not the intended recipient
> >> you may not rely on 

RE: no DataSourceFactory configured for the connection

2009-08-25 Thread Greg Monroe
By migrated I assume you mean from an older version of Torque.
Most likely it was a version prior to the properties file revamp 
that took place in Version 3.1 (I think). 

If this is true, you will need to modify your Torque runtime 
configuration properties file to the new format. See:

http://db.apache.org/torque/releases/torque-3.3/runtime/reference/initialisation-configuration.html

If this isn't the case, please supply more details.

> -Original Message-
> From: Shaista Shekh [mailto:shaista.sh...@gmail.com]
> Sent: Tuesday, August 25, 2009 1:25 AM
> To: torque-user@db.apache.org
> Subject: no DataSourceFactory configured for the connection
> 
> I have migrated turbine 2.3.3 with ant.
> While I start the webserver/applicationserver everything works fine
>  i am trying to logged in it is showing below given error in log file.
> 
> "There was no DataSourceFactory configured for the connection
> DATABASE"
> Please guide me in this regard
> Thanking you
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

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



RE: multiple criteria on the same field

2009-05-08 Thread Greg Monroe
For more information see the documentation at:

http://db.apache.org/torque/releases/torque-3.3/runtime/reference/read-from-db.html#AND_and_OR_operators


> -Original Message-
> From: Andras Balogh [mailto:and...@reea.net]
> Sent: Friday, May 08, 2009 5:52 AM
> To: Apache Torque Users List
> Subject: Re: multiple criteria on the same field
> 
> Hi,
> 
> You need to do something like:
> 
> criteria.add( dataIscrizioneInizio.and(dataIscrizioneFine)  ) ;
> 
> to add both Criterions in the same time to the Criteria.
> 
> Best regards,
> Andras
> 
> 
> Ivano Luberti wrote:
> > Hello , I have searched the ml and googled for this.
> > I have found 2 old email asking for this but with no answer.
> >
> > When I try to do this :
> >
> > Criteria criteria = new Criteria();
> > Criterion dataIscrizioneInizio =
> > criteria.getNewCriterion(IscrizioniSocioPeer.TABLE_NAME, "starttime",
> > (Date) (formUser.getDataIscrizioneInizio()), Criteria.GREATER_EQUAL);
> >
> >
> > dataIscrizioneInizio.setIgnoreCase(true);
> >
> > criteria.add(dataIscrizioneInizio);
> >
> > Criterion dataIscrizioneFine =
> > criteria.getNewCriterion(IscrizioniSocioPeer.TABLE_NAME, "starttime",
> > (Date) (formUser.getDataIscrizioneFine()), Criteria.LESS_EQUAL);
> >
> > dataIscrizioneFine.setIgnoreCase(true);
> >
> > criteria.add(dataIscrizioneFine);
> >
> > Only the last criterion is included in the where clause.
> >
> > I have stepped into the add(Criterion) method of the Criteria class and
> > found this:
> >
> > public Criteria add(Criterion c)
> > {
> > StringBuffer sb = new StringBuffer(c.getTable().length()
> > + c.getColumn().length() + 1);
> > sb.append(c.getTable());
> > sb.append('.');
> > sb.append(c.getColumn());
> > super.put(sb.toString(), c);
> > return this;
> > }
> >
> > If I understand well , the map keys are based on the table and field
> > names then it is not possible to add two criteria on the same field to
> > produce sql like:
> >
> > SELECT * FROM table WHERE table.field>x AND table.field >
> > Can someone suggest the best practice to do this with Torque ?
> >
> >
> >
> 
> 
> -
> To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
> For additional commands, e-mail: torque-user-h...@db.apache.org
> 

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

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



RE: upgrading to torque 3.3

2009-04-24 Thread Greg Monroe
As Thomas F. said, there are no written guides for this.

However, if I remember right, you will need to first make sure that
your XML matches the new DTD.  There probably have been some changes
between those versions.

Second, you will need to review and translate your build and
runtime configuration property files to the new version.  Somewhere
around 3.1 or 3.2 there was a significant restructuring of the
keys used for these.

This should get you to a workable set of DB classes.  You may then
see some compile issues if there have been any major changes in how
the new generated code interacts with your code.  You might also be
on the lookout for any use of Deprecated methods, etc.

As always, with a major shift like this... test, test, test...

> -Original Message-
> From: zoicas [mailto:zoi...@medialab.sissa.it]
> Sent: Friday, April 24, 2009 6:00 AM
> To: torque-user@db.apache.org
> Subject: upgrading to torque 3.3
> 
> Hello all
> 
> We have a software project using torque 3.0 and mysql 4.0.24. Could
> somebody
> tell  me if  there  is any documentation  regarding  upgrading  torque
> from
> version 3.0 to version 3.3?
> 
> regards
> rst
> 
> -
> To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
> For additional commands, e-mail: torque-user-h...@db.apache.org
> 

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

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



RE: Maven2 plugin and build property overrideDir

2009-03-12 Thread Greg Monroe
Did a little research into this and found what MAY be a quick
work-around.  Not sure it's the final method and I haven't 
tested it, but it should work.

Basically, you can define "system" scope dependencies in Maven
Poms. There are things that just get added to all goal class
paths and can point to any directory on the system.  So, you
could add your template overrides as a system dependency.  E.g.:

...

  

  my.torque.overrides
  templateDir
  0.1
  system
  ${basedir}/src/template/myTemplates.jar

... 

  


Notes: 

- The ${basedir} property is the directory containing the pom.xml
- Maven says it "checks for the existence of the file" pointed to 
  by the systemPath tag.  It might be possible use a directory
  rather than a jar.


> -----Original Message-
> From: Greg Monroe [mailto:greg.mon...@dukece.com]
> Sent: Wednesday, March 11, 2009 3:43 PM
> To: 'Apache Torque Users List'
> Subject: RE: Maven2 plugin and build property overrideDir
> 
> You're correct, it isn't currently supported.  If I remember
> right, there was an issue with Maven 2 not letting you easily
> modify a Mojo's class path (at least at the time the plug-in
> was built).  That's how the overrideDir is being implemented
> in Maven 1.
> 
> Full support of Maven 2 is one of the objectives of 4.0. In
> fact, one of the developers (Thomas V) just asked recently
> about this feature... and that led me to start looking at
> Maven2 coding.  No promises, but if I can find some time
> I might work some on this (unless someone's already
> doing it...)
> 
> > -Original Message-
> > From: Emmanuel Bardet [mailto:ebar...@bardet-u2ee.com]
> > Sent: Wednesday, March 11, 2009 12:50 PM
> > To: torque-user@db.apache.org
> > Subject: Maven2 plugin and build property overrideDir
> >
> > Hello there,
> >
> > It seems the overrideDir property is not being used by the Maven2
> > plugin.  Is this right?  If so, is there any plan to add it to a later
> > version?
> >
> > Thanks,
> >
> > Emmanuel
> >
> > -
> > To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
> > For additional commands, e-mail: torque-user-h...@db.apache.org
> >
> 
> DukeCE Privacy Statement:
> Please be advised that this e-mail and any files transmitted with
> it are confidential communication or may otherwise be privileged or
> confidential and are intended solely for the individual or entity
> to whom they are addressed. If you are not the intended recipient
> you may not rely on the contents of this email or any attachments,
> and we ask that you please not read, copy or retransmit this
> communication, but reply to the sender and destroy the email, its
> contents, and all copies thereof immediately. Any unauthorized
> dissemination, distribution or copying of this communication is
> strictly prohibited.
> 
> -
> 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: Maven2 plugin and build property overrideDir

2009-03-11 Thread Greg Monroe
You're correct, it isn't currently supported.  If I remember 
right, there was an issue with Maven 2 not letting you easily 
modify a Mojo's class path (at least at the time the plug-in
was built).  That's how the overrideDir is being implemented
in Maven 1.

Full support of Maven 2 is one of the objectives of 4.0. In
fact, one of the developers (Thomas V) just asked recently
about this feature... and that led me to start looking at
Maven2 coding.  No promises, but if I can find some time
I might work some on this (unless someone's already 
doing it...)

> -Original Message-
> From: Emmanuel Bardet [mailto:ebar...@bardet-u2ee.com]
> Sent: Wednesday, March 11, 2009 12:50 PM
> To: torque-user@db.apache.org
> Subject: Maven2 plugin and build property overrideDir
> 
> Hello there,
> 
> It seems the overrideDir property is not being used by the Maven2
> plugin.  Is this right?  If so, is there any plan to add it to a later
> version?
> 
> Thanks,
> 
> Emmanuel
> 
> -
> To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
> For additional commands, e-mail: torque-user-h...@db.apache.org
> 

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

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



RE: Multiple addJoin with OR

2009-03-02 Thread Greg Monroe
You might be able to do this using custom criteria instead
of a join. See details in the "Reading from the DB" section
of the Runtime Reference.  I'd suggest constructing the
string using the Peer static variables for greatest protection
from table modification.

You may also need to add the extra tables via an addAlias 
or other method as well.

As an aside, you might want to consider the long term 
"readability / maintenance" side of design. CPU cycles 
are no longer precious items to be miserly with by 
developing complex single queries, which often come back
to bite you when data condition not tested for are
encountered.  

Doing things with easily understandable multiple queries 
often doesn't take more time than a single complex query 
that doesn't have indices optimized for it.  And if 
future changes or fixes are needed, they can be done 
faster since the logic is clear.

Of course, that depends on your needs. e.g., this query is 
being called VERY frequently (e.g. multiple times on a home
page) then go for it. 

> -Original Message-
> From: Ludwig Magnusson [mailto:lud...@itcatapult.com]
> Sent: Monday, March 02, 2009 9:02 AM
> To: 'Apache Torque Users List'
> Subject: RE: Multiple addJoin with OR
> 
> 
> -Original Message-
> From: Thomas Fischer [mailto:fisc...@seitenbau.net]
> Sent: den 2 mars 2009 14:54
> To: Apache Torque Users List
> Subject: RE: Multiple addJoin with OR
> 
> > > I want to create an SQLQuery that combines data from three tables.
> Right
> > > now, my javacode looks like this:
> > >
> > > Criteria.addJoin(TableA.id, TableB.fk);
> > > Criteria.addJoin(TableA.id, TableC.fk);
> > >
> > > This results in this SQL query:
> > >
> > > WHERE TableA.id = TableB.fk
> > >
> > > AND TableA.id = TableC.fk
> > >
> > > However, this is not the result I need. What I need is a query with
> OR
> > > instead of AND, like this:
> > >
> > > WHERE TableA.id = TableB.fk
> > >
> > > OR TableA.id = TableC.fk
> > >
> > > I haven't found any way to do this using criteria. Is it possible?
> >
> > I do not know a way to do this currently. But are you really sure your
> > statement makes sense ? If one row in table B matches, then you get all
> > rows of table C joined (or vice versa), and I cannot imagine this is
> what
> > you need. But I might be wrong.
> >
> >  Thomas
> >
> > It does make sense. I rewrote the query by hand (changed AND to OR) and
> > executed it in the MySql console and it gave the response I wanted.
> >
> > The situation is kind of like this:
> > Table a is a category table, it only contains ids and names of
> categories.
> > Table B is a "products sold" table, and table C is a "products bought"
> > table. All products belong to a certain category, and I want a query
> that
> > gives me all the categories that a certain user has sold/bought
> products
> > from.
> >
> > /Ludwig
> >
> 
> Ok, you have additional constraints on B and C; then this makes more
> sense.
> What you can do is to split this to 3 queries:
> - Select the categories from A
> - add the categories from B
> - Do a select on the products table with the result.
> The only performance disadvantage is that you have 3 queries.
> 
> Alternatively you could reformulate your query using subselects, which is
> supported in Torque 3.3.
> 
> Thomas
> 
> Yes, the problem is always solveable, but it would be nice to be able to
> do
> it in one criteria. I will use a temporary solution for now however.
> /Ludwig
> 
> 
> -
> To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
> For additional commands, e-mail: torque-user-h...@db.apache.org
> 

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

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



RE: Problem with ID Table

2009-02-16 Thread Greg Monroe
I think the quick fix for this is to add the id-table-schema.xml file
as an external-schema in your main DB schema file.  E.g.




This should make the datadump task include the id broker table 
information.

Note that this may cause some "table exists" errors when you create 
tables because the process might call both the id-table-init-sql
process to create the tables which are now in the schema sql.

FWIW - An alternative is to look at the db.apache.org/ddlutils
project (a peer project to Torque). It has some nice features
not in Torque for comparing a Schema.XML to the existing DB 
and creating a modify db script.  Works great with adding or
dropping columns and criteria.  

 
> -Original Message-
> From: Ludwig Magnusson [mailto:lud...@itcatapult.com]
> Sent: Saturday, February 14, 2009 10:01 AM
> To: 'Apache Torque Users List'
> Subject: Problem with ID Table
> 
> Hi!
> I am working on a project where I am using the data in the database at
> the
> same time as I am developing it. This means that when I need to make
> changes
> in the database (add tables, columns etc) I need to do a datadump and
> then
> put in all the data again.
> 
> The problem with this is that my ID table does not update when I do the
> datadump. The effect is that when I make new entries in the database I
> get a
> lot of duplicate key errors.
> Is there any property that I have not set? Should there be some kind of
> id-table-data.xml file generated like there is myproject-all-data.xml?
> ¨/Ludwig
> 
> 
> -
> To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
> For additional commands, e-mail: torque-user-h...@db.apache.org
> 

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

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



RE: Torque and SQL 2005

2009-02-02 Thread Greg Monroe
I haven't really used "Implicit On" with SQL 2005, but it seems like
it may be an issue with Torque's built in connection pooling.  Torque
uses the Apache commons DBCP (DB common Pooling) code to manage it's 
connections with the DB.  This means that it can be configured to open
a set of connections with the DB and share them with different 
application threads.  

It sounds like with Implicit On, a transaction gets opened when the
pool opens a connection and this creates a transaction lock that is
being "held" until the connection is reused (or closed).

The pool size, timing, etc, are all set in the Torque properties in
the format of torque.dsfactory..pool..
Where:

is a name used by Torque programmer to select
the pool to connect from.  Generally this is either "default" or 
the name set in the torque.database.default property.

is a config property defined by the dbcp
package. See http://commons.apache.org/dbcp/configuration.html

That said the only things I can think of are:

Set the pool size to 1 connection using:

torque.database..pool.maxActive = 1
torque.database..pool.maxIdle = 1

but this may slow down the application using torque since it has to 
be shared among all the people.

You could write an implementation of the AbstractDataSourceFactory
class (Torque's "wrapper" for pooling) that returns a new connection
each time the getDataSource() method is called. Slower than pooling
since you're doing TCP socket stuff each time a connection is needed
and may use more total connections.

There is also a setUseTransaction method on the Criteria objects used
to create Torque queries. If this is set when you code the query 
criteria objects, Torque will wrap each call in a separate transaction.
This may or may not override the connection level transaction.

It might also be possible to disable the implicit transaction modes
with the following properties:

torque.database..pool.validationQuery = 
SET IMPLICIT_TRANSACTIONS OFF
torque.database..pool.testOnBorrow = true

This will cause the pool to "test" if a connection is still valid 
(e.g., not closed by the server) with the SET command each time
a connection is requested.

Hope this makes sense.

Let us know if one of these works for you.

> -Original Message-
> From: Greg Monroe [mailto:mon...@dukece.com]
> Sent: Monday, February 02, 2009 4:33 PM
> To: 'Apache Torque Users List'
> Cc: 'mjdevl...@firstcommand.com'
> Subject: FW: Torque and SQL 2005
> 
> I'm forwarding this to the torque-user@db.apache.org<mailto:torque-
> u...@db.apache.org> mailing list where problem discussion should be held.
> 
> From: mjdevl...@firstcommand.com [mailto:mjdevl...@firstcommand.com]
> Sent: Friday, January 30, 2009 12:48 PM
> To: Greg Monroe
> Subject: RE: Torque and SQL 2005
> 
> I need to find out how to fix the optimistic blocking issues with Torque
> and SQL2005 - are their any configuration settings that can be fixed
> whether its SQL 2005 or Torque that we can change those settings for
> selects to run without escalated blocking (and the issue with "Implicit
> On" for selects?
> 
> I'm a .NET/SQL DBA so it's hard for me to see how to fix "Implicit On"
> when the transaction stays open for 30-40 minutes per connection and they
> say that Torque is where that setting is maintained within code and we
> are using app pools so we have to restart app/sql daily. It looks like
> it's a SQL2005 issue because of all the blocking, but I think it's a
> Torque/code/config/driver issue and the "it's your fault not mine" is
> happening instead of "lets get this working".  Microsoft just states the
> vendor has to fix their code and use the latest Microsoft JDBC driver -
> they are using the 1.2.4 version = maybe that is the issue too.  Using
> torque, maybe I should use the JTDS driver?  Any suggestions would be
> helpful.  The app is setup to scan a lot of records with dynamic SQL so
> SQL is escalating locks to an exclusive table lock with each process so
> it limits the number of people that can use the app.  I max about 15
> people and I need to get it usable for 400!  They have about 800 tables
> in their database.  The inserts/Updates are so quick that most of those
> transactions don't even show up in the SQL traces, so it's just the
> Selects that I am having issues with.
> 
> Well, Thanks again for responding and sending any information that will
> help me if you are able to.
> 
> Have a great weekend.
> 
> 
> Mary Myers-DeVlugt, MCDBA2008, MCITP2008, MCTS
> 
> SQL Database Analyst/DBA
> First Command Financial Services, Inc., parent of
> First Command Financial Planning, Inc.
> 1 FirstComm Plaza, Fort Worth, T

FW: Torque and SQL 2005

2009-02-02 Thread Greg Monroe
I'm forwarding this to the 
torque-user@db.apache.org<mailto:torque-user@db.apache.org> mailing list where 
problem discussion should be held.

From: mjdevl...@firstcommand.com [mailto:mjdevl...@firstcommand.com]
Sent: Friday, January 30, 2009 12:48 PM
To: Greg Monroe
Subject: RE: Torque and SQL 2005

I need to find out how to fix the optimistic blocking issues with Torque and 
SQL2005 - are their any configuration settings that can be fixed whether its 
SQL 2005 or Torque that we can change those settings for selects to run without 
escalated blocking (and the issue with "Implicit On" for selects?

I'm a .NET/SQL DBA so it's hard for me to see how to fix "Implicit On" when the 
transaction stays open for 30-40 minutes per connection and they say that 
Torque is where that setting is maintained within code and we are using app 
pools so we have to restart app/sql daily. It looks like it's a SQL2005 issue 
because of all the blocking, but I think it's a Torque/code/config/driver issue 
and the "it's your fault not mine" is happening instead of "lets get this 
working".  Microsoft just states the vendor has to fix their code and use the 
latest Microsoft JDBC driver - they are using the 1.2.4 version = maybe that is 
the issue too.  Using torque, maybe I should use the JTDS driver?  Any 
suggestions would be helpful.  The app is setup to scan a lot of records with 
dynamic SQL so SQL is escalating locks to an exclusive table lock with each 
process so it limits the number of people that can use the app.  I max about 15 
people and I need to get it usable for 400!  They have about 800 tables in 
their database.  The inserts/Updates are so quick that most of those 
transactions don't even show up in the SQL traces, so it's just the Selects 
that I am having issues with.

Well, Thanks again for responding and sending any information that will help me 
if you are able to.

Have a great weekend.


Mary Myers-DeVlugt, MCDBA2008, MCITP2008, MCTS

SQL Database Analyst/DBA
First Command Financial Services, Inc., parent of
First Command Financial Planning, Inc.
1 FirstComm Plaza, Fort Worth, TX 76109-4999
(817) 569-2043 (office)   (817) 569-2690 (fax)
(817)  903-5198 (cell) (817) 577-4694 (home)
mjdevl...@firstcommand.com<mailto:mjdevl...@firstcommand.com>
www.firstcommand.com<http://www.firstcommand.com>




From: Greg Monroe [mailto:mon...@dukece.com]
Sent: Friday, January 30, 2009 8:23 AM
To: Myers-DeVlugt, Mary
Subject: RE: Torque and SQL 2005

Yes, in fact, we're using 2005 for our main Torque based apps now.

From: mjdevl...@firstcommand.com [mailto:mjdevl...@firstcommand.com]
Sent: Thursday, January 29, 2009 4:11 PM
To: Greg Monroe
Subject: Torque and SQL 2005

Is Torque supported for SQL2005?

http://db.apache.org/torque/version-specific/supported-databases.html

Thanks,

Mary Myers-DeVlugt
mjdevl...@firstcommand.com<mailto:mjdevl...@firstcommand.com>
SQL Database Analyst/DBA
FirstCommand Financial Planning
817 569 2043 office
817 903 5198 cell or 817 577 4694 home
817-213-9954 or 8172139...@page.metrocall.com
1 FirstComm Plaza, Fort Worth, TX 76109
"Opportunity knocks at your door every day - answer it".



First Command Financial Services, Inc., parent of First Command Financial 
Planning, Inc. (Member SIPC), a registered broker-dealer and registered 
investment adviser, and First Command Bank.

Financial planning services and investment products, including securities, are 
offered by First Command Financial Planning, Inc. Insurance products and 
services are offered by First Command Financial Services, Inc. In certain 
states, as required by law, First Command Financial Services, Inc. does 
business as a separate, domestic corporation, and does business in California 
as "First Command Insurance Services." Banking products and services are 
offered by First Command Bank. Securities products are not FDIC insured, not 
bank guaranteed and may lose value.

STATEMENT OF CONFIDENTIALITY: The information contained in this message or any 
attachments to this message are intended only for the person(s) or entity to 
which it is addressed and may contain confidential and/or privileged material 
as well as being protected from disclosure. The information contained herein is 
based on sources we believe reliable but is not considered all-inclusive. Any 
review, retransmission, dissemination or other use of, or taking of any action 
in reliance upon, this information by persons or entities other than the 
intended recipient is strictly prohibited. If you received this in error, 
please contact the sender immediately and delete the material from any 
computer. www.firstcommand.com

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidentia

RE: newbie question about postgres: nextval

2009-01-26 Thread Greg Monroe
FYI - Schema docs are under the Generator tab.  As to the 
Torque vs Hibernate, I agree with what Thomas said and would 
add the following:

Hibernate is supported and "marketed" by Redhat/JBoss (a
great deal initially, but now it's a community thing). In 
addition, they designed it on better "buzz words". E.g., it's 
Enterprise Middle-ware designed to let programmers implement 
business logic that is supported be a variety of back-end 
including full blown EJB application environments (like JBoss).

By contrast, IMHO, Torque is designed as a RAD tool focused 
on making JDBC simple for programmers.  So they can get on 
with writing business logic and not worry about many of the
fiddly persistence details. Not only that but it is designed
to help make long term maintenance easier.  For example: by 
using complier constants to help identify column name changes;
A single XML schema file that can be updated as tables change
and re-generate the access objects; and the like.

> -Original Message-
> From: Thomas Fischer [mailto:fisc...@seitenbau.net]
> Sent: Monday, January 26, 2009 12:22 PM
> To: Apache Torque Users List
> Subject: Re: newbie question about postgres: nextval
> 
> > Can you explaim why is so overwhelmed by Hibernate ? Is there some
> > performance related isssue ?
> 
> My personal opinion is that there are two reasons:
> 1) documentation is _MUCH_ better for hibernate
> 2) The concept for hibernate seems to be easy: Give an object to
> Hibernate
> and Hibernate does all the persistence work.
> 
> But it not an performance issue. As you have total control over what the
> database does, you have more optimisation potential in Torque than in
> Hibernate. Maybe in some special cases it is more work to optimize Torque
> application, but it is certainly feasible.
> 
> Thomas
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

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



RE: newbie question about postgres: nextval

2009-01-26 Thread Greg Monroe
OK, the part about the jdbc task clears a lot up.  This task does
the best it can using the standard meta info supplied by the 
JDBC drivers.  Since this is a standard across all the various
DB server types, there are some limitations when it comes to various
"pseudo" standards that Torque supports, like native autoincrement 
fields (and offset and limit to name some others).

Native autoincrement is actually not an SQL standard.  However, since 
most DB servers have a method of autoincrementing fields built in and 
auto-incrementing index fields is commonly used in existing schemas, 
Torque supports this "pseudo" standard in its runtime and SQL creation.
But since this is implemented and reported very differently by all the
JDBC drivers (if at all), the JDBC task can't create the correct XML
given the information available.

This is what is causing your problems.  The bottom line is that the 
JDBC task output should always be considered a starting point that
will need to be refined to match the actual schema needs.

In general, for autoincrement id fields coming out of the JDBC task, 
you will need to decide which method to use with automatic id fields. 
This is done via the defaultIdMethod attribute on the database tag  or 
the idMethod attribute on the specific table tag.  The choices are 
idbroker (Torque's works everywhere method), native (the DB server's 
native method) or none.  In your case, you want native.

Next you will need to identify the autoincrement fields and modify
them to include the autoincrement="true" attribute and drop any
default values.

FWIW, some other "gotchas" from the JDBC task that come to mind are:

If you care about creating the tables via Torque, this does not 
create any Index or Unique information (JDBC doesn't supply this).  
You will have to add these in manually.

The table ordering may not meet the requirement that foreign keys
be defined prior to their use.  So you may need to move some 
table definitions around to make sure the tables with keys come
first.

It sounds like a lot of work, but in general, it takes only a
few minutes (or can be automated for your specific DB standard).
Just remember that this is a small amount of time compared to what 
it would take to write all the code that gets generated.




> -Original Message-
> From: Ivano Luberti [mailto:lube...@archicoop.it]
> Sent: Monday, January 26, 2009 10:15 AM
> To: Apache Torque Users List
> Subject: Re: newbie question about postgres: nextval
> 
> Here it is .
> In my prev message I didn't said that , I have defined the db using the
> server , then I have generated the schema using the jdbc ant task and the
> classes using the om ant task.
> I don't want to define myself the shema file because I'm more famliar
> with SQL and then I don't want to make Torque create or modify my DDL.
> Finally I use Torque 3.3 version and the generator directly without using
> Maven.
> 
> 
> 
> Thomas Fischer ha scritto:
> >> I'm using postgres to generate torque classes but the automatic
> >> generation seems to make a few mistakes.
> >> In the base class I found this java statement
> >>
> >> private int pkAnagrafica =
> >> nextval('anagrafica_pk_anagrafica_seq'::regclass);
> >>
> >> which is marked as wrong by the compiler.
> >>
> >> The same happens in the copyobject method of the same class:
> >>
> >> copyObj.setPkAnagrafica(
> >>
> > nextval('anagrafica_pk_anagrafica_seq'::regclass));
> >
> >> Is there a way to stop Torque generating these bad statements ?
> >>
> >
> > Can you send the schema definition which you use for the table in
> > question ? This would ease diagnostics. I suspect that you use a
> > default value for the id; this is not necessary.
> >
> >Thomas
> >
> 
> --
> ==
> Archimede Informatica NEWS!
> ==
> 
> Realizzato il Sistema Integrato per la biglietteria della Torre di Pisa:
> prenotazione, vendita, pre-vendita ed emissione dei biglietti di ingresso
> alla Torre sia online che presso le biglietterie dislocate sulla piazza:
> 
> _http://www.opapisa.it/boxoffice
> 
> _Partner del Progetto Ci-Tel "Front office Telematico per il cittadino"
> Ente Coordinatore Comune di Pisa
> 
> _http://www.comune.pisa.it/doc/e-government.htm
> 
> 
> _==
> dott. Ivano Mario Luberti
> Archimede Informatica societa' cooperativa a r. l.
> Sede Operativa
> Via Gereschi 36 - 56126- Pisa
> tel.: +39-050- 580959
> tel/fax: +39-050-9711344
> e-mail: archim...@archicoop.it
> web: _http://www.archicoop.it
> 
> 
> _ __ 
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely 

RE: torque documentation about peer base beans and map classes

2009-01-26 Thread Greg Monroe
Hmm, that should be "reference" instead of "documentation".. or 
you can find it in the side bar under Torque 3.3. / Runtime / 
Reference / Relevant classes. 

> -Original Message-
> From: Ivano Luberti [mailto:lube...@archicoop.it]
> Sent: Monday, January 26, 2009 10:25 AM
> To: Apache Torque Users List
> Subject: Re: torque documentation about peer base beans and map classes
> 
> Ok but it seems there is a broken link at the beginning to a page that
> seems promising
> 
> http://db.apache.org/torque/releases/torque-
> 3.3/runtime/documentation/relevant-classes.html
> 
> Thomas Fischer ha scritto:
> >> Hello, can someone point me to some documentation explaining the role
> of
> >> the various type of classes generated by Torque ?
> >>
> >
> > Documentation by example:
> >
> > http://db.apache.org/torque/releases/torque-3.3/tutorial/step5.html
> >
> >Thomas
> >
> 
> --
> ==
> Archimede Informatica NEWS!
> ==
> 
> Realizzato il Sistema Integrato per la biglietteria della Torre di Pisa:
> prenotazione, vendita, pre-vendita ed emissione dei biglietti di ingresso
> alla Torre sia online che presso le biglietterie dislocate sulla piazza:
> 
> _http://www.opapisa.it/boxoffice
> 
> _Partner del Progetto Ci-Tel "Front office Telematico per il cittadino"
> Ente Coordinatore Comune di Pisa
> 
> _http://www.comune.pisa.it/doc/e-government.htm
> 
> 
> _==
> dott. Ivano Mario Luberti
> Archimede Informatica societa' cooperativa a r. l.
> Sede Operativa
> Via Gereschi 36 - 56126- Pisa
> tel.: +39-050- 580959
> tel/fax: +39-050-9711344
> e-mail: archim...@archicoop.it
> web: _http://www.archicoop.it
> 
> 
> _ __ 
> 
> -
> To unsubscribe, e-mail: torque-user-unsubscr...@db.apache.org
> For additional commands, e-mail: torque-user-h...@db.apache.org
> 

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

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



RE: Unsigned integers

2008-12-03 Thread Greg Monroe
FWIW, I seem to remember jdbc task issues with getting foreign 
key constraints, indices, and recognizing autoincrement columns.
Plus, I think there is a fair amount of variation in what you get
depending on the DB you're connecting to.  I've always considered 
the XML from this as a starting point to avoid typing a lot ;) but
not the end product.  But then I use my XML to generate the SQL
statements for replicating my Application DBs, so it has to be full
featured with all that stuff.

That said, you might want to take a look at the DDL UtilS project:

http://db.apache.com/ddlutils

This is a "sister" project to torque that uses the same schema 
(with some exceptions around external-schema tags).  They have
been the focus of getting the jdbc task more robust.  In fact,
the Torque 4.0 design discussions talked about converting the
tasks relating to DB creation, etc to use the ddlutils project.

FWIW, they have a nice set of easy to use classes to do a lot of
the same tasks via code.  They have a nice feature that can compare
an existing DB to an XML schema (or another DB) and generate the
SQL code needed to update the destination DB to match an source 
schema/DB.  I've been using this one to generate version 
update SQL scripts.  NOTE that this class is kind of "militant" 
in that if there are table NOT in the XML, it will generate 
drop statements for them.  But with a little quick manual editing,
I can produce an upgrade script in about 30 minutes or less, 
including testing.

Finally, you asked about Torque 4.0 features, etc.  Here are a 
couple of resources that you might want to check out:

http://wiki.apache.org/db-torque/NextRelease

This is the result of an extended discussion about Torque 4.0 that
took place starting in Nov 2006 (and on into early Feb or so).  If 
you truly want to understand what the Wiki is talking about, I 
suggest going thru the torque-dev list archives and reading the 
threads related to Torque 4.0.


> -Original Message-
> From: Thomas Fischer [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 03, 2008 9:46 AM
> To: Apache Torque Users List
> Subject: Re: Unsigned integers
> 
> > > IMHO torque:jdbc is no good as  a totally automatic way to create a
> > > schema.xml. It is good as a first guess, but nothing more, because
> the
> 
> > > informations from the jdbc driver are not complete enough to extract
> a
> 
> > > good schema.
> > > If it worked for you so far, you were lucky.
> > >
> > Or maybe Torque have lots of features I don't know about.
> >
> > But what kind of features in my database could be a problem for
> torque:jdbc?
> >
> > I love torque, because I can just define my database in sql and then
> run
> 
> > maven torque:jdbc to get a schema.xml file, that maps
> > all the tables to classes, with primary and foreign keys, and allow me
> > to retrieve data from the database.
> 
> The problem might be that the mapping is different from what you expect.
> I
> do not have an example ready because I do not use torque:jdbc myself, but
> searching the mailing list should find some complaints.
> 
> Thomas
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Project status

2008-12-03 Thread Greg Monroe
In addition to what Thomas said... 

You should note that Torque is at relatively stable  point of 
development based more or less on the original design 
view/methodology (with some major mods happening about version 
3.1...).  IMHO, the 3.3 release is at a point where the existing
design is close to the best it can get.  It's had extensive bug 
testing, is very stable, and meets a high percentage of what 
people want to use it for.  

A point in case, is the low number of bugs that have been 
reported since the 3.3 release. This is one reason for a low 
number of commits over the last period.  The developers are
still around.. just there have been no quick fixes needed.  

That said, Torque 4.0 features have been discussed on the 
Torque-Dev mailing list (see Threads starting around late Nov
2006 and documented in the Torque Wiki (Thanks Thomas F!).  
The vision for these is a fairly major redesign to the under
side of Torque. 

As Thomas has said, folks are busy.. and getting started on 
a major redesign means that people have to find a large 
chunk of time and energy to devote to this.  Even then it will
be long process because we are talking about major changes and
Torque is used in ways that were never imagined.  This is sure
to lead to a large set of issues and problems that will have to
be hashed out, re-thought, re-coded, and the like.

Of course, it helps to prod the sleeping bear occasionally ;)


> -Original Message-
> From: Thomas Fischer [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 03, 2008 11:51 AM
> To: Apache Torque Users List
> Subject: RE: Project status
> 
> >Hi, I'm a Java developer from Argentina and I use Torque in many
> > projects. Since I don't see any new release of this framework since
> > February 2008 I was wondering if it's still active or not.
> 
> Since the release of 3.3 the main developers had a lot ow other work and
> were not able to put much work into Torque. But they are still with the
> project, if you look at the mailing list posts.
> My personal guess is that  Torque will become more active again next
> year.
> 
> Thomas
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Unsigned integers

2008-12-01 Thread Greg Monroe
The UNSIGNED type is not in the DTD because it is not part
of any SQL Standard.  The SQL standard for this type of data
is to use one of the following column types:  BIT, BINARY, or
VARBINARY column type (with possible CHAR and DECIMAL options).  

Unfortunately, it looks like Village doesn't properly support 
BIT (it assumes a 1 byte Boolean.. need to fix this now that
we have control of Village...).  And BINARY and VARBINARY 
are mapped to BLOBS which aren't very efficient.  

That said, the best bet would be to manually define the column 
type to be an UNSIGNED INTEGER in the DB and then use BIGINT
as the type in the schema.  This will make the Record object
use the long type and avoid having large binary int values 
become negative.
 
As to ensuring the proper values get placed into this, you can 
either depend on JDBC or SQL to throw an exception if the value 
is too large (e.g. a negative number of type long SHOULD be 
considered as too many bits). Or you can just add some checks 
to the set(long) method in the stub.

Hope this makes sense..


> -Original Message-
> From: Martin Tilsted [mailto:[EMAIL PROTECTED]
> Sent: Saturday, November 29, 2008 11:52 AM
> To: Apache Torque Users List
> Subject: Unsigned integers
> 
> How do i handle unsigned integers with torque (Using MySql 5.0)?
> 
> I use maven torque:jdbc to generate my schema.xml file, but i have a
> field(Ip) that is an unsigned int in the database,
> but that generate a
> 
> in the schema file.
> So I have 2 questions:
> 
> 1: How do I get maven torque:jdbc to generate a schema for an unsigned
> int? Is this even possible? I could not find the documentation for the
> schema.xml format.
> 
> 2: If i keep the signed integer version in my schema, but the field is
> unsigned in the database, what happens if call setInt() with a negative
> value.?
> 
> Martin
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

RE: how can i write torque Group By Query

2008-12-01 Thread Greg Monroe
Sorry for the delay... Last week was the Thanksgiving 
holiday in the US...

The easy way to do this (once it's set up), would be to use the new
SummaryHelper class.  However, this was not finished in time to make
the current distribution and is only available in the SVN repository.

Here is a link to the email talking about this:

http://mail-archives.apache.org/mod_mbox/db-torque-dev/200803.mbox/[EMAIL 
PROTECTED]

You can also look at the Javadoc comments of this class to see if you 
want to build/use a snapshot Runtime.  AFAIK, there have been no other 
major submits to the 3.x build tree (since 4.0 is separate).  So, I'd
say that it would be production ready (I'm using it that way now).

An alternative way to do this is via Torque is to use the BasePeer
executeQuery methods.  This is a lower level way to use Torque to 
execute queries that don't fit into the record object model.  It 
returns a set of Record objects that are a lot like the standard JDBC
classes with getValue methods for getting data by ordinal or columnName.

Finally, if this particular query is something you do a lot and still 
want the convenience of a Torque record, you could create an SQL view
and then create a pseudo-table in the schema (use the noSql option) to
match the columns the view will create.  It may not fit your need but I
thought I'd mention it.


> -Original Message-
> From: Sasikumar Natarajan [mailto:[EMAIL PROTECTED]
> Sent: Monday, December 01, 2008 12:30 AM
> To: Apache Torque Users List
> Subject: Re: how can i write torque Group By Query
> 
> Hello ALL,
>    i have been developed a oracle query for getting employees
> count in each department as given below. This query i want to change
> Torque Query as Similar functionality by using Peer Class Joint. Can u
> Please help me for converting by using Peer Class Joint.
> 
> SELECT DEPT_NUMBER, DEPT_NAME, COUNT(DEPT_NUMBER) NUMBER_OF_EMPLOYEES
> FROM EMPLOYEES EMP, DEPARTMENTS DEPT
> WHERE EMP.EMP_DEPT_NUMBER = DEPT.DEPT_NUMBER GROUP BY DEPT_NUMBER,
> DEPT_NAME
> 
> Thanks In Advance
> Sasikumar
> 
> --- On Wed, 26/11/08, Sasikumar Natarajan <[EMAIL PROTECTED]> wrote:
> 
> From: Sasikumar Natarajan <[EMAIL PROTECTED]>
> Subject: how can i write torque Group By Query
> To: "Apache Torque Users List" 
> Date: Wednesday, 26 November, 2008, 12:39 PM
> 
> Hi All
> 
> The following query i need to change by using torque query.
> 
> SELECT DEPT_NUMBER, DEPT_NAME, COUNT(DEPT_NUMBER) NUMBER_OF_EMPLOYEES
> FROM
> EMPLOYEES EMP, DEPARTMENTS DEPT
> WHERE EMP.EMP_DEPT_NUMBER = DEPT.DEPT_NUMBER GROUP BY DEPT_NUMBER,
> DEPT_NAME
> 
> i did the following by using torque query. but this is wrong.
> 
> Please help me to correct the following query.
> 
> Criteria criteria = new Criteria();
> criteria.addSelectColumn(DepartmentPeer.DEPT_NUMBER);
> criteria.addSelectColumn(DepartmentPeer.DEPT_NAME);
> 
> criteria.addGroupByColumn(DepartmentPeer.DEPT_NUMBER);
> criteria.addGroupByColumn(DepartmentPeer.DEPT_NAME);
> 
> criteria.addJoin(EmployeePeer.EMP_DEPT_NUMBER,
> DepartmentPeer.DEPT_NUMBER);
> List deptList = DepartmentPeer.doSelect(criteria);
> 
> Thanks in Advance
> Sasikumar
> 
> 
>   Unlimited freedom, unlimited storage. Get it now, on
> http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/
> 
> 
>   Add more friends to your messenger and enjoy! Go to
> http://messenger.yahoo.com/invite/

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

RE: NullPointerException using two database pools

2008-11-18 Thread Greg Monroe
The problem is that the term "database" is overloaded in Torque.
It can be used to refer to two things.  First, it can refer to the
Torque database schema representation.  I.e., the Map classes that
are created from the XML that contains the database name.

Second, it can refer to the database connection pool defined
in the initialization properties.

The dbname property in the Criteria object refers to the first
definition of the database name.  It is used by the code to
determine needed relationships, etc. defined in the related
schema identified by this name.  So, you get the null pointer
exception because the schema for the database doesn't exist.

That said, the way to use the same Torque object set with two
different databases at the same time is to use the Peer
methods with the connection parameter.  You can get the DB
specific connection via the Torque.getConnection( dbName )
static method.  This refers to the connection pool definitions.

Note that this works fine for a large majority of the Torque code.
There may still be a few places that the code revert back to the
default DB name internally. I think this is mostly in the Helper
utility classes.

Another place to be aware of is that you will need to specify
either the connection DB name or supply a connection object to
the record object save methods.

> -Original Message-
> From: Adam Allgaier [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 17, 2008 1:29 PM
> To: Apache Torque Users List
> Subject: NullPointerException using two database pools
>
> I'm trying to create two separate connection pools and trying to have a
> query run against the second connection pool.  I get a null pointer
> exception when I try to run the modified code.  It seems to pick up the
> datasource properly, but I cannot figure out what is creating the NPE.
> Thanks in advance for your help.
>
> Adam :-)
>
> The code:
> -
> //old code, default pool, works fine:
> Criteria criteria = new Criteria();
>
> //new code, new pool, fails with NullPointerException (see below for
> more)
> Criteria criteria = new Criteria("newpool");
>
> //new code, a datasource pool that doesn't exist in torque, fails with
> java.lang.NullPointerException:
> //There was no DataSourceFactory configuredfor the connection boguspool
> Criteria criteria = new Criteria("boguspool");
>
>
> Here's the Torque.properties:
> -
>
> application.root = .
> torque.database.type = mysql
> torque.database.default = originalpool
>
> # the default pool:
> torque.database.name = originalpool
> torque.database.originalpool.adapter=mysql
> torque.dsfactory.originalpool.connection.driver = com.mysql.jdbc.Driver
> torque.dsfactory.originalpool.connection.url =
> jdbc:mysql://127.0.0.1/mydb
> torque.dsfactory.originalpool.factory=
> org.apache.torque.dsfactory.SharedPoolDataSourceFactory
> ...
>
> # the new pool
> torque.database.newpool.adapter=mysql
> torque.dsfactory.newpool.connection.driver = com.mysql.jdbc.Driver
> torque.dsfactory.newpool.connection.url = jdbc:mysql://127.0.0.1/mydb
> torque.dsfactory.newpool.factory=
> org.apache.torque.dsfactory.SharedPoolDataSourceFactory
> ...
>
> Here's the detailed exception:
> -
> java.lang.NullPointerException
>
> javax.servlet.ServletException: org.apache.torque.TorqueException
> at
> com.caucho.jsp.PageContextImpl.handlePageException(PageContextImpl.java:1
> 210)
> at
> _jsp._searchresults3__jsp._jspService(_searchresults3__jsp.java:369)
> at com.caucho.jsp.JavaPage.service(JavaPage.java:61)
> at com.caucho.jsp.Page.pageservice(Page.java:578)
> at
> com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:
> 195)
> at
> com.caucho.server.webapp.DispatchFilterChain.doFilter(DispatchFilterChain
> .java:97)
> at
> com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.ja
> va:266)
> at
> com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherI
> mpl.java:494)
> at
> com.caucho.server.webapp.RequestDispatcherImpl.include(RequestDispatcherI
> mpl.java:358)
> at
> com.caucho.jsp.PageContextImpl.include(PageContextImpl.java:1008)
> at _jsp._search__jsp._jspService(search.jsp:61)
> at com.caucho.jsp.JavaPage.service(JavaPage.java:61)
> at com.caucho.jsp.Page.pageservice(Page.java:578)
> at
> com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:
> 195)
> at
> com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.jav
> a:187)
> at
> com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.ja
> va:266)
> at
> com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:270)
> at
> com.caucho.server.port.TcpConnection.run(TcpConnection.java:678)
> at com.caucho.util.ThreadPool$It

RE: SQL Server 2005 - varchar(max)

2008-11-16 Thread Greg Monroe
First, just a general Torque design principal review... Torque
tries to let you create code that is independent of the type
of SQL server you are using (while remaining flexible enough
to let you access specific server features.  When it comes to
things like basic column type support, we follow the SQL
standards as to what Torque supports.  So, if the standard
defines an NVARCHAR column type, then we will try to support
it across all servers we support.

That said, there are actually two parts to this request, using
these type of columns in the runtime and generating the SQL
statements to create the tables.

In the runtime area, I'm pretty sure we already support these
columns.  If your schema XML says VARCHAR, then the Torque code is
using String at the storage type with is Unicode compliant. Torque
and Village ultimate set and store these fields via JDBC calls, like
getString(column), and the like.  The JDBC driver should handle the
conversion of the information returned by the SQL server to the
correct Java value.  So, an NVARCHAR column with Unicode will be
mapped directly to a Unicode String with no problems.

As to generating SQL with NVarchar column, as I said above, if this
is  part of the standard, we'll add a column type to the schema.

However, if you have a need to do this, it's not hard to create
your own generator Platform implementation that uses NVARCHAR
when you specify VARCHAR in the XML.

Hope makes sense.  If not feel free to ask for clarification.


> -Original Message-
> From: jbowman [mailto:[EMAIL PROTECTED]
> Sent: Friday, November 14, 2008 10:28 AM
> To: torque-user@db.apache.org
> Subject: SQL Server 2005 - varchar(max)
>
> Hi All,
>
> I'm new to the list so please bear with me if this question has been
> previously discussed.
>
> Is there any version of Torque that supports any of the "new" SQL Server
> 2005 column specification changes, specifically:
>
> NVARCHAR(max)?
>
>
> The MSDN documentation defines it as:
>
> "Variable-length Unicode character data. n can be a value from 1 through
> 4,000. max indicates that the maximum storage size is 2^31-1 bytes. The
> storage size, in bytes, is two times the number of characters entered + 2
> bytes. The data entered can be 0 characters in length."
>
> If not, are there any plans in the works to support such SQL Server 2005
> changes?
>
> John
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Village meta data calls (Was: Will migrating from 3.0 to 3.3 help me?)

2008-10-02 Thread Greg Monroe
I'm in agreement that we need to fix this... but on the other hand, 
it's been part of Torque since day one and the performance hit hasn't
motivated anyone into fixing yet... 8).

A couple of things to note about the meta data calls (from the memory 
of wading thru the Village code in that past and may not be fully 
accurate...).  

First, although Torque may not use the Column object directly, the 
Village internals for doing updates and inserts use it a lot.  Torque 
currently uses Village calls to do these actions.

Second, we may not want/be able to eliminate all calls to the meta-data.
If my memory is correct, Village checks the meta data in order to 
properly convert the supplied value into the format the database 
expects.  

IMHO, I think this has been secretly helpful in automatically mapping
between Torque's XML schema and the native columns.  Especially when
the tables have not been created via Torque.  It means you just have 
to find a data type that's "close" to the native one and then Village
and JDBC maps it correctly to and from Torque objects.

If we don't want to lose this functionality, we still need to do some
checking as to what the underlying column type is.  I'm thinking that
this information should get added to the ColumnMap object and the 
initialization routines changed to make the call to get the Meta
data.  This would cache the meta data, cut the meta data requests to
just a few, and still maintain the underlying Village flexibility.

Just some quick thoughts on this.  Take them or leave them.

Greg

> -Original Message-
> From: Scott Eade [mailto:[EMAIL PROTECTED]
> 
> I am not telling you anything you don't already know, but it sure is
> interesting to see this myself.
> 
> Looking at torque, the only references to
> com.workingdogs.village.Column
> (directly and via c.w.v.Schema) are in
org.apache.torque.util.BasePeer.
> Usage would appear to be limited to retrieving the name of the column
> (via Column) and the number of columns (via Schema).
> 
> So it looks to me like we should look at producing a version of
Village
> that skips retrieving unnecessary metadata.  For people using JDBC
> drivers that implement the metadata retrieval methods this will result
> in a performance improvement significantly larger than any other
> refactoring we might be considering for 4.0 and potentially this could
> be substituted into to a 3.3.1 release with just an updated pom.
> 
> I have a couple of dozen other things on my plate right now, but if
> someone else cares enough to verify my analysis I don't think it will
> be
> too difficult to achieve something positive out of this.
> 
> Scott
> 
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Programatically set torque.dsfactory..connection.url

2008-08-28 Thread Greg Monroe
> -Original Message-
> From: Shinkan [mailto:[EMAIL PROTECTED]
> 
> > Did you try to use the method
> >
> > Torque.init(org.apache.commons.configuration.Configuration conf)
> 
> 
> Yeah ... but no :D !
> In fact I need almost all properties to be set by a file, except the
> connection string one, which contains the pass ...
> Thus, I don't know which class that implements Configuration interface
> to use to load something ...

I could send you there directly, but teaching someone to find their own
answers is better... take a look at the Configuration subsite of the Apache 
Commons Project... hints: commons.apache.org .. Torque's config files is 
a property file.. and there's a user guide.
> 
> 
> >
> > By the way: there was a big discussion about keeping the db password
> > secure half a year or a year ago in the torque lists. You might be
> > interested.
> >
> 
> Sure. Where can I find that ? I'm fact I'm totally new with user's mail
> groups.
> 

Google (or some other search engine) is your friend.. 

torque-user encrypt password site:mail-archives.apache.org

or personally, I prefer www.mail-archive.com.. Nice search interface and 
thread display.


> Thanks !
> 

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

RE: Does derby support still work?

2008-08-25 Thread Greg Monroe
FWIW - I ran the V3.3RC3 Test project (same as release) against 
Derby 10.3.2.1 (both embedded and network server versions).  
This checks a LOT of standard functionality, including the 
table creation and data type mappings.

In the table creation side of things, there were no issues in 
creating the test tables (which include every Torque/JDBC 
supported data type.  There were some issues relating to 
Torque/Derby not being able to drop some tables because they 
contained circular foreign key references (part of what the 
test suite check that Torque handles).  This was handled 
manually in running the tests by making sure the DB was 
recreated from scratch each run.

The only functional test that failed was related to Derby not 
allowing expressions in an order by clause where grouping or 
distinct is used. E.g. ORDER BY UPPER(x.y) where x.y is in the
group fails because Derby does not consider UPPER(x.y) are 
part of the group.

This caused the testJoinOrderDistinct test case to fail... but 
everything else worked.

Here's the e-mail outlining the details:

http://mail-archives.apache.org/mod_mbox/db-torque-dev/200801.mbox/%3C8F
[EMAIL PROTECTED]

> -Original Message-
> From: Graham Leggett [mailto:[EMAIL PROTECTED]
> Sent: Monday, August 25, 2008 6:15 AM
> To: Apache Torque Users List
> Subject: Re: Does derby support still work?
> 
> Thomas Vandahl wrote:
> 
> > Graham Leggett wrote:
> >> ij> CREATE TABLE active ( active_id INTEGER NOT NULL, serial
VARCHAR
> NOT
> >> NULL, name VARCHAR NOT NULL, description VARCHAR NOT NULL,
> signature_id
> >> INTEGER NOT NULL, PRIMARY KEY(active_id), UNIQUE (serial));
> >> ERROR 42X01: Syntax error: Encountered "NOT" at line 1, column 66.
> >
> > I'm not exactly a Derby expert but in this case "serial" seems to be
> > responsible.
> 
> Column 66 and the error message both point at the word "NOT", rather
> than the word serial.
> 
> Some further digging over the weekend shows that Derby may not support
> the VARCHAR type properly (it seems to need to be VARCHAR(limit), not
> VARCHAR).
> 
> Is it Torque's responsibility to decide on the VARCHAR type, or is the
> choice of type left to the end user?
> 
> Regards,
> Graham
> --
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Using Union

2008-06-25 Thread Greg Monroe
IFAIK, not directly since Torque is based on a table record object model

and a union statement is not a physical "table".  Generally for things
like this, you can drop down a "layer" into the village package 
"primitives" and deal with it there.  This is very similar to using
native JDBC, but if done correctly, will still preserve the compile
time "schema checking" and DB independent parts of Torque.  E.g., using 
the Peer objects to define columns and criteria to define the SQL 
terms.

However, I'm not sure that village will support UNIONs. So, you might 
have to just use JDBC (and the Torque.getConnection methods) to do this.

A possible alternative would be to create a view based on a common
union query and create a Torque object for this view.  Then you could
use the standard Torque methods to get the subsets you wanted from the
view.

If you really get inspired, it should be possible to have a generic
"Helper" class to create the union from a couple of criteria objects.  
Maybe using standard JDBC or maybe just doing two Village queries.  Then

convert these to a list Village Record objects and call the
populateObjects 
method in the Peer class you want to have then look like. 

Of course, these would be read only objects since which table the record
id
information applied to would be unknown.

Also, if you union is actually coming from two tables with the same
field
names, you could do the same thing as a union with two queries.  E.g.

List r1 = Sales2007Peer.doSelect(c);
List r2 = Sales2008Peer.doSelect(c);
r1.addAll(r2);
Iterator it = r1.iterator();
While (it.hasNext() ) {
  BaseObject rec = it.next();
  Item = rec.getByName("ITEM");
  Price = rec.getByName("PRICE");

}


> -Original Message-
> From: Michael Herbold [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 25, 2008 9:45 AM
> To: Apache Torque Users List
> Subject: Using Union
> 
> Hi,
> 
> is there a way to use union in torque?
> I tried to search for an example, but i didn't found anything
> helpful...
> 
> I like to handle something like this:
> 
> statement_1
> union (
>   statement_2
> )
> 
> Thank you and greetings
> Michael
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Derby autogenereted keys

2008-05-22 Thread Greg Monroe
Just add the attribute:

 

defaultIdMethod="native"

 

to the  tag.  This will create the SQL needed for
autoincrement fields.

 

Greg

 

 

From: Thoralf Rickert [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 22, 2008 9:35 AM
To: 'Apache Torque Users List'
Subject: Derby autogenereted keys

 

Hi,

 

I couldn't find any questions/answers nor a tutorial about my current
problem, so I'm not sure, if this is a user bug or a real problem. But I
hope, you have an answer for me.

 

I want to use Derby 10.4 and Torque 3.3 to implement an embedded
database into a small GUI application. I'm new to Derby so that I'm not
sure, where my problem really is.

 

I've defined a table:

 


  
  

  

  


The important point is the "autoIncrement". The generated SQL code
does'nt contain any informations about this.

 

CREATE TABLE report
(
id BIGINT NOT NULL,
filename VARCHAR(1024) NOT NULL,
PRIMARY KEY(id),
UNIQUE (filename)

);

This means - no autogenerated keys. I don't want to use IDBroker if the
database is able to generate the keys. Actually I found out, that Derby
is able to generate autogenerated keys with "GENERATED ALWASY AS
IDENTITY". But Torque seems not not use this feature. When I run this
SQL statement manually...

 

CREATE TABLE report
(
id BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY,
filename VARCHAR(1024) NOT NULL,
PRIMARY KEY(id),
UNIQUE (filename)

);

The table is generated as I wanted. But then the next problem is, that I
cannot INSERT any values via Torque because it tries to save/set an ID
value. I'll get an SQLSyntaxException "Attempt to modify an identity
column 'ID'" from Derby.

 

I could define a default value "DEFAULT" for the primary key as Derby
wanted and use GENERATED BY DEFAULT but I cannot setup a default String
value "default" for a long field (compile error).

 

Any ideas?

 

 

Thanks

Thoralf

 



DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

RE: Column names with spaces

2008-04-11 Thread Greg Monroe
OK, short version:  If you can't change the existing
schema, use a view to get valid names.

Longer version:

Actually, the "[" syntax is not the only one that can be
used with MS SQL. It also supports the SQL Standard 
defined delimited identifiers.  In the standard, normal
identifiers (e.g. column/table names) have the same 
rules as Java/C variables. (with the exception that
they are case insensitive...)

If you want/need to use characters outside of this set,
you need to use delimited identifiers.  These have the
Standard defined syntax of "My Table!" (double quote's 
included). Delimited identifiers ARE case sensitive.
So, the standards version id of a column in your table 
would be written like: "Time after".time_col

AFAIK, this syntax is pretty widely supported by the 
major DB players.

As Thomas F said, getting Torque to recognize and map
the Java names to the real names is going to be a
hard thing.

One thing that *might* work out of the box is the 
various ant tasks.  If you define your names in the 
XML to include the double quotes, the SQL generated
by these should work.

To be complete, I guess you could also try to generate
the code with the delimited cases and then "fix up" the
classes that don't compile.  You'd also have to make sure
the Map classes used the correct strings as well.  Not 
very maintainable but...


> -Original Message-
> From: Thoralf Rickert [mailto:[EMAIL PROTECTED]
> Sent: Friday, April 11, 2008 8:39 AM
> To: 'Apache Torque Users List'
> Subject: Column names with spaces
> 
> Hi,
> 
> Of course the list of problems with mssql doesn't stop...
> 
> I've got now a xml schema from the existing database. Some "lovely
boy"
> decided years ago that it would be nice to use spaces inside the
column
> names of the database scheme. For example: "Time after". This is not a
> problem if you use the special syntax "[Time after]" in a select. But
I
> don't have this kind of access with Torque (prove me wrong, if not).
If
> I try to make a Criteria, Torque quits this selection with
> 
> Malformed column name in Criteria getTableName: 'T_Stammdaten.Time
> after' is not of the form 'table.column'
> 
> Okay, actually this is an error that doesn't have something to do with
> the real problem. Is there a way to setup a database specific syntax
> for column names. So in MySQL it would be "`" or in MSSQL/Sybase it
> would be "[" and "]".
> 
> Additionally - I think the "torque" task that generates the classes
> should escape the spaces if it uses the database column names to
> generate column constants (currently it produces
> 
> public static String TIME AFTER = "...".
> 
> Has somebody an idea, how to get around this problem?
> 
> 
> Bye
> Thoralf
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: MSSQL JDBC2XML Task generates no XML

2008-04-10 Thread Greg Monroe
Hmm, this is interesting.  FWIW, I believe that the test-project
contains a test for the jdbc task.  I ran the test suite using the 
3.3-RC3 candidate against a MS SQL Server 2000 install with the 
jTDS driver and it passed.  But I'm not a 100% sure that the jdbc
task is part of that.

Also, I just did a quick ant build jdbc task against my development
DB (which uses SQL 7.. I know.. old.. long sad story why... ) and 
it worked.

FWIW, this was using jTDS 1.2 with only the ;TDS=7.0 parameter set
on the test URL for the SQL 7 test.  E.g.:

jdbc:jdts:sqlserver://sql.xxx.com/dbName;TDS=7.0

One question, the "tasks" part of torque uses your "build.properties"
info to connect to the server.  Are you changing the values here 
or in the Torque.properties file, which only effects the runtime?

It may be an SQL 2005 / jTDS driver issue.  Also are you using named
pipes as a connection method or TCP/IP?  That may be another source
of trouble. I seem to remember that with Named Pipes some alternate
forms of "authentication" may be used, such as trying the current
network user info.

That's all that come to the top of mind right now.

Greg

> -Original Message-
> From: Thomas Fischer [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 10, 2008 12:34 PM
> To: Apache Torque Users List
> Subject: AW: MSSQL JDBC2XML Task generates no XML
> 
> Did you try to use the configured schema name instead of "%" ? Maybe a
> case
> sensitivity issue ?
> 
> Sorry, just wild guesses,
> 
> Thomas
> 
> Thoralf Rickert <[EMAIL PROTECTED]> schrieb am 10.04.2008
> 18:05:45:
> 
> > > What Torque does is it opens a connection to the db, goes for
> > > the metadata of the connection and makes the call
> > >
> > >  tableNames = dbMeta.getTables(null, dbSchema, "%", types);
> > >
> > > Maybe you can try to do this manually and play around to see
> > > what goes wrong ?
> > >
> > > It may also be that you have a permission problem and the
> > > orgasales user is not allowed to list all tables...
> >
> >
> > Sorry, I forgot to tell you. I allready tried this:
> >
> > --
> >
>
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstan
> ce();
> 
> > Connection connection = DriverManager.getConnection
> ("jdbc:sqlserver://srv-
> >
>
poseidon;instanceName=orgasales;databaseName=OrgaSales;SelectMethod=cur
> sor;
> > integratedSecurity=true", "orgasales", "password");
> >
> > DatabaseMetaData metadata = connection.getMetaData();
> > String[] names = {"TABLE"};
> > ResultSet tableNames = metadata.getTables(null, "%", "%", names);
> > int size = 0;
> > while (tableNames.next()) {
> >   System.out.println(tableNames.getString("TABLE_NAME"));
> >   size++;
> > }
> > System.out.println("Found "+size+" tables");
> > --
> >
> > The result has 346 tables. So the db user has access to the db and
> can
> read
> > the metadata.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: saving the state of a object collection

2008-03-28 Thread Greg Monroe
Only things that come to mind quickly are:

Use a custom Criteria to build a NOT IN clause that with
an expression to combine your keys.  E.g. build the 
following sort of Custom criteria:

CONCAT(CAST(Book.ID1 AS CHAR),'-',CAST(Book.ID2 AS CHAR)) 
NOT IN ( '1-1', '2-1',...)

Alternatively, you could just add a unique non-key record id 
to book table.  It doesn't have to be the key, just an 
auto increment field.  Then you could just use a normal
NOT IN criteria.

> -Original Message-
> From: Thomas Fischer [mailto:[EMAIL PROTECTED]
> Sent: Friday, March 28, 2008 11:23 AM
> To: torque-user@db.apache.org
> Subject: saving the state of a object collection
> 
> 
> Has anybody found a simple way to  save the state of object
collections
> ?
> To illustrate what I mean, here's an example (I'm using
> complexObjectModel
> = true and objectIsCaching = true):
> 
> I have two tables, Book and Author. A foreign key exists from book to
> Author, so an author can have several books associated.
> Now I load one author including the associated books. I modify the
> associated set (i.e modify, add and delete books) and want to save it
> as it
> is (i.e. after saving, the list of associated books in the database
> should
> be exactly equal to the list of books in the author object).
> 
> The algorithm I can come up with is the following:
> 1) select the ids of all books in the author object which are not new
> in a
> collection
> 2) delete all books for the author which have an id not in the above
> collection of ids
> 3) save the author (this will save the underlying books as well)
> 
> 2) is painful if the book table has a composite primary key (as I
> cannot
> see how Criteria.NOT_IN should work in this case (or does It ? please
> tell
> me!))
> Does anybody see an easier way to do this ? Hitting the database
during
> modifying the book list is not an option in my case because the
> possibility
> to NOT save the changes should exist after making the changes in the
> GUI
> 
>Thomas
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: alias attribute on table in schema.xml

2008-03-17 Thread Greg Monroe
Some vague memories and Google lead me to the following
references about the alias attribute:

http://turbine.apache.org/turbine/turbine-2.2.0/howto/extend-user-howto.
html

http://wiki.apache.org/db-torque/PostgreSQLFAQ 
(What other issues section)

Seems to be related to Torque's roots in Turbine...

> -Original Message-
> From: Thomas Fischer [mailto:[EMAIL PROTECTED]
> Sent: Sunday, March 16, 2008 7:49 AM
> To: torque-user@db.apache.org
> Subject: alias attribute on table in schema.xml
> 
> Does anyone know what the alias attribute on the table tag in the
> schema.xml is good for ?
> 
> If it is set the base class and peer class of the dbObject class are
> different, and a lot of code is not generated, but I could not make
any
> sense out of which code is still generated and which is not.
> 
> If anybody is using the attribute, I'd be happy for a short
description
> for what it is used.
> 
>  Thomas
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: using prepared statements for "in"

2008-03-10 Thread Greg Monroe
Just curious why you want/need to do this?  

Since the number of items in the "in set"(N) is variable, and
the prepared statement rules want a syntax like:

select * from foo where id in ( ?, ?, ?, ?...n)

(At least MySQL 5.0 does...)

The only optimization that I can see is if you're doing a bunch 
of queries with a fairly static number of items in the set.  
Otherwise, you're probably spending more CPU cycles trying 
to match a cached already prepared statement with the same N, 
then failing the match, generating and executing the prepared 
statement.  

IMHO, it's more efficient for the general case NOT to create
the "in set" as part of a prepared statement.  And if you have
the need for doing a set of queries with a static N, use the
OR condition.

But I haven't spent a lot of time thinking this thru so...
> -Original Message-
> From: Thomas Fischer [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 06, 2008 5:05 AM
> To: Apache Torque Users List
> Subject: RE: using prepared statements for "in"
> 
> I assume you are using XXPeer.doPSSelect ?
> Looking at the source code, I cannot see a way. Not even
> Criteria.CUSTOM
> will help :-(
> 
> Do jdbc drivers understand binding of a collection to a prepared
> statement
> ? I never tried it.
> 
>  Thomas
> 
> Raul Acevedo <[EMAIL PROTECTED]> schrieb am 06.03.2008 03:53:59:
> 
> > When you use Criteria.addIn, Torque does not generate a prepared
> > statement.  (Or at least it doesn't use bind variables for the "in"
> > part, even if it does for other parts of the query.)
> >
> > Is there a way to get Torque to use bind variables for this?
Without
> > having to convert the query into a bunch of "or"s?
> >
> > Raul
> >
> >
> >
-
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: orderBy clause failing to accept an alias

2008-03-10 Thread Greg Monroe
Hmm, this looks to be a bit of a book work error.  I traced this back
to the Torque-89 Jira issue.  This is still open because the 
reporting user never replied that the patch worked.  And no test
case to verify it was created.

However, in looking over the changes, it looks like one part of 
the requested change was not made.  In the SQLBuilder processOrderBy
method, there is a call to removeSQLFunction(...).  This will return
the exception you are seeing.

The missing part is a try / catch around this call with the catch
part using the original column name.  See:

http://issues.apache.org/jira/browse/TORQUE-89?focusedCommentId=12488935
#action_12488935

> -Original Message-
> From: Subadhra Jagannathan [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 10, 2008 2:27 PM
> To: Apache Torque Users List
> Subject: orderBy clause failing to accept an alias
> 
> Hello, All,
> 
> I am new to torque. In the new torque release, the change log says --
> "OrderBy now accepts column names without a dot. No additional
> processing is
> made for these".
> 
> But I am trying to use an alias with the orderBy clause and it fails
> with
> "removeSQLFunction() : Column name mz ASC does not contain a . or a *"
> message. How do I circumvent this?
> 
> Thanks a lot.
> Subadhra
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: What is the best way to escape input to SqlEnum.CUSTOM?

2008-03-10 Thread Greg Monroe
Yes, you're right.  I missed a test up the line for
Custom.  So, the answer is to use the static method:

SQLExpression.quoteAndEscapeText(String, DB) 

on the applicable parts of your custom criteria.
This will return a String quoted for the specific 
DB type.  E.g.:

String likePart = "%"+someText+"%";
DB db = Torque.getDB(TablePeer.DATABASE_NAME);
likePart = SqlExpression.quoteAndEscapeString(
   likePart, db);
String customPart = "myField like " + likePart;


> -Original Message-
> From: Martin Tilsted [mailto:[EMAIL PROTECTED]
> Sent: Friday, March 07, 2008 1:55 PM
> To: Apache Torque Users List
> Subject: Re: What is the best way to escape input to SqlEnum.CUSTOM?
> 
> Greg Monroe wrote:
> > As long as the Criteria value object is a String, you don't
> > have to worry. The code should be calling the following
> > method:
> >
> > SqlExpression.quoteAndEscapeText(String rawText, DB db)
> >
> > This surrounds the value with the correct quotes and
> > escapes stuff based on the type of DB.
> >
> But that can't be work for SqlEnum.CUSTOM because what if the query is
> something like
> 
> String customPart="myField like '%" + someText + "%'";
> where someText is the user input.
> 
> Doing a criteria.add("Table",customPart,SqlEnum.CUSTOM);
> If it excape the entire query then the result will be wrong, because
it
> will also escape the '  before the %, and that should not be escaped.
> 
> Which is why I am pretty sure I need to escape the someText string
> before i use it as part of a query with SqlEnum.CUSTOM.
> (I know the query can be made without SqlEnum.CUSTOM it's just an
> example).
> >
> >> -Original Message-
> >> From: Martin Tilsted [mailto:[EMAIL PROTECTED]
> >> Sent: Friday, March 07, 2008 1:01 PM
> >> To: Apache Torque Users List
> >> Subject: What is the best way to escape input to SqlEnum.CUSTOM?
> >>
> >> What is the best way to escape a (user input) value that is used as
> >> part
> >> of a SqlEnum.CUSTOM query?
> >>
> >> Is there a method that will escape strings based on the
requirements
> >>
> > of
> >
> >> the current open database connection?
> >>
> >> Martin
> >>
> >>

> -
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >
> > DukeCE Privacy Statement:
> > Please be advised that this e-mail and any files transmitted with
> > it are confidential communication or may otherwise be privileged or
> > confidential and are intended solely for the individual or entity
> > to whom they are addressed. If you are not the intended recipient
> > you may not rely on the contents of this email or any attachments,
> > and we ask that you please not read, copy or retransmit this
> > communication, but reply to the sender and destroy the email, its
> > contents, and all copies thereof immediately. Any unauthorized
> > dissemination, distribution or copying of this communication is
> > strictly prohibited.
> >
> >
-
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Criteria.addIn on List or Object[] doesn't generate quoted strings?

2008-03-10 Thread Greg Monroe
> From: Brendan Miller [mailto:[EMAIL PROTECTED]
> 
> Out of curiosity, what kind of performance implications do you think
> any of this (or your DataMap idea) would incur--is it really that
huge?

Well, my first thought was that the look up shouldn't occur in the 
processInValue method.  This gets called for each element in the
array which could be hundreds of times.

IMHO, the "ideal" solution would be that once Criteria are being 
processed into SQL, there should be one lookup that converts the
column info into a Column object.  This would have to deal with 
"pseudo" columns (E.g. aliased or function items). This object 
would have a method to get the ColumnMap object if it's a "real"
column.

This object is what is passed to all the build methods instead 
of a plain String "column" object.  This would limit the 
lookup overhead to once per each criteria.

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: What is the best way to escape input to SqlEnum.CUSTOM?

2008-03-07 Thread Greg Monroe
As long as the Criteria value object is a String, you don't 
have to worry. The code should be calling the following 
method: 

SqlExpression.quoteAndEscapeText(String rawText, DB db)

This surrounds the value with the correct quotes and 
escapes stuff based on the type of DB.

> -Original Message-
> From: Martin Tilsted [mailto:[EMAIL PROTECTED]
> Sent: Friday, March 07, 2008 1:01 PM
> To: Apache Torque Users List
> Subject: What is the best way to escape input to SqlEnum.CUSTOM?
> 
> What is the best way to escape a (user input) value that is used as
> part
> of a SqlEnum.CUSTOM query?
> 
> Is there a method that will escape strings based on the requirements
of
> the current open database connection?
> 
> Martin
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Criteria.addIn on List or Object[] doesn't generate quoted strings?

2008-03-06 Thread Greg Monroe
I traced out the code and found that the applicable 
section of code is the SQLExpression.processInValue 
method.  This is called with each member of the list
or array specified.  

This tests if the object is a String or not.  If it's
a string, it calls quoteAndEscapeText.  However, if
it's not a String, it just calls the object's toString()
method.

The problem is that there is no clean way to determine
if this type of object is supposed to be a quoted string
or an unquoted string.  Suppose that it's a list of 
Integer or Float objects? To wrap these in quotes would
be wrong in this case.

Hmm, I suppose the code could use the DataMap structure
to look up the SQL field type and then decide.  But that
assumes that the "Column" part of the IN is a true 
table column.  Also, some thought would need to go into
how to make this not be a performance issue.


> -Original Message-
> From: Brendan Miller [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 06, 2008 6:54 PM
> To: torque-user@db.apache.org
> Subject: Criteria.addIn on List or Object[] doesn't generate quoted
> strings?
> 
> 
> I am trying to use the addIn() method of the Criteria class.
> 
> I have a table with various states.  I would like to query objects
> whose
> state is in a list I define.
> 
> I have defined my states thusly:
> 
> public enum State { NEW, ACTIVE, SUSPENDED, CANCELED };
> 
> I have used both
> 
> crit.addIn(ServicePeer.State, new ArrayList {{
> add(State.NEW);
> add(State.ACTIVE);
> }});
> 
> and
> 
> crit.addIn(ServicePeer.State, { State.NEW, State.ACTIVE });
> 
> Both generate SQL as
> 
> SELECT SERVICE.ID, ... FROM SERVICE WHERE SERVICE.STATE IN
(NEW,ACTIVE)
> 
> Obviously, NEW and ACTIVE need to be quoted.  If I pass a List or
array
> of Strings, of course it works just fine.  (I know I can get a list or
> array of Strings by calling .toString() on my enum values.)
> 
> But the documentation says:
> 
> Adds an 'IN' clause with the criteria supplied as an Object array. For
> example:
> 
> FOO.NAME IN ('FOO', 'BAR', 'ZOW')
> 
> where 'values' contains three objects that evaluate to the respective
> strings above when .toString() is called.
> 
> 
> This led me to believe that .toString() would be called internally.  I
> guess it is (as I get the string literals in the SQL), but the strings
> are not quoted.  Shouldn't they be?
> 
> Is this a bug, or am I misreading the documentation?  If it's a bug,
> I'd be happy to enter a JIRA and attempt a patch.
> 
> Brendan
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: XML Entities in Table Names

2008-03-04 Thread Greg Monroe
The basic problem here is that in order for Torque to 
produce code and tables across the many Database server
it does, it has to adhere fairly closely to the SQL 
standards.  

The standards define that "regular identifiers" (e.g. 
column and table names) must consist of basically the 
same characters as a Java variable name and the XML 
identifier rules. So, the Torque limits these 
identifiers to this set. This means that the tables 
and columns in the XML schema definitions will be 
creatable in all the DB servers supported by Torque.

So, this error is saying telling you that the table or 
column name is not truly cross DB server compatible. If 
you want a DB schema design that is able to be use on 
any DB, use a different name.

That said, if you don't want true cross DB names, you 
MIGHT be able to get a little wiggle room in names by
using hex identifiers in the XML E.g. &X##; for SOME
of the characters.  This may get around the XML parser
limits.  You'll probably need to make sure you have
javaname attributes set in the XML to make the code work.

FWIW, there is a part of the standard that allows for
delimited identifiers. E.g., "Non#Standard#char". 
However, Torque currently does not support these. In 
addition, different DB server types have variations 
on this that make cross DB table names of this sort
problematic.

> -Original Message-
> From: Leo Przybylski [mailto:[EMAIL PROTECTED]
> Sent: Saturday, March 01, 2008 12:01 AM
> To: torque-user@db.apache.org
> Subject: XML Entities in Table Names
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Hello all,
> 
> I'm new to the list. I tried searching for the answer to my question
on
> the internet, but I can't seem to find it. Maybe I am asking the wrong
> question, but here it is.
> 
> I am using torque to copy one database to another. For example, Oracle
> to Oracle, or Oracle to MySQL. There is no way to know the source or
> target. Torque doesn't seem to care, and that's what I like about it.
> 
> Some RDBMS allow strange characters that are XML entities in the name.
> For example, Oracle will allow something like DEPT$SECTION or
something
> like that. '$' causes problems in XML. Torque produces the following
> error as a result:
> [torque-data-dump] org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An
> invalid or illegal XML character is specified.
> 
> What can I do to get around this? I am not opposed to entity
> translation
> in XML (ie.,  where DDOLLAR replaces $,)
> but
> how would I go about that?
> 
> 
> Much thanks in advance,
> 
> - --
> Leo Przybylski
> Application Systems Analyst, Senior
> Department of Sponsored Projects Services
> The University of Arizona
> Tucson, AZ 85701
> 
> Office: 520.626.6997
> E-mail: przybyls [at] u.arizona.edu
> URL: http://www.u.arizona.edu/~przybyls/,
> https://test.kuali.org/confluence/display/~lprzybylski
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFHyOMb+wbbSAAupSMRAtKKAKClHAq9uv5+s3WQoCgHrYqnxMwTbQCeLNXY
> G3kqrMhCQ4L2Lsne+2kYAYo=
> =Df79
> -END PGP SIGNATURE-
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Fwd: Columnmap only support one foreingkey

2008-02-19 Thread Greg Monroe


Thomas Fischer said:
> 
> On Tue, 19 Feb 2008, Fran Ferri wrote:
> >
> > Why the columnmap only supports one related column?
> > Is an update pending?
> 
> It seems that this particular information in ColumnMap does not
support
> multiple foreign key relations per column. But as this information is
> not
> used anyway, this has not been much of a problem in the past. There
are
> currently no plans to change this behaviour.
> 

I'm not even sure why this is needed?  AFAIK, the SQL standards
specifies:

The foreign key identifies a column or a set of columns in one
(referencing) 
table that refers to a column or set of columns in another (referenced)
table. 
The columns in the referencing table must be the primary key or other 
candidate key in the referenced table. The values in one row of the 
referencing columns must occur in a single row in the referenced table.

I'd interpret this as each column can only have one matching column in a

single remote table.  If you want the "ordering" for the remote tables' 
primary key set, you can get that by looking at the remote table's 
information.

But I could be wrong about in this.  I'd be curious to see the SQL that
would define the multiple foreign key on one column.  And then to see 
how many of the common Database servers support it.
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: db mapping

2008-02-11 Thread Greg Monroe
I think that information is now embedded in the Platform class
code in the org.apache.torque.engine.platform package.  

Start with the initialize method in the PlatformMysqlImpl code
and then look at the PlatformDefaultImpl code.  These  set 
up the schemaDomainMap which maps XML to DB specific SQL. 

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 11, 2008 6:10 PM
> To: torque-user
> Subject: db mapping
> 
> Hi all,
> 
> I don't not if the file still exist in torque 3.2+, but I am
> looking for a file that will give me the mapping between
> schema xml file types and trancode types in mysql sql
> language for exemple and in java.
> 
> In 3.1, there was .../templates/sql/base//db.props
> 
> but in 3.2+, I can't find this information anymore.
> 
> Thanks for your help !
> Thomas
> 
> 
> 
> -- ALICE C'EST ENCORE MIEUX AVEC LA MUSIQUE ! -
> ---
> Découvrez vite l'offre exclusive ALICE BOX avec ALICE MUSIC, le
> téléchargement légal et illimité
> de plus de 300 000 titres ! En cliquant ici
> http://alicemusic.aliceadsl.fr
> Offre soumise à conditions
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Get type of fields in auto generated classse

2008-01-18 Thread Greg Monroe
Not really a bug, they just use different types of
names as keys.  In the OM code (record/peer objects), 
they use the Java Name for the field.  In the Map code,
they use the SQL column names.  Mainly because these
sections on code focus on different areas. E.g.the Map 
code handles mapping the SQL schema and the OM code 
handles making it easy for Java programmers.

The ColumnMap objects also contains the JavaName for
the column. So, if you want to use this instead of 
the SQL name, you can use the getColumns() method in
TableMap and search this for the column with the 
matching JavaName.


> -Original Message-
> From: Martin Tilsted [mailto:[EMAIL PROTECTED] 
> Sent: Friday, January 18, 2008 9:33 AM
> To: Apache Torque Users List
> Subject: Re: Get type of fields in auto generated classse
> 
> Greg Monroe wrote:
> > All record objects and table Peer objects will have a
> > getTableMap() function.  You can use this to access all
> > the schema information.  E.g.:
> >
> > rec.getTableMap().getColumn(fieldName).getType();
> >   
> Think you, this work, but there is one small catch.
> In the database I have a field called
> name varchar(255) not nul,
> And to get the class I use
> BaseObject p;
> Class myClass=p.getTableMap().getColumn("name").getType().getClass();
> 
> And this works fine. I get the class back. But if I want to use 
> p.getByName() to get the value of the field
> I have to call with
> p.getByName("Name");
> That is: Give name with big N.
> 
> I don't know if this is a bug(I use torque 3.3 RC3) or a feature, but 
> it's rather confusing that the name of the column depend on 
> where I call 
> from.
> 
> Martin Tilsted
> > Will
> >  return a "sample object" of the same type as the
> > field.  Note that the XML can defined the objects being
> > returned via the getFieldName() methods as primitives.  
> > Since you can't return a primitive, the getType() 
> > returns the Object version of the primitive.  You may
> > need to check the usePrimitive property to verify the
> > actual type.
> >
> >   
> >> -Original Message-
> >> From: Martin Tilsted [mailto:[EMAIL PROTECTED] 
> >> Sent: Thursday, January 17, 2008 5:27 PM
> >> To: torque-user@db.apache.org
> >> Subject: Get type of fields in auto generated classse
> >>
> >> Is there a way to make a method, that given a field name, and 
> >> any auto generated object, can return the type of that field?
> >>
> >> Something like
> >> boolean isFieldAnInteger(BaseObject obj,String fieldName)  {
> >> // What here. (And is BaseObject the correct class to 
> >> use, if you want to accept something that can be any torque 
> >> auto generated class?) }
> >>
> >> At first I thought I could do
> >> Class c=obj. getByName(field).getClass(); But that don't work 
> >> if obj is a newly created object, becasue getByName will 
> return null.
> >>
> >> Martin
> >>
> >>
> >>
> >>
> >>
> >> 
> -
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >> 
> > DukeCE Privacy Statement:
> > Please be advised that this e-mail and any files transmitted with
> > it are confidential communication or may otherwise be privileged or
> > confidential and are intended solely for the individual or entity
> > to whom they are addressed. If you are not the intended recipient
> > you may not rely on the contents of this email or any attachments,
> > and we ask that you please not read, copy or retransmit this
> > communication, but reply to the sender and destroy the email, its
> > contents, and all copies thereof immediately. Any unauthorized
> > dissemination, distribution or copying of this communication is
> > strictly prohibited.
> >
> > 
> -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >   
> 
> 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Get type of fields in auto generated classse

2008-01-17 Thread Greg Monroe
All record objects and table Peer objects will have a
getTableMap() function.  You can use this to access all
the schema information.  E.g.:

rec.getTableMap().getColumn(fieldName).getType();

Will return a "sample object" of the same type as the
field.  Note that the XML can defined the objects being
returned via the getFieldName() methods as primitives.  
Since you can't return a primitive, the getType() 
returns the Object version of the primitive.  You may
need to check the usePrimitive property to verify the
actual type.

> -Original Message-
> From: Martin Tilsted [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, January 17, 2008 5:27 PM
> To: torque-user@db.apache.org
> Subject: Get type of fields in auto generated classse
> 
> Is there a way to make a method, that given a field name, and 
> any auto generated object, can return the type of that field?
> 
> Something like
> boolean isFieldAnInteger(BaseObject obj,String fieldName)  {
> // What here. (And is BaseObject the correct class to 
> use, if you want to accept something that can be any torque 
> auto generated class?) }
> 
> At first I thought I could do
> Class c=obj. getByName(field).getClass(); But that don't work 
> if obj is a newly created object, becasue getByName will return null.
> 
> Martin
> 
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: using timestamp with time zone

2008-01-02 Thread Greg Monroe
Some quick research on this indicated that this seems
to be a problem with the JDBC Timestamp API which does
not allow for the TimeZone part of the SQL data.  My
guess is that JDBC drivers for SQL servers that support
this column type convert this into the correct GMT 
time representation or supply a JDBC specific object
to support this.

Of course, this problem is compounded by the fact that
there is a LOT of variations of how different DB engines
(and version of them) support this column.

That said, there may be a couple of ways to deal with 
your problem in a local manner.

First, do you REALLY need that type of column?  Timezone
is really a display issue and not a storage one.  A date 
inserted into a DB Timestamp column using a Java Date object 
that has been created using Timezone parsing will be the
correct time if it is displayed with any associated TimeZone
setting.

If you really need this, then you might look at using a 
VARCHAR setting in the XML with the underlying DB manually
set to TIMESTAMP WITH TIMEZONE.  This should return your
JDBC's .toString() representation.  You can 
then locally override/add your own methods for converting 
too and from a Java date object via the String representation.





> -Original Message-
> From: Raul Acevedo [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, December 27, 2007 9:23 PM
> To: torque-user@db.apache.org
> Subject: using timestamp with time zone
> 
> Can Torque work with timestamp with time zone columns?  I have two
> problems:
> 
> 1.  Torque's XML mapping DTD doesn't allow "timestamp with 
> time zone", only "timestamp".
> 
> 2.  If I change the column type in the database, Torque 
> always reads null from that column.
> 
> Is it possible for this to work?  Many thanks,
> 
> Raul Acevedo
> http://www.cantara.com
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Question: Torque NULL handling on insert, update

2007-10-29 Thread Greg Monroe
Patrick is correct, primitives don't allow for NULL values
to be used.  FYI, there is also a defaultJavaType attribute
on the Database element that can be used to change all the 
getter/setter methods to objects.

FWIW, primitive is the "default" because it's generally 
more convenient for code writers to have native types 
than creating native objects all the time.  

That said, you're right in that how to deal with NULLs 
is not well documented.  In addition, one of the ToDo's
for 4.0 is to improve on how these are handled (e.g. have
an isNull() test and a way to set a null value if using
primatives.

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Sent: Monday, October 29, 2007 9:05 AM
> To: Apache Torque Users List
> Subject: Re: Question: Torque NULL handling on insert, update
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> I think that null values are not supported for primitive types.
> But you can change your schema to use objects instead of 
> primitive types
> for certain colums by setting the javaType attribute to object.
> See
> http://db.apache.org/torque/releases/torque-3.3/generator/sche
> ma-reference.html
> within the column section.
> 
> Patrick
> 
> brycenesbitt schrieb:
> > But SQL has an additional state:: null.  And there's a 
> difference between
> > calling a torque set method, and not calling a set method.  
> So the question
> > remains: is Torque's behavior documented?  Does Torque 
> support null column
> > values for primitive type columns (e.g. columns other than 
> String and
> > NumberKey)?
> > 
> > 
> > 
> >> What you find here is the Java default behavior. A int has 
> a default
> >> value of 0. It can not be set to null. Therefore when the value is
> >> initialized and no other value is given it is set to 0. 
> Same applies to
> >> long.
> >>
> > 
> 
> - --
> Patrick Carl
> mailto:[EMAIL PROTECTED]http://carl.it
> GnuPG-Fingerprint: 3599 02CF 0419 BCA6 6BAC 4B53 DB7C 1897 451C F498
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.7 (MingW32)
> 
> iD8DBQFHJdp723wYl0Uc9JgRAj4hAJ4gtkd7rU/N2vPUEd5jwZGbj91BKwCgvl1x
> AFOghNKPt0YNyMSjX2EYabU=
> =1MN0
> -END PGP SIGNATURE-
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: LargeSelect example ?

2007-10-26 Thread Greg Monroe
As a quick aside, it would be much easier to follow your 
messages, if your embedded comments where not prefixed
with one or more >'s.  Makes it real hard to see what 
are new comments and what are old.

That said, I tested the current CVS head (which is 99.9% 
final release for 3.3) against MS SQL 2000 just last 
week.  In order for this to pass all the Limit / 
LargeSelect tests in the test project, I committed some 
changes to the DBSybase class (which MS SQL extends).

So, try checking out the latest from CVS and using this. 
This should work with MS 2005.  The support is generic 
across all MS SQL versions, so it is "psuedo" support that
requires more data than requested to be read and "trimmed"
down.


> -Original Message-
> From: YannickR [mailto:[EMAIL PROTECTED] 
> Sent: Friday, October 26, 2007 12:26 PM
> To: torque-user@db.apache.org
> Subject: Re: LargeSelect example ?
> 
> 
> > 
> > Is the patch working or not ? The status on 
> > 
> https://issues.apache.org/jira/browse/TORQUE-84?page=com.atlassian.jir
> > a.plugin.system.issuetabpanels:all-tabpanel
> > seems to be unresolved...
> > 
> > Could someone help me on that one ?
> > Can I still use LargeSelect with MSSQL 2005 ?
> > 
> > Regards,
> > Yannick Richard
> > 
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Change JDBC to Java map

2007-10-25 Thread Greg Monroe
One quick solution comes to mind. If you don't need to use the 
SQL generated by Torque, you can just define your NUMERIC(9) fields
as INTEGER or BIGINT in the XML.  This should generate get/set methods 
that for long instead of BigDecimal. JDBC (or maybe Village) will 
manage the conversion when it's stored in the database.

FWIW, it looks like the default for Oracle is to map INTEGER into 
NUMBER(10,0).  If you want to change this mapping so that INTEGER
will generate NUMBER(9,0), you will need to modify / subclass the 
PlatformOracleImpl class in the Generator code. Look at the
PlatformFactory.getClassnameFor(String) method for details on how 
a "new" Platform implimentation can get used.


> -Original Message-
> From: Anas Mughal [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, October 24, 2007 11:19 AM
> To: Apache Torque Users List
> Subject: Change JDBC to Java map
> 
> We have specified NUMERIC(9) as the JDBC type for our primary keys.
> (Database is Oracle.)
> 
> The generated Java code produces BigDecimal for the NUMERIC 
> types. I am wondering if there is a way to change the 
> generator to produce "long"
> instead of BigDecimal.
> 
> I have done this type of changes when I used Propel. (Propel 
> is the PHP port of Torque.) It was pretty simple changing 
> type maps in Propel.
> 
> In TypeMap.java, I see the following maps:
> 
>- jdbcToJavaObjectMap
>- jdbcToJavaNativeMap
>- jdbcToVillageMethodMap
>- jdbcToPPMethodMap
>- jdbcToTorqueTypeMap
> 
> I am unsure which of the above I should change. Could someone 
> please guide me on what is the right way to enforce "long" on 
> the java-side for NUMERIC.
> Would it be advised not to change the existing Torque behavior?
> 
> Thank you very much.
> --
> Anas Mughal
> 
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: generated SQL criteria using date comparison does not work with MaxDB: {ts XXX} instead of {d XXX}

2007-10-22 Thread Greg Monroe
One quick thing to check is that you have defined the field 
as DATE in the Torque XML and not TIMESTAMP. Sometimes a 
missmatch in DB vs XML schema can cause this sort of thing.

If that is already set, then it may be an issue with the DBSapDB 
adaptor class not having a DB specific getDateString(Date) method
defined.  The SVN history on this adaptor does not show much a lot
of activity, which generally indicates no one has access to it
for testing during version releases. (Or it could just be a 
stable adaptor).

In general, most modern DBs (JDBC drivers?) will now handle the 
conversion of dates if the query is simply something like 
' mm dd hh:MM:ss' and doesn't have the DB specific ts or
d delimiter. Alternatively, if the SapDB can use the D'xxx'
format for both date and timestamp fields, the getDateString
method could return this format.

AFAIK, there is no free developer edition of the MaxDB product,
so this DB Adaptor depends on someone with access to a MaxDB
server to test it. If you have the time, it would be great
if you could check out the code from SVN and running the test 
project against your MaxDB server (see developer information 
on the web site).  This will test the adaptor against a large
set of known adaptor problems (and other things).

Let us know if there are problems (or better yet, no problems).
We'll be happy to work with you to update the DB adaptor 
if needed.


> From: Alexander Zimmer
> 
> I'm using Torque 3.3 with SAP's MaxDB 7.5.
> 
> This is what I want to do:
> 
> ---
> 
>   Criteria criteria = new Criteria();
> 
>   criteria.add(OrdersPeer.DELIVERY_DATE, cal.getTime(), 
> Criteria.LESS_EQUAL);
> 
> 
> This should bring up all rows with a "DELIVERY DATE" of max. 
> the date in the calender object "cal". The column DELIVERY 
> DATE ist DATE column (not timestamp). Thus, it should be rendered as:
> 
>   SELECT DISTINCT ORDERS.ORDER_ID FROM ORDERS WHERE 
> ORDERS.DELIVERY_DATE<={d '2007-10-29'}
> 
> which would work fine.
> 
> The problem:
> 
> 
> 
> However, Torque generates this constraint (only difference is 
> the use of {ts XXX} instead of {d XXX}):
> 
>   SELECT DISTINCT ORDERS.ORDER_ID FROM ORDERS WHERE 
> ORDERS.TARGET_DELIVERY_DATE<={ts '2007-10-29 09:35:09.556'}
> 
> Unfortunately, this leaves me with an internal MaxDB error: 
> move error.
> Don't ask me why the error message is apparently unrelated to 
> the problem, I tried do execute this query in a MaxDB client 
> and found that if I change the constraint to a pure date-wise 
> comparison (as shown
> above) it would work.
> 
> Is this a known issue? I am not 100% sure if this in fact is 
> a MaxDB error? IMHO it should work with timestamps as well. 
> Anyway, if Torque would use date comparison ({d XXX} instead 
> of {ts XXX}), it would work too. How can I get this to work?
> 
> TIA,
> 
> Alex
> 
> 
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Generating upgrade scripts based on schema changes

2007-08-15 Thread Greg Monroe
Take a look at the Apache DB subproject DDLUTILS. The API docs at

http://db.apache.org/ddlutils/api-usage.html#Changing+a+database

seem to indicate it will do what you want.  Plus they use
the same XML format as Torque does.

If that won't work, I know there are several fairly low cost 
commercial tools that will do this for different DBs. I have
used one (I think it was DBSolo) for MS SQL that 
generated a nice script you could run to update a DB SCHEMA.


> -Original Message-
> From: Joe . [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, August 15, 2007 4:39 AM
> To: torque-user@db.apache.org
> Subject: Generating upgrade scripts based on schema changes
> 
> 
> Hi,We're currently using torque generator to create schema 
> installation scripts for Oracle, MS SQL Server and DB2 with 
> great success. However, making alterations to the schema and 
> capturing these alterations in patch scripts is still a very 
> manual process.Does anyone know of any open source tools that 
> can help with this task? Either by automatically generating 
> the patch scripts (based on comparison of two schemas), or by 
> using some other means of upgrading (such as a java process 
> that runs and makes changes programmatically). The scripts 
> generated (or process run) would ideally be idempotent.Thanks,Joe
> _
> Feel like a local wherever you go with BackOfMyHand.com
> http://www.backofmyhand.com
> 
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: p6spy

2007-07-26 Thread Greg Monroe
During it's initialization, Torque (or the commons pooling 
it uses) just sets up the JDBC driver with the standard call
like:

Class.classFor()

And then creates connections using the DriverManager, eg.

DriverManager()

I notice that you are using a URL with a mysql jdbc schema. 
The DriverManager class does the matching of registered
drivers to schema.  Perhaps the real MySQL driver is being   
registered first by another web application?  Does p6spy 
have it's own schema you need to use with the JDBC URL to
ensure it's driver is the one used?

FWIW, I remember some people talking about using some sort
of tracking JDBC driver with Torque in the past.  It may
or may not have been p6spy.  You may want to look thru the 
mailing list archives to see if there is an alternative.
 

> -Original Message-
> From: Luis Pablo Gallo [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, July 26, 2007 12:27 PM
> To: Apache Torque Users List
> Subject: Re: p6spy
> 
> I also tried using that property with mysql, like this:
> 
> torque.database.morpheus.adapter = mysql
> 
> and didn't work either. I really don't know where is Torque 
> getting the
> driver from.
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: p6spy

2007-07-26 Thread Greg Monroe
I think the problem is that you don't have a:

torque.database.morpheus.adapter=

property in your config file.

Torque needs to know what the underlying database server type is so
it can handle various DB server differences.  It tries to figure
this out two ways.  The first (and recommended way) is via the 
adaptor property.  The second is to try to match an adaptor to the
driver class specifed.

As long as Torque knows what the underlying DB Type is, it doesn't
care about the jdbc driver. Unless the driver won't work with the
commons dbcp pooling code for some reason.
 
> -Original Message-
> From: Luis Pablo Gallo [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, July 25, 2007 10:12 PM
> To: torque-user@db.apache.org
> Subject: p6spy
> 
> Hi! I want to add the jdbc proxy p6spy to my application, but 
> Torque seems to ignore whatever I put in the 
> torque.dsfactory.morpheus.connection.driverparameter.
> My full configuration is:
> 
> torque.database.default = morpheus
> torque.database.morpheus.adapter = com.p6spy.engine.spy.P6SpyDriver
> 
> torque.dsfactory.morpheus.connection.driver = 
> com.p6spy.engine.spy.P6SpyDriver 
> torque.dsfactory.morpheus.connection.url =
> jdbc:mysql://localhost:3306/morpheus?autoReconnect=true&useUni
code=true&characterEncoding=utf8
> torque.dsfactory.morpheus.connection.user = morpheus 
> torque.dsfactory.morpheus.connection.password = morpheus
> 
> torque.dsfactory.morpheus.factory =
> org.apache.torque.dsfactory.SharedPoolDataSourceFactory
> 
> torque.dsfactory.morpheus.pool.maxActive = 30 
> torque.dsfactory.morpheus.pool.testOnBorrow = true 
> torque.dsfactory.morpheus.pool.validationQuery = SELECT 1
> 
> Any idea? I've searched half Internet and found nothing.
> Thanks in advance!!!
> 
> Luis Pablo
> 
DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: "inherence" accross 2 differents schemas / reuse some objects from one schema by another one

2007-06-25 Thread Greg Monroe
Having multiple DB designers is a common situation and can
be hard to manage even at the DB level.  Adding in the 
management of a common tightly integrated set of access 
objects isn't any easier.  It generally take good 
communications and well defined standard practices to work
well (no different than any multi-developer/multi-area 
project).

That said, here's a couple of extra thoughts on this:

First, I believe that you can use the external-schema syntax 
and the package attribute of the database tag can be used to 
force the java code to be created in different packages.  
This would make it easy to create an "integrated" set of 
DB objects and for build scripts to ignore the "core" 
packages.

Also, you meantion the core being security related. This
raises a design question you'll need to consider. How 
integrated should your security info be with your 
application code?  It is very tempting to integrate at the 
DB level, but what if you decide in the future to use LDAP 
or some other user management mechanism?  

A common way to design for this eventuality is not to use the 
DB code, but to define a set of interfaces that all your 
application code uses to get security info (e.g. user 
validation, user information, user rights, and the like). 
This may not be as convienient as a native access but it makes
migrating to another security mechanism much easier.

Finally, if all else fails and you need to keep them as
separate schema's, is writing code like:

coreTable = CoreTablePeer.retrieveByPK(appTable.getFKField());

A terrible burden? 

That said, having a nojava option might be a nice thing for
situations like this.  Only issue I can think of is that
it might cause compile issues if the external DB jar was
not available.  There might also be object loading issues
if the same packages was split across two jars.  I seem to
remember that one of the JVM's (under linux?) had issues
with this but they may have been resolved.




> -Original Message-
> From: Wieger Uffink [Us Media] [mailto:[EMAIL PROTECTED] 
> Sent: Monday, June 25, 2007 3:32 AM
> To: Apache Torque Users List
> Cc: torque-user@db.apache.org
> Subject: Re: "inherence" accross 2 differents schemas / reuse 
> some objects from one schema by another one
> 
> Hi,
> 
> I see your point. I would prefer the external-schema route. 
> If you have separate package names for the core and dependent 
> schemas it should be easy enough to remove the core classes 
> after generating the object model, either manually or by 
> using a build script, but it's not a very elegant solution...
> I don't think there is a 'skipJava' option in the schema, the 
> equivalent of 'skipSql' but something like that would solve 
> your issue, and should not be too hard to hack into the templates. 
> 
> HTH
> Wieger
> 
> -- 
> Us Media
> Stadhouderskade 115
> 1073 AX Amsterdam
> 
> t: +31 20 428 6868
> f: +31 20 470 6905
> w: http://www.usmedia.nl
> 
> - Original Message -
> From: "kstone" <[EMAIL PROTECTED]>
> To: torque-user@db.apache.org
> Sent: Friday, June 22, 2007 11:48:18 PM (GMT+0100) Europe/Berlin
> Subject: Re: "inherence" accross 2 differents schemas / reuse 
> some objects from one schema by another one
> 
> 
> I see a need to do this myself. Wieger, we are doing 
> something like you
> suggested with one hitch
> 
> Basically, we have a core application which is like a 
> jumpstart application.
> It contains all of the security DB tables etc.We have 3 
> dependent apps on
> the core and many future ones in design that will need to use 
> all of this
> functionality.
> 
>  So far jarring up the CORE and sending to other apps is 
> fine. Except when I
> need a FK to one of the core tables from the 
> dependentapp-schema.xml. Then
> we have to duplicate this core table entry in the 
> dependentapp-schema.xml.
> This causes two identical classes(one in jar and one in 
> dependent app) to be
> produced which creates a mess.
> 
> Using the external-schema element creates even a bigger mess b/c it
> recreates all of the core om classes in the dependent app.
> 
> We want to eliminate the core classes from being edited in 
> the dependent app
> code base. Only persons who understand how this could affect 
> all apps should
> be diving in here.
> 
> Any more ideas?
> Thanks!
> KStone
> 
> 
> 
> 
> 
> wieger wrote:
> > 
> > Hi Thomas,
> > 
> > When I have two or more web-applications who access the 
> same database I
> > usually create a separate jar which contains the generated torque
> > classes, and perhaps some other shared classes, and include 
> this in each
> > my web-applications. This way you have only one schema file 
> and one set
> > of Torque models to maintain. 
> > Not sure if this is 'best practice' but it works pretty well. 
> > 
> > Kind regards,
> > Wieger
> > -- 
> > Us Media
> > Stadhouderskade 115
> > 1073 AX Amsterdam
> > 
> > t: +31 20 428 6868
> > f: +31 20 470 6905
> > w: http://www.usmedia.nl
> > 
> > 
> > - Original 

RE: Joins and performance

2007-06-01 Thread Greg Monroe
> -Original Message-
> From: Robert Kromkamp [mailto:[EMAIL PROTECTED] 
> Sent: Friday, June 01, 2007 10:29 AM
> 
> Thanks for you reply! I've used views before within Torque. 
> But in that case I've problems with inserts/update 
> statements. How do you handle these?

Same way you do with normal SQL.. avoid them in any complex 
view. :D  I tend to use views for reporting / master list
sorts of things, e.g. display a list of employees sorted
by school and building.

If information needs to be updated, it should be in the
record detail.  E.g., the employee's info or the building
info.  If you're down to dealing with a single record and
it's related tables, there is no need to optimize.

Occationally, if I think another programmer might get 
confused by a Torque view object, I will override the
set methods to make them private.  This lets folks know
that this object is "special".

One other trick that is sometimes possible is to include
the primary key of the joined records and define them as
foreign keys in the "view" definition.  That way Torque will
generate the get related object(s) methods.  E.g., include
the employee id as part of the view and in the XML define it 
as a FK to the employee table.  Then if you have a "view" 
object, you can easily get the true employee record object 
(and use this for updates).

> 
> Regards,
> Robert
>  
> 
> -Original Message-
> From: Greg Monroe [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 01, 2007 4:15 PM
> To: Apache Torque Users List
> Subject: RE: Joins and performance
> 
> If this is a frequent/heavily used query, another way to deal 
> with this is to create a view and a matching Torque object.  
> There is a table option that suppresses the SQL generation.  
> You can then just use the Peer/Record object as like it was a 
> normal table.
> 
> Note you may want to pay close attention to the indices 
> requirements of the underlying table.  If commonly used 
> columns in a large join are not index, it can be a BIG 
> performance hit.
> 
> > -Original Message-
> > From: Vitzethum, Daniel [mailto:[EMAIL PROTECTED]
> > Sent: Friday, June 01, 2007 9:40 AM
> > To: Apache Torque Users List
> > Subject: AW: Joins and performance
> > 
> > Hi Robert,
> > 
> > > If I've 100 companies (which are schools) and 200 
> buildings, I will 
> > > executes 100 * 200 queries to get all the employees.
> > 
> > be sure to avoid this... sounds like a killer ;-)
> > 
> > > In low level SQL
> > > this query can be combined in one query. Is there a way to handle 
> > > this within Torque?
> > 
> > In Torque, you can use the Criteria.addJoin() method to link two 
> > tables.
> > 
> > 
> > Using that feature, you cannot use the Peer.doSelect() method, but 
> > have to use Peer.doSelectVillageRecords(), which will return all 
> > columns of all joined tables in a village Record object, 
> with no big 
> > difference to plain JDBC in handling. If you need or want 
> Torque data 
> > objects, you have to extract them one by one from the result set.
> > 
> > For a project of us, we wrote a helper class named JoinHelper that 
> > does this business for you AND returns an tree of Torque 
> objects. In 
> > your case, it would return COMPANY objects that can be queried for 
> > their BUILDINGs, which again know their EMPLOYEEs.
> > 
> > Please search the thread about two years ago in Torque 
> archive and the
> 
> > discussion about. JoinHelper massively uses reflection, but 
> is tested 
> > quite well and in production. If you have more detailled 
> questions...
> > you're welcome.
> > 
> > 
> > Daniel
> > 
> > 
> -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> Duke CE Privacy Statement
> Please be advised that this e-mail and any files transmitted 
> with it are confidential communication or may otherwise be 
> privileged or confidential and are intended solely for the 
> individual or entity to whom they are addressed.  If you are 
> not the intended recipient you may not rely on the contents 
> of this email or any attachments, and we ask that you  please 
> not read, copy or retransmit this communication, but reply to 
> the sender and destroy the email, its contents, and all 
> copies thereof immediately.  Any unauthorized dissemination, 
> distribution or copying of this communication is strictly prohibited.
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Joins and performance

2007-06-01 Thread Greg Monroe
If this is a frequent/heavily used query, another way to deal with 
this is to create a view and a matching Torque object.  There is 
a table option that suppresses the SQL generation.  You can then
just use the Peer/Record object as like it was a normal table.

Note you may want to pay close attention to the indices requirements
of the underlying table.  If commonly used columns in a large join
are not index, it can be a BIG performance hit.

> -Original Message-
> From: Vitzethum, Daniel [mailto:[EMAIL PROTECTED] 
> Sent: Friday, June 01, 2007 9:40 AM
> To: Apache Torque Users List
> Subject: AW: Joins and performance
> 
> Hi Robert,
> 
> > If I've 100 companies (which are schools) and 200 buildings, I will
> > executes 100 * 200 queries to get all the employees.
> 
> be sure to avoid this... sounds like a killer ;-)
> 
> > In low level SQL
> > this query can be combined in one query. Is there a way to handle
> > this within Torque?
> 
> In Torque, you can use the Criteria.addJoin() method to link 
> two tables.
> 
> 
> Using that feature, you cannot use the Peer.doSelect() 
> method, but have
> to use Peer.doSelectVillageRecords(), which will return all columns of
> all joined tables in a village Record object, with no big 
> difference to
> plain JDBC in handling. If you need or want Torque data objects, you
> have to extract them one by one from the result set.
> 
> For a project of us, we wrote a helper class named JoinHelper 
> that does
> this business for you AND returns an tree of Torque objects. In your
> case, it would return COMPANY objects that can be queried for their
> BUILDINGs, which again know their EMPLOYEEs.
> 
> Please search the thread about two years ago in Torque archive and the
> discussion about. JoinHelper massively uses reflection, but is tested
> quite well and in production. If you have more detailled questions...
> you're welcome.
> 
> 
> Daniel
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: encrypt database user info in the Torque.properties?

2007-05-24 Thread Greg Monroe
There is no built in support for this.

However, if you need that level of security, you can
use the Torque.init(Configuration conf) method to initialize
Torque with a "decrypted" version of your encrypted
config file.

E.g., make an "EncryptProperties" class that takes a
plain text config file can encrypts the whole thing.

Then create a matching DecryptReader class that can
be used to load a PropertiesConfiguration class.  E.g.,


if ( ! Torque.isInit() ) {
  DecryptReader dReader = new DecryptReader(keys, encryptedFile);
  PropertiesConfiguration conf = new PropertiesConfiguration();
  conf.load(dReader);
  Torque.init(conf);
}

Of course, if people have access to your compiled classes
they can probably decompile them and find your key values and
encryption methods...

> -Original Message-
> From: jill han [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, May 24, 2007 6:01 PM
> To: Apache Torque Users List
> Subject: encrypt database user info in the Torque.properties?
> 
> I put database user login data in the Torque.properties as  
> 
> torque.dsfactory.default.connection.user = username 
> torque.dsfactory.default.connection.password = userpassword
> 
> At first, I think it is quite common practice. Now somebody 
> questioned it for the security reason, saying "Storage of 
> user information in plain text will allow the database to be 
> compromised if web/app server is hacked."
> It was suggested to Encrypt the database details in the 
> configuration file.
> 
> Do you think it is a legitimate concern?
> Do you encrypt such data in the configuration file?
> 
> Your input is appreciated as always.
> 
> Jill
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Problem with OR Clause

2007-05-11 Thread Greg Monroe
FWIW, using a criterion would also work, but, IMHO, it's 
a little overkill for this.  You'd use a criterion here
if one or more of the fields where duplicated or you 
needed to do some special groupings.  E.g.:

  table.col1 = x or table.col1 = y 

Needs a criterion because col1 used twice.

  t.col1 = x and ( t.col2 >= y or t.col3 <= z)

Needs a criterion to get the or clause right.

The specified query had all different columns and
the logic didn't seem to need ordering.

But there are always a variety of ways to do things
and if it work, it isn't wrong. :D

> -Original Message-
> From: Alvaro Coronel [mailto:[EMAIL PROTECTED] 
> Sent: Friday, May 11, 2007 9:52 AM
> To: Apache Torque Users List
> Subject: RE: Problem with OR Clause
> 
> Maybe you need to use a Criterion 
> 
> Criteria c = ;   
> Criteria.Criterion crit = c.getNewCriterion();
> c.or(crit);
> 
> Greg Monroe <[EMAIL PROTECTED]> wrote: Old version of 
> torque so I'm not sure about this.  But my
> best guess would be that the crit.add(...) / or(..) methods
> are returning a copy of the original criteria object rather 
> than the original criteria.
> 
> So, in your complex statement, the first and() gets applied
> to the original.  The subsequent or()s get applied to new
> (different) criteria objects.
> 
> Try adding an assignment to it.  E.g.:
> 
> crit = crit.and(...).or(...)...
> 
> > -Original Message-
> > From: Mark Wassermann [mailto:[EMAIL PROTECTED] 
> > Sent: Friday, May 11, 2007 3:29 AM
> > To: torque-user@db.apache.org
> > Subject: Problem with OR Clause
> > 
> > Hi List
> > 
> > Im using torque 3.1.1 as part of turbine 2.3.2.
> > 
> > I want to create a quere to find an expression in one of the 
> > text collums of a table. I tryed to use the Criteria.or 
> > method, but it dose not work right. The debug log shows that 
> > torque is gnerating the clause with AND instead of OR.
> > 
> > What did I do wrong?
> > 
> > thx4help
> > Mark
> > 
> > -- CODE --
> > crit.add(TicketPeer.LOCATION, project);
> > crit.add(TicketPeer.LAST_NAME, searchField).or(TicketPeer.VENDOR,
> > searchField).or(TicketPeer.MODEL, searchField);
> > -- CODE --
> > 
> > --LOG --
> > 2007-05-10 11:57:38,484 [http-8080-2] DEBUG 
> > org.apache.torque.util.BasePeer - SELECT TICKET.ID, 
> > TICKET.CUSTOMER_TYPE_ID, TICKET.CUSTOMER_NR, 
> > TICKET.FIRST_NAME, TICKET.LAST_NAME, TICKET.ADRESS, 
> > TICKET.ZIP, TICKET.CITY, TICKET.COUNTRY, TICKET.PHONE, 
> > TICKET.VEHICLE_TYPE_ID, TICKET.VENDOR, TICKET.MODEL, 
> > TICKET.CAR_NUMBER, TICKET.DESCRIPTION, TICKET.TRANSFER, 
> > TICKET.LOCATION, TICKET.CHECKIN_DATE, TICKET.CHECKIN_CLERK, 
> > TICKET.CHECKOUT_DATE, TICKET.CHECKOUT_CLERK, TICKET.RATE, 
> > TICKET.FREE_DAYS, TICKET.PRICE, TICKET.PAYED, TICKET.CLOSED 
> > FROM TICKET WHERE TICKET.LOCATION=1000 AND 
> > TICKET.LAST_NAME='Wassermann'
> > ORDER BY TICKET.CHECKIN_DATE ASC
> > LIMIT 20
> > --LOG --
> > 
> > -- Mark Wassermann @: [EMAIL PROTECTED]
> > 
> > 
> -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> Duke CE Privacy Statement
> Please be advised that this e-mail and any files transmitted 
> with it are confidential communication or may otherwise be 
> privileged or confidential and are intended solely for the 
> individual or entity to whom they are addressed.  If you are 
> not the intended recipient you may not rely on the contents 
> of this email or any attachments, and we ask that you  please 
> not read, copy or retransmit this communication, but reply to 
> the sender and destroy the email, its contents, and all 
> copies thereof immediately.  Any unauthorized dissemination, 
> distribution or copying of this communication is strictly prohibited.
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
>
> -
> Park yourself in front of a world of choices in alternative vehicles.
> Visit the Yahoo! Auto Green Center.
> 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Problem with OR Clause

2007-05-11 Thread Greg Monroe
Old version of torque so I'm not sure about this.  But my
best guess would be that the crit.add(...) / or(..) methods
are returning a copy of the original criteria object rather 
than the original criteria.

So, in your complex statement, the first and() gets applied
to the original.  The subsequent or()s get applied to new
(different) criteria objects.

Try adding an assignment to it.  E.g.:

crit = crit.and(...).or(...)...

> -Original Message-
> From: Mark Wassermann [mailto:[EMAIL PROTECTED] 
> Sent: Friday, May 11, 2007 3:29 AM
> To: torque-user@db.apache.org
> Subject: Problem with OR Clause
> 
> Hi List
> 
> Im using torque 3.1.1 as part of turbine 2.3.2.
> 
> I want to create a quere to find an expression in one of the 
> text collums of a table. I tryed to use the Criteria.or 
> method, but it dose not work right. The debug log shows that 
> torque is gnerating the clause with AND instead of OR.
> 
> What did I do wrong?
> 
> thx4help
> Mark
> 
> -- CODE --
> crit.add(TicketPeer.LOCATION, project);
> crit.add(TicketPeer.LAST_NAME, searchField).or(TicketPeer.VENDOR,
> searchField).or(TicketPeer.MODEL, searchField);
> -- CODE --
> 
> --LOG --
> 2007-05-10 11:57:38,484 [http-8080-2] DEBUG 
> org.apache.torque.util.BasePeer - SELECT TICKET.ID, 
> TICKET.CUSTOMER_TYPE_ID, TICKET.CUSTOMER_NR, 
> TICKET.FIRST_NAME, TICKET.LAST_NAME, TICKET.ADRESS, 
> TICKET.ZIP, TICKET.CITY, TICKET.COUNTRY, TICKET.PHONE, 
> TICKET.VEHICLE_TYPE_ID, TICKET.VENDOR, TICKET.MODEL, 
> TICKET.CAR_NUMBER, TICKET.DESCRIPTION, TICKET.TRANSFER, 
> TICKET.LOCATION, TICKET.CHECKIN_DATE, TICKET.CHECKIN_CLERK, 
> TICKET.CHECKOUT_DATE, TICKET.CHECKOUT_CLERK, TICKET.RATE, 
> TICKET.FREE_DAYS, TICKET.PRICE, TICKET.PAYED, TICKET.CLOSED 
> FROM TICKET WHERE TICKET.LOCATION=1000 AND 
> TICKET.LAST_NAME='Wassermann'
> ORDER BY TICKET.CHECKIN_DATE ASC
> LIMIT 20
> --LOG --
> 
> -- Mark Wassermann @: [EMAIL PROTECTED]
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Wrong SQL generation from Criteria

2007-04-18 Thread Greg Monroe
Sounds like you want to use the:

  Criteria.addAscendingOrderBy(Column)
  Criteria.addDecendingOrderBy(Column)

methods.  Calling these in sequence will sort your 
results.  E.g.:

   c.addAscendingOrderBy(TablePeer.COL_1);
   c.addDescendingOrderBy(TablePeer.COL_2);

Will generate SQL like:

  Select * from Table 
 order by Table.COL_1 ASC TABLE.COL_2 DESC



> -Original Message-
> From: Brendan Miller [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, April 18, 2007 1:49 PM
> To: Apache Torque Users List
> Subject: Re: Wrong SQL generation from Criteria
> 
> 
> Thanks for the thorough explanation--this would make a great 
> addition to the documentation if there was an "How things work"
> section.
> 
> I see now why Torque is doing what it is doing.  What I was 
> hoping to achieve was a list of records grouped by one or 
> more of the fields.  That way I could let the database group 
> them and I could process the list in my code with a valid 
> assumption as to the ordering of the objects.  Is this possible?
> 
> Brendan
> 
> 
> On Wed, Apr 18, 2007 at 01:30:45PM -0400, Greg Monroe wrote:
> > 
> > OK, pardon me if you know some of this... just being complete...
> > 
> > The SQL Group By clause is defined for use with SQL summary 
> functions.  
> > E.g.:
> > 
> >   Select category, product, count(product) as in_stock
> > from products 
> > group by category, product
> > 
> > If you use a GROUP BY clause, the only valid non-summary 
> fields on the 
> > select are the ones listed in the group by clause.
> > 
> > Torque is for the most part a record retrieval based OM.  
> E.g., when 
> > you ask for something, you get a record object that is fully 
> > populated.  This means that when you use the RecordPeer.doSelect(c) 
> > methods, Torque needs to retreive all field values to fully 
> populate 
> > the record object.  So, it HAS to add all the table fields to the 
> > select.
> > 
> > If you want to use Criteria.groupBy() and the normal Peer 
> methods, you 
> > need to include ALL the fields.
> > However, by the time you do that, it's pretty much the same 
> as doing 
> > an AddAscendingOrderBy.
> > 
> > If you want to do a summary type function, you can do this 
> a couple of 
> > ways.  If it's just a count, you can use the CountHelper 
> function.  If 
> > it's more than that you can use BasePeer.doSelect(c) and 
> get the data 
> > from the Village Record objects returned.  E.g.
> > 
> >   Criteria c = new Criteria();
> >   c.addSelectColumn(ProductsPeer.CATEGORY);
> >   c.addSelectColumn(ProductsPeer.PRODUCT);
> >   c.addAsColumn("in_stock", "COUNT(" 
> > +ProductsPeer.PRODUCT+")");
> >   c.addGroupByColumn(ProductsPeer.CATEGORY);
> >   c.addGroupByColumn(ProductsPeer.PRODUCT);
> > 
> >   List results = BasePeer.doSelect(c);
> >   if ( results.size() > 0 ) {
> >  Record rec = (Record) results.get(0);
> >  category = rec.getValue(1).asString();
> >  product = rec.getValue(2).asString();
> >  in_stock = rec.getValue(3).asInt();
> >   }
> > 
> > This is almost the same as going back to standard results sets with 
> > the exception that you get protection against schema 
> changes.  Eg., if 
> > a column or table is dropped, your code won't compile so you know 
> > somethings wrong.
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: How to make the default database settable during runtime?

2007-04-18 Thread Greg Monroe
First lets make sure we have all the definitions correct
here because the term "database name" has been WAY 
overloaded and folks get the variations confused.

Torque's Schema Database name:

This is a compile time value that is used to connect 
the OM layer objects with their schema info (Map objects)
and find the DB connection info.

DB Server Database name:

This is a DB specific collection of tables, e.g. a 
Catalog in MySQL, a Database in MS SQL, and the like.

The only relationship between these two "database 
names" is that the Torque initialization properties
map the Schema database name to the Server Database 
name.  Specifically, via the JDBC connection info.

That said, the base question here is: What are you 
trying to accomplish here.  

Are you are trying to have MULTIPLE application 
instances (e.g. different web apps) using the same OM 
layer but accessing different Database server databases?  
Maybe with the server info coming from some external 
source (e.g. user supplied property or a DB table). 

In this case, it easy to dynamically create a 
Configuration object that maps the Torque database 
schema name to your DB Server database.  Then use this 
with the Torque.init(Configuration ) method.

If you are trying to use the same OM layer in the SAME 
application to access different server databases, life
becomes a lot more complicated.  You have to start 
thinking about multiple threads using different DB
info (in both senses of the word) and how not to have
transactions start on one server and end on another 
(because another thread changed the DB info).

Currently, the best way to do this is to write your
code using the methods that include a Connection
object, e.g, RecordPeer.doSelect(c, conn); For the most
part, these methods will perform the actions using the
specified connections.  I think most of the areas 
that used to "automagically" get connection have been
fixed so any method with a connection specified will use
it all the way down.

That said, you can then use Torque's DB pooling to 
manage your connections by using the
Torque.getConnection(DBName) method and initializing 
Torque with multiple Schema database names.  These
can be in your Torque init properties file or dynamically
created (as per above).

> -Original Message-
> From: Mehmet Erdem [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, April 18, 2007 11:40 AM
> To: torque-user@db.apache.org
> Subject: How to make the default database settable during runtime?
> 
> Hi,
> 
> I am using Torque 3.2 and I try to make the default database settable 
> during runtime.
> 
> I created a class DefaultDatabase with a static method getName() that 
> takes the default
> database name from a property file.
> 
> Then I modified the MapBuilder.vm and Peer.vm to refer to 
> this getName() 
> method instead of the template variable $table.Database.Name.
> 
> MapBuilder.vm:
> 
> <   dbMap = Torque.getDatabaseMap(DefaultDatabase.getName());
> ---
>  >   dbMap = Torque.getDatabaseMap("$table.Database.Name");
> 
> 
> Peer.vm:
> 
> < public static final String DATABASE_NAME = 
> DefaultDatabase.getName();
> <
> ---
>  > public static final String DATABASE_NAME = 
> "$table.Database.Name";
>  >
> 
> 
> So is this the right way to make the default database 
> settable. Or did I 
> miss something ? It seems
> unlikely that I am the only one so far who wants to change 
> the database 
> without regenerating
> classes.
> 
> Thanks,
> 
> Mehmet Erdem
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Wrong SQL generation from Criteria

2007-04-18 Thread Greg Monroe

OK, pardon me if you know some of this... just being 
complete...

The SQL Group By clause is defined for use with SQL 
summary functions.  E.g.:

  Select category, product, count(product) as in_stock
from products 
group by category, product

If you use a GROUP BY clause, the only valid non-summary
fields on the select are the ones listed in the 
group by clause.

Torque is for the most part a record retrieval based
OM.  E.g., when you ask for something, you get a
record object that is fully populated.  This means
that when you use the RecordPeer.doSelect(c) methods,
Torque needs to retreive all field values to fully 
populate the record object.  So, it HAS to add all
the table fields to the select.

If you want to use Criteria.groupBy() and the normal
Peer methods, you need to include ALL the fields.
However, by the time you do that, it's pretty much
the same as doing an AddAscendingOrderBy.

If you want to do a summary type function, you can
do this a couple of ways.  If it's just a count, you
can use the CountHelper function.  If it's more than
that you can use BasePeer.doSelect(c) and get the
data from the Village Record objects returned.  E.g.

  Criteria c = new Criteria();
  c.addSelectColumn(ProductsPeer.CATEGORY);
  c.addSelectColumn(ProductsPeer.PRODUCT);
  c.addAsColumn("in_stock", "COUNT(" 
+ProductsPeer.PRODUCT+")");
  c.addGroupByColumn(ProductsPeer.CATEGORY);
  c.addGroupByColumn(ProductsPeer.PRODUCT);

  List results = BasePeer.doSelect(c);
  if ( results.size() > 0 ) {
 Record rec = (Record) results.get(0);
 category = rec.getValue(1).asString();
 product = rec.getValue(2).asString();
 in_stock = rec.getValue(3).asInt();
  }

This is almost the same as going back to standard
results sets with the exception that you get 
protection against schema changes.  Eg., if a 
column or table is dropped, your code won't compile 
so you know somethings wrong.

> -Original Message-
> From: Brendan Miller [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, April 18, 2007 11:31 AM
> To: torque-user@db.apache.org
> Subject: Wrong SQL generation from Criteria
> 
> 
> Maybe I'm doing something very poor, but I thought I had used 
> these constructs successfully before.  (This is Oracle, BTW.)
> 
> My RESOURCE_LOCK table schema:
> 
> 
>  javaName="ItemID"/>
>  required="true" size="100" type="VARCHAR" 
> javaName="ResourceDescriptor"/>
>  javaName="EntryTimestamp"/>
>  javaName="LockerID"/>
>  javaName="LockerType"/>
>  javaName="ResourceTypeID"/>
> 
> 
> My code:
> 
> Criteria crit = new Criteria();
> crit.addGroupByColumn(ResourceLockPeer.LOCKER_TYPE);
> List locks = ResourceLockPeer.doSelect(crit);
> 
> The observed SQL from log4j when turned on:
> 
> SELECT RESOURCE_LOCK.ITEM_ID, 
> RESOURCE_LOCK.RESOURCE_DESCRIPTOR, 
> RESOURCE_LOCK.ENTRY_TIMESTAMP, RESOURCE_LOCK.LOCKER_ID, 
> RESOURCE_LOCK.LOCKER_TYPE, RESOURCE_LOCK.RESOURCE_TYPE FROM 
> DNS.RESOURCE_LOCK GROUP BY RESOURCE_LOCK.LOCKER_TYPE
> 
> The exception:
> 
> org.apache.torque.TorqueException: java.sql.SQLException: 
> ORA-00979: not a GROUP BY expression
> 
> DNS is the torque.database.schema, but I don't understand why 
> it is inconsistent in adding the database prefix in the FROM 
> clause but not the GROUP clause.
> 
> Joins are similarly affected:
> 
> Criteria crit = new Criteria();
> crit.add(ResourceLockPeer.LOCKER_ID, new Long(2115));
> crit.add(ResourceLockPeer.LOCKER_TYPE, "RECURBILLINGPROC");
> crit.addJoin(ResourceLockPeer.RESOURCE_DESCRIPTOR, 
> RecurBillingPeer.ID);
> crit.addGroupByColumn(RecurBillingPeer.ACCOUNT_ID);
> crit.addGroupByColumn(RecurBillingPeer.ACCOUNT_PAYMENT_ID);
> List recBilling = RecurBillingPeer.doSelect(crit);
> 
> The SQL is even worse, as it contains both the tablename and 
> dbprefix.tablename in the where clause, which gives Oracle 
> confusion fits.
> 
> SELECT <..all RECUR_BILLING fields..> FROM RESOURCE_LOCK, 
> RECUR_BILLING, DNS.RECUR_BILLING, DNS.RESOURCE_LOCK WHERE 
> RESOURCE_LOCK.RESOURCE_DESCRIPTOR=RECUR_BILLING.ID AND 
> RESOURCE_LOCK.LOCKER_TYPE='RECURBILLINGPROC' AND 
> RESOURCE_LOCK.LOCKER_ID=2115 GROUP BY 
> RECUR_BILLING.ACCOUNT_ID, RECUR_BILLING.ACCOUNT_PAYMENT_ID
> 
> Brendan
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the em

RE: Bean generation

2007-04-16 Thread Greg Monroe
Hmm, I did a quick scan of the 3.1 properties-reference.xml 
and did not find a option to disable object file generation.  
Are you sure you're using a torque build property to do this 
(could be an undocumented one in the old code) or do you 
have a custom set of templates to do this?

Anyway, with the new version this should be done via a custom
templates. See:

http://db.apache.org/torque/releases/torque-3.3/generator/custom-templat
es.html

To just create the beans, you can probably just comment out 
the $generator.parse statements you don't want in the 
om/Control.vm template file.

> -Original Message-
> From: Damon Jacobsen [mailto:[EMAIL PROTECTED] 
> Sent: Monday, April 16, 2007 3:38 PM
> To: torque-user@db.apache.org
> Subject: Bean generation
> 
> We have been using Torque 3.1 to generate our database beans 
> for us. We use our own persistance layer and only need the 
> Torque ability to generate xml from the database and then 
> generate beans from this information. It seems in 3.3 there 
> is no way to disable generation object files in the OM 
> target. Am I missing something?
>  
> Damon Jacobsen
> Software Engineer
> Lifetouch Studios
>  
> 
> __
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit 
> http://www.messagelabs.com/email 
> __
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: AW: Torque is very slow to do a .copy of an object :( Why?

2007-04-13 Thread Greg Monroe
Hmm, are you using a non-default build option of:

torque.complexObjectModel=false 

That's the only way that the copy( boolean deepcopy) method
would not be created in your BaseRecord object.  If you are
generating your OM layer with this set to false, then doing
an OM object .copy() is just a simple memory to memory copy.
And all the discusion of deepcopy isn't valid for you.

> -Original Message-
> From: philipina [mailto:[EMAIL PROTECTED] 
> Sent: Friday, April 13, 2007 4:22 AM
> To: [EMAIL PROTECTED]
> Subject: Re: AW: Torque is very slow to do a .copy of an 
> object :( Why?
> 
> 
> I tried to use the function .copy(false) but apparently this 
> one does not
> exists (I'm using torque 3.2-rc2) :( 
> 
> Alain 
> 
> 
> Thoralf Rickert wrote:
> > 
> > Hi!
> > 
> > Could you try a myObject1.copy(false) to avoid making a deepcopy.
> > 
> > bye
> > Thoralf
> > 
> >> I'm using torque to connect to my Mysql database.
> >> I'm trying to improve performence of my application and I saw 
> >> that torque is taking more than 600 ms to execute a command like:
> >> -
> >> Object1 myCopiedObject1 = myObject1.copy();
> >> -
> >> 
> >> Torque is only slow if I have a lots of data in my DB. I 
> >> cannot understand this! a copy should only do the work in 
> >> memory and not access the DB.
> > 
> > 
> > 
> > 
> -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> > 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Torque-is-very-slow-to-do-a-.copy-of-an-
> object-%3A%28-Why--tf3565099.html#a9974840
> Sent from the Apache DB - Torque Users mailing list archive 
> at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Torque is very slow to do a .copy of an object :( Why?

2007-04-12 Thread Greg Monroe
I remember there was a discussion a while back on the deep 
copy stuff.  I recall that the underlying logic for making
this the default was related to a copied object not being 
a "true" copy (as defined by the Java specs?) unless the 
associated complex objects were copied. But my memory's
prone to parity errors occationally...

Anyway, if you don't care about a copy being exact to 
the level of the related objects, you can use:

newRecord = record.copy(false); 

This will do a simpler and faster copy.  If you use the
copy to get related objects, only then will the cache
be refilled.

If you're code is slowing down with more data, turning 
on logging for Torque is a good idea.  The logs will have a
short version of all queries done and the time it took.  This
can let you quickly find the expensive queries that you need
to look at.  Generally, this means that you probably need 
to add an index or two on the where clause values.

> -Original Message-
> From: Federico Fissore [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, April 12, 2007 10:48 AM
> To: Apache Torque Users List
> Subject: Re: Torque is very slow to do a .copy of an object :( Why?
> 
> Hidde Boonstra [Us Media] ha scritto:
> > Hi,
> >
> > sorry, but I think that's what I mean:-) So if you have object1 and
> > object2 which references to object1 and you do a copy on object1 it 
> > will also copy and add all object2 instances that refer to 
> object1. It 
> > looks like this is recursive, because objects that refer to object2 
> > will probably be copied as well...
> >
> > Hope this helps to explain your slowdown,
> >
> > Hidde.
> >
> 
> You may also want to turn on debugging on package 
> org.apache.torque and see how many and what queries are you 
> actually doing by copying your object. You may find that 
> number surprising.
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Getting optimizer hints to mysql through Torque (USE INDEX)

2007-03-29 Thread Greg Monroe
Hmm, I can't think of a way to get that syntax thru even the 
village level stuff.

A couple of things to try rather than depending on specialized
syntax are:

Create an additional index based on the pod and stop fields.

Try reordering your where criteria.  SQL parsers will sometimes 
change the optimization paths based on these.

> -Original Message-
> From: Bryce Nesbitt [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, March 29, 2007 2:39 AM
> To: torque-user@db.apache.org
> Subject: Getting optimizer hints to mysql through Torque (USE INDEX)
> 
> I don't hold out much hope: but can I pass mysql optimizer 
> hints through torque?  I've got a query that is much faster 
> with USE INDEX:
> 
> SELECT * FROM CCS_ASSIGNMENT USE INDEX(IDX_STOP) WHERE 
> CCS_ASSIGNMENT.START<='2007033100'
> AND CCS_ASSIGNMENT.STOP>='2007032800'
> AND CCS_ASSIGNMENT.POD_ID=13;
> 
> Without a hint, the mysql optimizer chooses the POD_ID index, when the
> STOP index would be better.   Is there a way to convince 
> Torque to pass
> through the relevant bit of SQL?
> 
> The above query is from torque 3.0-b4, with the USE INDEX() added. 
> Criteria.CUSTOM won't work in this case.
> 
> http://www.obviously.com/
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Using views

2007-03-12 Thread Greg Monroe
Currently there is no easy way to do this.  One workaround
if you really need to limit access is to specify the 
protected="true" option on all columns in the XML.

If I remember correctly, this should change the set/get
methods from public to protected.  You can then manually
override the getter methods as public in the stub classes.

> -Original Message-
> From: Hernâni Cerqueira [mailto:[EMAIL PROTECTED] 
> Sent: Monday, March 12, 2007 9:32 AM
> To: Apache Torque Users List
> Subject: Re: Using views
> 
> Greg Monroe escreveu:
> > FWIW, by definition in SQL, views are the same as tables 
> > except that some fields may not be writable.  So, defining
> > them as tables in Torque will work for all DBs.
> >
> > One minor thing to do when defining the XML for these is
> > to add the skipSql="true" attribute to the table definition.
> > This will cause this table to be skipped in any generator 
> > sql creation.
> >   
> Hum, and is there any way of disabling the setter methods, 
> and saves and 
> stuff on class generation?
> 
> > Also, full support for views is on the list for version 4.0 
> > (but that will be a while).
> >
> >   
> >> -Original Message-
> >> From: Hernâni Cerqueira [mailto:[EMAIL PROTECTED] 
> >> Sent: Sunday, March 11, 2007 8:38 PM
> >> To: Apache Torque Users List
> >> Subject: Re: Using views
> >>
> >> Jeff Brekke escreveu:
> >> 
> >>> Hernâni Cerqueira wrote:
> >>>   
> >>>> Hello all,
> >>>>
> >>>> First of all i want to comment to any torque creator or 
> developer 
> >>>> under here that this tool is perfect. I don't know how did 
> >>>> 
> >> i spend so 
> >> 
> >>>> much time without it. Sorry if this isn't the right place 
> >>>> 
> >> for those 
> >> 
> >>>> kibd of coments but i didn't know where to do that.
> >>>>
> >>>> And now, my doubt. Is i possible to use views with torque. I've 
> >>>> already searched documentation about that, and i didn't find 
> >>>> anything, so i have few hopes, but anyway...
> >>>> 
> >>> Dependant on the database you're using, but we have 
> >>>   
> >> successfully used 
> >> 
> >>> them with Sybase.  Just have the view name the same as the 
> >>>   
> >> table name 
> >> 
> >>> your using in your definition.
> >>>
> >>>   
> >> I already did that with pg, but i thought that it wasn't the 
> >> right solution. But that's cool, now i know that my solution 
> >> it's not a bad one, ;-)
> >>
> >> Thank's for the repy
> >> Hernâni
> >>
> >> 
> -
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >> 
> >
> > Duke CE Privacy Statement
> > Please be advised that this e-mail and any files 
> transmitted with it are confidential communication or may 
> otherwise be privileged or confidential and are intended 
> solely for the individual or entity to whom they are 
> addressed.  If you are not the intended recipient you may not 
> rely on the contents of this email or any attachments, and we 
> ask that you  please not read, copy or retransmit this 
> communication, but reply to the sender and destroy the email, 
> its contents, and all copies thereof immediately.  Any 
> unauthorized dissemination, distribution or copying of this 
> communication is strictly prohibited.
> >
> >
> >
> > 
> -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >   
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Using views

2007-03-12 Thread Greg Monroe
FWIW, by definition in SQL, views are the same as tables 
except that some fields may not be writable.  So, defining
them as tables in Torque will work for all DBs.

One minor thing to do when defining the XML for these is
to add the skipSql="true" attribute to the table definition.
This will cause this table to be skipped in any generator 
sql creation.

Also, full support for views is on the list for version 4.0 
(but that will be a while).

> -Original Message-
> From: Hernâni Cerqueira [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, March 11, 2007 8:38 PM
> To: Apache Torque Users List
> Subject: Re: Using views
> 
> Jeff Brekke escreveu:
> > Hernâni Cerqueira wrote:
> >> Hello all,
> >>
> >> First of all i want to comment to any torque creator or developer 
> >> under here that this tool is perfect. I don't know how did 
> i spend so 
> >> much time without it. Sorry if this isn't the right place 
> for those 
> >> kibd of coments but i didn't know where to do that.
> >>
> >> And now, my doubt. Is i possible to use views with torque. I've 
> >> already searched documentation about that, and i didn't find 
> >> anything, so i have few hopes, but anyway...
> >
> > Dependant on the database you're using, but we have 
> successfully used 
> > them with Sybase.  Just have the view name the same as the 
> table name 
> > your using in your definition.
> >
> I already did that with pg, but i thought that it wasn't the 
> right solution. But that's cool, now i know that my solution 
> it's not a bad one, ;-)
> 
> Thank's for the repy
> Hernâni
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Schema migration tool

2007-02-12 Thread Greg Monroe
This is not really a Torque item but one for the 
DdlUtils project.

http://db.apache.org/ddlutils

They use Torque's schema (and a lot it's initial code
came from Torque).  Schema migration is one of this 
projects goals.

> -Original Message-
> From: Raphaël Piéroni [mailto:[EMAIL PROTECTED] 
> Sent: Monday, February 12, 2007 9:58 AM
> To: torque-user@db.apache.org
> Subject: Schema migration tool
> 
> Hi,
> 
> Is there a tool which creates an sql of database migration
> taking : an url of the current database schema and the 
> modified schema.xmlfile ?
> 
> It would be usefull to create one for torque 3.1.1 (the one i 
> use) and mysql
> (the db i use)
> It would also be usefull to have such a tool usable on maven1 
> (the one i use
> at work)
> 
> Thanks in advance for any answer.
> 
> 
> Raphaël
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Database independent error trapping.

2007-02-09 Thread Greg Monroe
Three or four years ago, I did some coding on a 
pre-Torque system that tried to deal with this issue.  
One major problem I remember is that there is no true 
standard for SQL error codes.  And what standards there 
are don't seem to be implimented very well (or at all).

To add to the confusion, the error codes are actually
generated/interpreted by the JDBC layer and not the
DB vendor.  So, you can't just say "MS SQL does it this
way", you have to say MS's JDBC driver does it this way, 
Avinar's does it this way, jTDS does it this way, etc.
I even found some variance in returne codes between driver
versions by the same vendor.

That said, what I ended up doing in my pre-Torque code
was to write a bit of "JDBC driver profiler" code that 
ran when the system started up.  This created the set
of errors my app was concerned with, stored them away,
and them my error checking code compared to these.

I'm not sure this can be applied to Torque since to find
the errors, your DB connect account rights have to be able 
to do thingslike create / delete tables, etc. that some
security folks frown on.

Hmm, I wonder if a new Torque 4 ToDo would be a bit of 
code that wraps any Torque exception with a check against
an optional application specific SQL RC to Exception type 
mapping. We could supply a "driver mapping" utility to 
generate this mapping file for the most common errors.

Just remember as I said at the start, this is from a 
few years back.  The state of things may have changed.
(but I know a lot of folks still using old drivers too...)

Greg

> -Original Message-
> From: Christopher Thill [mailto:[EMAIL PROTECTED] 
> Sent: Friday, February 09, 2007 6:47 AM
> To: Apache Torque Users List
> Subject: Database independent error trapping.
> 
> I am wondering if there is a way to do database independent 
> error trapping.
> 
> For example on a table/object that has a unique key I just 
> invoke the .save() method and and trap any exception.  I look 
> at the exception to see if it was a duplicate value in the 
> unique column that caused the error and then explain this to 
> the user in a friendly message.
> 
> My problem is that I want the system to portable to different 
> database so I do not want to do something
> like:
> 
> eSql = (SQLException) t;
> if ( !eSql.getSQLState().equals("23505") ) 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: torque-maven-plugin 3.3-RC1: 'subpackageManager' property -> TorqueException

2007-02-06 Thread Greg Monroe
This may actually already be fixed in CVS.  It sounds like
one of the alternate package usage problems in the templates that 
I found/fixed right after RC1 was released. 

> -Original Message-
> From: Thomas Fischer [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, February 06, 2007 9:09 AM
> To: Apache Torque Users List
> Subject: RE: torque-maven-plugin 3.3-RC1: 'subpackageManager' 
> property -> TorqueException
> 
> Hi,
> 
> this sounds like a bug. could you please open a jira issue ?
> 
> http://issues.apache.org/jira/browse/TORQUE
> 
>   Thanks in advance,
> 
> Thomas
> 
> "Hidde Boonstra [Us Media]" <[EMAIL PROTECTED]> schrieb am 06.02.2007
> 14:26:29:
> 
> > Hi all,
> >
> > I'm using the Maven2 torque plugin to generate my object 
> model. When 
> > using the 'subpackageManager' configuration property the generated 
> > classes end up in the specified package. However, the field 
> > 'DEFAULT_MANAGER_CLASS' in my Base<...>Manager is missing the 
> > specified subpackage. This results in a TorqueException caused by a 
> > ClassNotFoundException. I have looked for another property but 
> > couldn't find any. Can anybody tell me if I'm missing 
> something, or if 
> > this is perhaps a feature of the current version of the 
> generator plugin?
> >
> > Thanks,
> >
> > --
> > Hidde Boonstra
> > Us Media B.V.
> > Stadhouderskade 115
> > 1073 AX Amsterdam
> >
> > t: 020 428 68 68
> > f: 020 470 69 05
> > www.usmedia.nl
> >
> > 
> -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Is SQL Server 2005 supported in Torque?

2007-01-19 Thread Greg Monroe
What Thomas meant by extensions is that there has been a 
lot of changes to Torque relating to MS SQL over the last
year or so.  

The newest version has been tested against MS SQL 2000 (and
MS SQL V7) but not specifically against MS SQL 2005.  Mainly
because none of the developers has easy access to it. (I.e.,
I didn't DL the developer edition and install it somewhere.
;) )

But AFAIK, there are no major changes in MS SQL that would 
prevent Torque from working with it. Unless it's because MS 
has done a major split with the SQL standards, we'll try to 
fix any problems reported.

So the answer to the "Is it supported?" question is a 
qualified yes.

That said, here's some thoughts:

Unless you REALLY need to use MS's JDBC driver, I'd suggest 
using the jTDS JDBC driver (http://jtds.sourceforge.net/).
This is what we test with and it is known to be fully 
JDBC 4.0 compliant and well used in lots of production 
situations (we use it here).  See the MS SQL Database HOW 
TO for syntax, etc.

If you're updating from a Torque from before 3.1, there 
have been a lot of changes in the Torque property settings, 
both for the generation and runtime.  You will probably 
need to look closely at your old properties file to make 
sure you are using the same settings.

Good luck and feel free to ask questions here.

> -Original Message-
> From: Bill Tomlinson [mailto:[EMAIL PROTECTED] 
> Sent: Friday, January 19, 2007 4:40 PM
> To: Apache Torque Users List
> Subject: Re: Is SQL Server 2005 supported in Torque?
> 
> On 1/19/07, Thomas Vandahl <[EMAIL PROTECTED]> wrote:
> > >> But it does sound like SQL server 2005 is not an officially 
> > >> supported DB for the project.
> >
> > Well, you did not even say which Torque version you use. 
> 3.3 contains 
> > some MS specific extensions...
> >
> 
> I apologize for being obtuse, but I don't understand what 
> "contains some MS specific extensions..." exactly means?
> 
> Is SQL server 2005 supported in the latest release (3.3) or 
> not? If someone involved in the project says "yes" then I'll 
> dig in there and do whatever work I need to do to make it work.
> 
> I'm just asking because a) 2005 is not mentioned explicitly 
> on any Torque page I could find (and 2000 is) and b) the hard 
> coding of driver names in DBFactory suggests that some 
> drivers are supported and some aren't.
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: AW: Setting foreign key column as null

2007-01-11 Thread Greg Monroe
Played around with your sample schema and think I found 
the issue here.  With forgeign key columns, both the 
local and related columns need to be define using the same
javaType setting.

The issue is that in complex object mode, Torque objects
allow for forgeign keys to be set by using the foreign key
object.  E.g.:

Table1 t1 = 
Table2 t2 = new Table2();
t2.setValue1(xxx);
t2.setTable1(t1);

The advantage to this is that you don't have to know anything
about the keys used to relate t1 and t2, just that they are
related.

However, if the object types are different between the related
tables, the logic to generate code to do the right transformation
between types gets to be too complicated.

> -Original Message-
> From: Shilpa Kulkarni [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, January 10, 2007 5:34 PM
> To: Apache Torque Users List
> Subject: Re: AW: Setting foreign key column as null
> 
> Hi. Thanks for your help.
> 
> Defining javaType as object for a column name seemed like the 
> best solution. However the generated classes do not compile. 
> 
> The setParentAssetId method now takes a 'Long'  instead of 
> 'long' which will help me set it to null. However some 
> methods in the generated bean & data class still pass a long 
> to setParentAssetId method ( eg. setParentAssetId(0); ) & it 
> does not compile. I am using torque-3.2. 
> 
> Any suggestions? 
> 
> Shilpa

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: exception thrown because DB connection not correctly reinited after db server restart

2007-01-10 Thread Greg Monroe
The quick fix is to add the following lines to your 
init properties:

torque.dsfactory.web_test_suite.pool.testOnBorrow=true
torque.dsfactory.web_test_suite.pool.validationQuery=SELECT 1

This will cause the common-dbcp code to verify that any 
pooled connection is still valid before passing it to Torque.
Adds the overhead of a single quick DB query each time a 
connection is retrieved but it's a small price to pay to make
Apps independent of DB restarts.

As to the cause... when you say "close the app", do you 
mean just exist the browser pages or actually stop the 
webapp on TomCat via the manager/html app?  

If it's the former, then the webapp / Torque is still active
and has pooled connections still open.  These pooled 
connections are a big performance gain since getting a TCP
connection to an SQL server is time consuming.  But this
means that your apps don't behave like the (slower) "open a 
connection for each page/statement" ones that are common.

If it's the latter, then do you have the Torque lib (and 
support ones) in your common\lib directory and use it
across multiple web-apps? Then the reason is that in this
situation there is only one pool for all web-apps.  
Restarting a single webapp will not restart the pool. You
have to restart Tomcat (or explicitly shutdown and re-init
Torque but that can be problematic...).

> -Original Message-
> From: Eustache [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, January 10, 2007 11:31 AM
> To: Apache Torque Users List
> Subject: exception thrown because DB connection not correctly 
> reinited after db server restart
> 
> Hi, I wonder if you can help with the following problem:
> I use Tomcat 5.5, postgresql 8.3.1 and Torque.
> I first use the webapp using torque everything is ok. I close 
> the app, a db connection is still there.
> Now I reboot db. Try to relaunch the webapp and has this exception in
> catalina.out:
> 
> DEBUG org.apache.torque.util.SQLBuilder - SELECT 
> app_category.CATEGORY_ID, app_category.NAME FROM app_category WHERE
> app_category.CATEGORY_ID=1028
> org.apache.torque.TorqueException: 
> org.postgresql.util.PSQLException: An I/O error occured while 
> sending to the backend.
> 
> [torque.properties]
> torque.database.default=web_test_suite
> torque.database.web_test_suite.adapter = postgresql 
> torque.dsfactory.web_test_suite.factory = 
> org.apache.torque.dsfactory.SharedPoolDataSourceFactory
> torque.dsfactory.web_test_suite.connection.driver = 
> org.postgresql.Driver 
> torque.dsfactory.web_test_suite.connection.url = 
> jdbc:postgresql://myserver/mydb 
> torque.dsfactory.web_test_suite.connection.user = myuser 
> torque.dsfactory.web_test_suite.connection.password =
> 
> It seems that torque is not able to get a proper db 
> connection after the db server is restarted Any clue ?
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: AW: Setting foreign key column as null

2007-01-09 Thread Greg Monroe
The schema column tag has a javaType attribute that can
be used to specify a single column is to be treated as
an object rather than a primative.  E.g.:



FWIW, some DB server are very strict about foreign key
constraints.  So, your DB server may not let you set
the FK column to NULL.

> -Original Message-
> From: Shilpa Kulkarni [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, January 09, 2007 4:10 PM
> To: Apache Torque Users List
> Subject: Re: AW: Setting foreign key column as null
> 
> Thanks for your reply.
> 
> Wouldn't this change other the generated classes as well. 
> There is lot of code already passing primitives to exisiting 
> data classes.  Is there anything that can be  specifically 
> done for this  column? 
> 
> Shilpa
> 
> 
> - Original Message 
> From: Thoralf Rickert <[EMAIL PROTECTED]>
> To: Apache Torque Users List 
> Sent: Tuesday, January 9, 2007 1:45:37 AM
> Subject: AW: Setting foreign key column as null
> 
> Hi!
> 
> Did you try . Then every 
> primitive (long,int,boolean,...) is an object (Long, Integer, 
> Boolean, ...). I think, you cannot set this for a single 
> table. Just for all. 
> 
> bye
> Thoralf
> 
> 
> > -Ursprüngliche Nachricht-
> > Von: Shilpa Kulkarni [mailto:[EMAIL PROTECTED]
> > Gesendet: Dienstag, 9. Januar 2007 01:21
> > An: Apache Torque Users List
> > Betreff: Setting foreign key column as null
> > 
> > 
> > I am having trouble setting a foreign key value to null. 
> > Parts of my torque schema file are below. 
> > table_2.parent_asset_id has a foreign key constraint 
> defined on it & 
> > it must be either null or one of the table_1.asset_id column values.
> > 
> >>  idMethod="native">
> >  >   name="asset_id"
> >   required="true"
> >   primaryKey="true"
> >   type="BIGINT"
> >   description="ASSET ID"/>
> >   
> > 
> > 
> >>  idMethod="none">
> >  >   name="parent_asset_id"
> >   required="false"
> >   primaryKey="false"
> >   type="BIGINT" />
> > 
> > 
> > 
> > 
> >> local="parent_asset_id"
> > foreign="asset_id"/>
> > 
> >   
> > 
> > I want to be able to write code as follows:
> > 
> > Table2Bean table2Bean = new Table2Bean(); 
> > table2Bean.setParentAssetId(null);
> > 
> > However the setParentAssetId method in generated bean class 
> takes has 
> > input parameter of type 'long'. So passing null does not work.
> > 
> > The generated method in Table2Bean class looks like this:  
> > public void setParentAssetId(long v)
> > {
> >   
> > this.parentAssetId = v;
> > setModified(true);
> > 
> > }
> > 
> > 
> > If the generated method was taking an object paramter (Long 
> instead of 
> > long), it would work.
> > 
> > Any idea how to make it work? Any help is appreciated.
> > 
> > Shilpa
> > 
> > 
> > 
> > 
> > 
> > __
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam protection around 
> > http://mail.yahoo.com
> > 
> > 
> -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> 
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection 
> around http://mail.yahoo.com 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Metainformation of table

2006-12-17 Thread Greg Monroe
Torque meta info is contained in the Map classes.

You can get the TableMap object via getTableMap() 
methods in both the Peer or Record objects.  
This contains ColumnMap objects (and other linked
info) with Column specific names.

However, for convenience, the Java column names
are also contained in an array property of the
Record objects.  These can be used with the
getByName/setByName methods to quickly walk
thru the object values.

One "gotcha" with the Map data to be aware of is
that the DatabaseMap structure which holds the
TableMap objects is populated only if a Table
peer object is created. If you need to ensure
that the DatabaseMap object has all the tables,
you have to call it's initialize() method.

See the Javadocs for the possible problems with
this method.

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, December 17, 2006 1:04 PM
> To: torque-user@db.apache.org
> Subject: Metainformation of table
> 
> Hey ...
> 
> how can i get all meta information of a table, for example 
> the column names!? with pure mysql i can do that with 
> ResultSetMetaData meta = rs.getMetaData(); ...
> 
> thanks,
> aunts
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: AW: BigDecimal and MySQL decimal

2006-12-14 Thread Greg Monroe
For the record, the "proper" way to do this since Torque
3.2 is to use the size and scale attributes. (Though the
older size=(size,scale) is still supported).

One thing that can cause the SAX parsing exception is if 
the DTD specified in the DOCTYPE of your schema isn't set to 
use the same DTD as the version you're generating with.  E.g.:

http://db.apache.org/torque/dtd/database_3_2.dtd";>

This will let you use any new XML attributes.

> -Original Message-
> From: Jon August [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, December 14, 2006 8:55 AM
> To: Apache Torque Users List
> Cc: Thoralf Rickert
> Subject: Re: AW: BigDecimal and MySQL decimal
> 
> 
> The suggestions by Thoralf and Alvaro fixed the problem.  My 
> issue with the NullPointerException was unrelated.
> 
> Thanks for the help.
> 
> -Jon
> 
> 
> 
> On Dec 14, 2006, at 8:35 AM, Jon August wrote:
> 
> > Thanks - that fixed the "maven torque"...
> >
> > Now when I do the save from my object, I get an error that I wasn't 
> > getting when the scale wasn't set:
> >
> > java.lang.NullPointerException
> > java.math.BigDecimal.(BigDecimal.java:181)
> >
> >
> >
> >
> >
> >
> >
> > On Dec 14, 2006, at 7:55 AM, Thoralf Rickert wrote:
> >
> >> Try size="7,2" instead of size=".." scale=".."
> >>
> >>
> >>
> >>> -Ursprüngliche Nachricht-
> >>> Von: Jon August [mailto:[EMAIL PROTECTED]
> >>> Gesendet: Donnerstag, 14. Dezember 2006 13:52
> >>> An: Apache Torque Users List
> >>> Betreff: Re: BigDecimal and MySQL decimal
> >>>
> >>>
> >>> Hey Alvaro,
> >>>
> >>> Thanks for the suggestion.  I tried this:
> >>>
> >>>   >>> type="DECIMAL" />
> >>>
> >>> but I get this error when I run "maven torque":
> >>>
> >>> org.apache.torque.engine.EngineException: 
> org.xml.sax.SAXException:
> >>> Error while parsing wp-schema.xml at line 13 column 77 : 
> Attribute 
> >>> "scale" must be declared for element type "column".
> >>>
> >>>
> >>> Is my syntax incorrect?
> >>>
> >>> -Jon
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> On Dec 14, 2006, at 7:24 AM, Alvaro Coronel wrote:
> >>>
>  I have had no trouble using it just as you do. Maybe you haven't 
>  set the scale yet.
> 
>  This is an excerpt of my schema.xml file:
> 
>     required="true"
>   scale="2"
>   size="7"
>   type="DECIMAL" />
> 
>  What I usually do is to define the schema.xml file and from it 
>  obtain the .sql file via ant to create the database.
> 
>  Good luck,
>  Álvaro.
> 
>  Jon August <[EMAIL PROTECTED]> wrote: Hey,
> 
>  I'm using decimal (in the schema) to store a dollar amount
> >>> in my MySQL
>  database.  I get the value from a web page and convert it to a 
>  BigDecimal before storing it.  For some reason, the 
> decimal portion 
>  gets truncated and $10.32 gets stored as 10.  Should I be using 
>  something other than BigDecimal or is there something else wrong?
> 
>  Sorry if this is not a torque question.
> 
>  -Jon
> 
> 
> >>> 
> 
> >>> -
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
>  -
>  Want to start your own business? Learn how on Yahoo! Small 
>  Business.
> >>>
> >>>
> >>> 
> 
> >>> -
> >>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>
> >>>
> >>
> >>
> >>
> >> 
> -
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: MapBuilder failed trying to instantiate

2006-12-13 Thread Greg Monroe
First the obvious... make sure your build/jar process 
includes ALL the Torque generated files and packages.
The class mentioned in the error is a generated one.
  
Depending on your build settings, there will be two or more
subpackages created by default below the torque
targetPackage you specified.  There is also a MapBuilder
related org.apache.torque.linkage package generated that
is used if you need to manually initialize all your 
schema's map info.

Some other posiblities:

Did you manually defined any of the subpackages in your 
build properties?  Depending on the Torque version, there
are some known issues with trying to set a lot of these.

Also, Tomcat impliments strict class loader security. I.e., 
if a class is loaded at the lib/shared level, it may not 
"see" classes in the WEB-INF/lib directory.  This is to 
keep webapps from getting unauthorized access to system
level functions.  This is especially tight for the 
Class.forName type of calls that the MapBuilder code uses.

Anyway, the way to solve this is to make sure your OM
classes are at the same "level" (e.g. lib/shared or 
WEB-INF/lib) as the Torque runtime jars.

One minor design consideration here is that if you put
all your OM files at the webapp level, you will have a 
connection pool for each webapp vs a single connection 
pool if you keep you OM level stuff at the commons/shared 
level.  There are advantages and disadvantages to both ways.


> -Original Message-
> From: Jon August [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, December 13, 2006 10:29 AM
> To: Apache Torque Users List
> Subject: MapBuilder failed trying to instantiate
> 
> Hello,
> 
> I'm working on a new project using MySQL.  When I start up 
> Tomcat 5.0, I get the errors below.  when I try to do an 
> insert, I get this:
> 
> org.apache.torque.TorqueException: java.lang.ClassNotFoundException:  
> com.internection.washpress.torque.map.ItemMapBuilder
> 
> I have a feeling it's a problem with the jar files I'm using, 
> but I don't know where to start.  Any help is appreciated.
> 
> Thanks,
>   -Jon
> 
> 
> 
> 
> SEVERE: BasePeer.MapBuilder failed trying to instantiate:  
> com.internection.washpress.torque.map.ItemMapBuilder
> java.lang.ClassNotFoundException:  
> com.internection.washpress.torque.map.ItemMapBuilder
>   at org.apache.catalina.loader.WebappClassLoader.loadClass
> (WebappClassLoader.java:1340)
>   at org.apache.catalina.loader.WebappClassLoader.loadClass
> (WebappClassLoader.java:1189)
>   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
>   at java.lang.Class.forName0(Native Method)
>   at java.lang.Class.forName(Class.java:141)
>   at 
> org.apache.torque.util.BasePeer.getMapBuilder(BasePeer.java:1355)
>   at com.internection.washpress.torque.BaseItemPeer.getMapBuilder
> (BaseItemPeer.java:59)
>   at 
> com.internection.washpress.torque.BaseItem.save(BaseItem.java:459)
>   at 
> org.apache.jsp.addExecute_jsp._jspService(addExecute_jsp.java:69)
>   at 
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
>   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>   at org.apache.jasper.servlet.JspServletWrapper.service
> (JspServletWrapper.java:324)
>   at org.apache.jasper.servlet.JspServlet.serviceJspFile
> (JspServlet.java:292)
>   at 
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
>   at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>   at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
> (ApplicationFilterChain.java:237)
>   at org.apache.catalina.core.ApplicationFilterChain.doFilter
> (ApplicationFilterChain.java:157)
>   at org.apache.catalina.core.StandardWrapperValve.invoke
> (StandardWrapperValve.java:214)
>   at org.apache.catalina.core.StandardValveContext.invokeNext
> (StandardValveContext.java:104)
>   at org.apache.catalina.core.StandardPipeline.invoke
> (StandardPipeline.java:520)
>   at org.apache.catalina.core.StandardContextValve.invokeInternal
> (StandardContextValve.java:198)
>   at org.apache.catalina.core.StandardContextValve.invoke
> (StandardContextValve.java:152)
>   at org.apache.catalina.core.StandardValveContext.invokeNext
> (StandardValveContext.java:104)
>   at org.apache.catalina.core.StandardPipeline.invoke
> (StandardPipeline.java:520)
>   at org.apache.catalina.core.StandardHostValve.invoke
> (StandardHostValve.java:137)
>   at org.apache.catalina.core.StandardValveContext.invokeNext
> (StandardValveContext.java:104)
>   at org.apache.catalina.valves.ErrorReportValve.invoke
> (ErrorReportValve.java:117)
>   at org.apache.catalina.core.StandardValveContext.invokeNext
> (StandardValveContext.java:102)
>   at org.apache.catalina.core.StandardPipeline.invoke
> (StandardPipeline.java:520)
>   at org.apache.catalina.core.StandardEngineValve.invoke
> (StandardEngineValve.java:109)
>   at org.

RE: torque runtime and ibm db2

2006-12-07 Thread Greg Monroe
Hmm, we need some better docs / error handling here.  This is
because db2 is not a valid adaptor name because there are three
flavors of DB2.  These are:

  db2net : "used to connect via the NET-Driver"
  db2app : "used to connect via the Application-Driver"
  as400  : "for DB2/400 on the IBM AS400 platform"

You need to use one of these adaptor names.

Also, at a minimum, you will want to wrap your Torque.init(..)
call with a check to see if Torque has been initialized.  Eg.

if ( ! Torque.isInit() ) {
Torque.init(...)
}

FYI - A good way to initialize Torque to create a 
ServletContextListener implimentation and use the 
contextInitialized method to set up your webapp (including 
initializing Torque).  Add this as a   in your web.xml 
file and anytime the server is started (or context reloaded) 
Torque will be initialized.

> -Original Message-
> From: Aljosa Mohorovic [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, December 07, 2006 11:58 AM
> To: Apache Torque Users List
> Subject: torque runtime and ibm db2
> 
> generator works without problems using ant:
> ant -f build-torque.xml
> ant -f build-torque.xml create-db
> ant -f build-torque.xml insert-sql
> ant -f build-torque.xml jdbc
> 
> all targets end with "BUILD SUCCESSFUL"
> 
> but when using runtime in web application:
> >>>
> org.apache.jasper.JasperException: Exception in JSP: /index.jsp:26
> 
> 23: <%@ page
> import="org.apache.commons.beanutils.*,org.apache.torque.*,tor
> que.generated.*"
> %>
> 24: <%
> 25:
> 26: Torque.init("C:\\Projects\\db2.properties");
> 27:
> 28: %>
> <<<
> 
> db2.properties:
> >>>
> torque.database.default = torquetest
> torque.database.torquetest.adapter = db2
> 
> #Using commons-dbcp
> torque.dsfactory.torquetest.factory =
> org.apache.torque.dsfactory.SharedPoolDataSourceFactory
> torque.dsfactory.torquetest.connection.driver = 
> com.ibm.db2.jcc.DB2Driver 
> torque.dsfactory.torquetest.connection.url = 
> jdbc:db2://127.0.0.1:5/torquetest
> torque.dsfactory.torquetest.connection.user = aljosa 
> torque.dsfactory.torquetest.connection.password = aljosa <<<
> 
> tomcat - root cause:
> >>>
> java.lang.NullPointerException
>   java.lang.Class.forName0(Native Method)
>   java.lang.Class.forName(Class.java:164)
>   org.apache.torque.adapter.DBFactory.create(DBFactory.java:165)
>   
> org.apache.torque.TorqueInstance.initAdapters(TorqueInstance.java:254)
>   
> org.apache.torque.TorqueInstance.initialize(TorqueInstance.java:157)
>   org.apache.torque.TorqueInstance.init(TorqueInstance.java:464)
>   org.apache.torque.TorqueInstance.init(TorqueInstance.java:444)
>   org.apache.torque.Torque.init(Torque.java:138)
>   org.apache.jsp.index_jsp._jspService(index_jsp.java:65)
>   
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
>   javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>   
> org.apache.jasper.servlet.JspServletWrapper.service(JspServlet
> Wrapper.java:332)
>   
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet
> .java:314)
>   
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
>   javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>   
> org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter
> (MonitorFilter.java:368)
> <<<
> 
> anyone here using ibm db2? any ideas why i have this problem?
> 
> --
> Aljosa Mohorovic
> 
> http://www.revolucija.hr
> Ivana Lucica 5
> 1 Zagreb, Croatia
> 
> +385 (0)1 616 8414
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: maven torque failed

2006-12-06 Thread Greg Monroe
Another user reported a similar problem that may be related.  It 
looks like a jar for a product Torque uses (Velocity) was 
dropped from the dependencies by mistake. 

Try this for a quick fix:

Jump ahead to the next section in Step 3 of the tutorial 
(Creating the database and tables).  Follow that to 
create your project.xml file.

Then add the following dependany element in the dependancies
XML section.


  logkit
  logkit
  1.0.1
 
http://avalon.apache.org/products/runtime/system/logging/
  
true
  


This should add the missing jar to the maven classpath and 
hopefully fix your maven torque problem.

Alternatively, if you want to use ant, just get the logkit-1.0.1.jar
from the avalon.apache.org site and put it in the generator lib
directory.

Let us know if this fixes it.


> -Original Message-
> From: Aljosa Mohorovic [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, December 06, 2006 7:03 AM
> To: Apache Torque Users List
> Subject: maven torque failed
> 
> this is maven-torque tutorial/step 3,  when i type maven 
> torque i get this errror:
> 
> >>>
> C:\Documents and Settings\Administrator\Desktop\test>maven 
> torque  __  __
> |  \/  |__ _Apache__ ___
> | |\/| / _` \ V / -_) ' \  ~ intelligent projects ~
> |_|  |_\__,_|\_/\___|_||_|  v. 1.0.2
> 
> 
> BUILD FAILED
> File.. C:\Documents and 
> Settings\Administrator\.maven\cache\maven-torque-plu
> gin-3.3-RC1\plugin.jelly
> Element... taskdef
> Line.. 115
> Column 63
> taskdef class org.apache.torque.task.TorqueDataModelTask 
> cannot be found Total time: 2 seconds Finished at: Wed Dec 06 
> 12:48:12 CET 2006 <<<
> 
> --
> Aljosa Mohorovic
> 
> http://www.revolucija.hr
> Ivana Lucica 5
> 1 Zagreb, Croatia
> 
> +385 (0)1 616 8414
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: duplicate ID exception in cluster

2006-12-05 Thread Greg Monroe
Thoralf is right, the only way to make the idBroker 
"cluster" safe is to use transactions on any Peer
doInsert/Update methods.  E.g.:

Connection con = null;
try
{
   con = Transaction.begin(dbName);
   MyTablePeer.doInsert( criteria, con);
   Transaction.commit(con);
}
catch(TorqueException e)
{
   Transaction.safeRollback(con);
   throw e;
}

You don't need to do this with the record object
save() method, because this is already wrapped
in a simple transaction.

Please note that I verified this against the latest 
code.  It may not work under V3.0.  I seem to remember
some mods going in to make the keygen stuff use the
same connection instead of a different one so the 
idBroker would be transaction safe... but this could
be a parity error in my memory.

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> On Behalf Of Will Glass-Husain
> Sent: Tuesday, December 05, 2006 10:05 AM
> To: torque-user@db.apache.org
> Subject: duplicate ID exception in cluster
> 
> Hi,
> 
> I just set up a new 2 server cluster with two instances of 
> Tomcat both reading/writing from a single database.  I'm 
> using Torque 3.0, the default ID Broker and MySQL 5. (InnoDB)
> 
> My problem... Under heavy load, I notice that most write 
> requests on one of the servers fails with a duplicate ID 
> error.  Typically, each page request that fails does 10-20 
> insert statements.
> 
> Any tips as to how I might make this cluster work with 
> simultaneous writes?
> 
> WILL
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: torque project compile with ant

2006-12-05 Thread Greg Monroe
First thing to try is to use version=3.3-RC1 on the maven 
plug-in command.  3.3 has not been officially released (but
some of the docs may refer to it in advance).

If this doesn't fix it, I saw a reference to the 301 errors 
occuring because the Apache.org folks moved the repository 
from www.apache.org to people.apache.org.  The redirect from
the old site to the new is not supported by Maven 1.0.

You should check that your maven config files reference this 
site instead of www.apache.org or cvs.apache.org.

> -Original Message-
> From: Aljosa Mohorovic [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, December 05, 2006 11:47 AM
> To: Apache Torque Users List
> Subject: Re: torque project compile with ant
> 
> On 12/5/06, Greg Monroe <[EMAIL PROTECTED]> wrote:
> > The best way to build Torque is to use Maven (V1.0).
> > Since this is what the developers use all the time, it's
> > guaranteed to work.  It's relatively painless to install
> > and learn to run.
> 
> i'm not using maven because command:
> "maven plugin:download -DartifactId=maven-torque-plugin
> -DgroupId=torque -Dversion=3.3"
> results in maven not understanding 301 redirects, so i use ant.
> 
> how can i resolve this maven problem?
> 
> >>>
>  __  __
> |  \/  |__ _Apache__ ___
> | |\/| / _` \ V / -_) ' \  ~ intelligent projects ~
> |_|  |_\__,_|\_/\___|_||_|  v. 1.0.2
> 
> Attempting to download commons-io-20030203.000550.jar.
> Error retrieving artifact from
> [http://www.ibiblio.org/maven/commons-io/jars/commons-io-20030
203.000550.jar]:
> java.io.IOException: Unknown error downloading; status code was: 301
> WARNING: Failed to download commons-io-20030203.000550.jar.
> Attempting to download commons-net-1.1.0.jar.
> Error retrieving artifact from
> [http://www.ibiblio.org/maven/commons-net/jars/commons-net-1.1.0.jar]:
> java.io.IOException: Unknown error downloading; status code was: 301
> WARNING: Failed to download commons-net-1.1.0.jar.
> Attempting to download commons-httpclient-2.0.jar.
> Error retrieving artifact from
> [http://www.ibiblio.org/maven/commons-httpclient/jars/commons-
> httpclient-2.0.jar]:
> java.io.IOException: Unknown error downloading; status code was: 301
> WARNING: Failed to download commons-httpclient-2.0.jar.
> Attempting to download commons-lang-2.0.jar.
> Error retrieving artifact from
> [http://www.ibiblio.org/maven/commons-lang/jars/commons-lang-2.0.jar]:
> java.io.IOException: Unknown error downloading; status code was: 301
> WARNING: Failed to download commons-lang-2.0.jar.
> Attempting to download commons-logging-1.0.3.jar.
> Error retrieving artifact from
> [http://www.ibiblio.org/maven/commons-logging/jars/commons-log
ging-1.0.3.jar]:
> java.io.IOException: Unknown error downloading; status code was: 301
> WARNING: Failed to download commons-logging-1.0.3.jar.
> Attempting to download jsch-0.1.5.jar.
> Error retrieving artifact from
> [http://www.ibiblio.org/maven/jsch/jars/jsch-0.1.5.jar]:
> java.io.IOException: Unknown error downloading; status code was: 301
> WARNING: Failed to download jsch-0.1.5.jar.
> Attempting to download commons-jelly-20030902.160215.jar.
> Error retrieving artifact from
> [http://www.ibiblio.org/maven/commons-jelly/jars/commons-jelly
-20030902.160215.jar]:
> java.io.IOException: Unknown error downloading; status code was: 301
> WARNING: Failed to download commons-jelly-20030902.160215.jar.
> Attempting to download 
> commons-jelly-tags-velocity-20030303.205659.jar.
> Error retrieving artifact from
> [http://www.ibiblio.org/maven/commons-jelly/jars/commons-jelly
> -tags-velocity-20030303.205659.jar]:
> java.io.IOException: Unknown error downloading; status code was: 301
> WARNING: Failed to download 
> commons-jelly-tags-velocity-20030303.205659.jar.
> Attempting to download velocity-1.4-dev.jar.
> Error retrieving artifact from
> [http://www.ibiblio.org/maven/velocity/jars/velocity-1.4-dev.jar]:
> java.io.IOException: Unknown error downloading; status code was: 301
> WARNING: Failed to download velocity-1.4-dev.jar.
> Total time: 15 seconds
> Finished at: Tue Dec 05 17:43:07 CET 2006
> <<<
> 
> -- 
> Aljosa Mohorovic
> 
> http://www.revolucija.hr
> Ivana Lucica 5
> 1 Zagreb, Croatia
> 
> +385 (0)1 616 8414
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they a

RE: torque project compile with ant

2006-12-05 Thread Greg Monroe
Hmm, since the error is in the Torque test project, I'll 
assume that your trying to build the Torque project from 
the source distro using ant.  It this is not the case, 
see the end of this note.

The best way to build Torque is to use Maven (V1.0).
Since this is what the developers use all the time, it's
guaranteed to work.  It's relatively painless to install
and learn to run.  See:

http://maven.apache.org/maven-1.x/

For info on downloading, setting it up.  And look thru
the Torque developer info on using it.

The ant build files delivered in the source distro are 
autogenerated by Maven and will probably work for 
creating generator, templates, and runtime jars.  But
these will probably have to be manually "installed" into
the correct lib directories for the new code to be used.

I don't think the ant scripts will work with the test 
project (which is what your error is pointing to).  The
test process does some text substitutions and uses some
Maven specific property chaining to work.

 Just trying to compile your own project with ant---

If you are just trying to learn who to use Torque with
Ant for your own project, you probably want to look 
at the tutorial sections about configuring your 
build.properties (Ant's version of Maven's 
project.properties file... so think build.properties
when the tutorial says project.properties)

You will need to create a valid -schema.xml for your
ant project.  This is the same for Maven or Ant.
(FYI - the schema from the test-project gets some 
values substituted in by the test driver and can't be
used directly).  

A quick Maven task to Ant task reference to use in 
going thru the tutorial would be:

maven torque -> ant -f build-torque.xml (default goal is om)
maven torque:create-db -> ant -f build-torque.xml create-db
maven torque:id-table-init-sql -> ant -f build-torque.xml
id-table-init-sql

Also, all the Maven project.xml info in the tutorial 
is really about getting the required jar files (like 
your JDBC driver) into the class path.  For the Ant
generator portion, just add your JDBC driver jar to 
the generator lib directory.

For the Torque Runtime, this will depend on your 
application's Ant script (or system Classpath 
setup). The runtime distro has all the required jars 
in it's lib directory (except for jdbc driver(s)). To 
compile and run the generated code, you will need 
all of these in your class path (plus the 
torque- jar) from the distro root directory.

You can also check out the wiki for some other Ant
information.  Like:

http://wiki.apache.org/db-torque/GettingTorqueToWork


> -Original Message-
> From: Aljosa Mohorovic [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, December 05, 2006 10:31 AM
> To: torque-user@db.apache.org
> Subject: torque project compile with ant
> 
> i get this error when i try "ant -f build-torque.xml 
> compile", any idea why?
> i searched wiki and google but didn't find anything.
> 
> >>>
> Buildfile: build-torque.xml
> 
> compile:
> [javac] Compiling 24 source files to C:\Documents and
> Settings\Administrator\Desktop\torque-gen-3.3-RC1\test\bin\classes
> [javac] C:\Documents and
> Settings\Administrator\Desktop\torque-gen-3.3-RC1\test\target\
[EMAIL PROTECTED]@MapInit.java:12:
>  expected
> [javac] public class @[EMAIL PROTECTED]
> [javac]  ^
> [javac] C:\Documents and
> Settings\Administrator\Desktop\torque-gen-3.3-RC1\test\target\
[EMAIL PROTECTED]@MapInit.java:16:
> '{' expected
> [javac] ^
> [javac] C:\Documents and
> Settings\Administrator\Desktop\torque-gen-3.3-RC1\test\target\
[EMAIL PROTECTED]@MapInit.java:13:
>  expected
> [javac] public class @[EMAIL PROTECTED]
> [javac]  ^
> [javac] C:\Documents and
> Settings\Administrator\Desktop\torque-gen-3.3-RC1\test\target\
[EMAIL PROTECTED]@MapInit.java:21:
> '{' expected
> [javac] ^
> [javac] 4 errors
> <<<
> 
> -- 
> Aljosa Mohorovic
> 
> http://www.revolucija.hr
> Ivana Lucica 5
> 1 Zagreb, Croatia
> 
> +385 (0)1 616 8414
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [E

RE: Does torque support Mysql 5.0 and view

2006-12-01 Thread Greg Monroe
I think you should be able to write to a view.  The nosql
option does not prevent the save, delete, update methods of 
the "view" objects from being created.  Torque just thinks
it's a normal table (which is what views are supposed to be).  

The only issues with writing to a view I can think of are:

Problems if the DB prevents some fields from be writable, 
e.g. one of the fields is the result of a function.  

Also, there are some issues in saving or updating tables 
without a primary keys.  Note that you can define a primary
key in the XML even if the DB does not enforce it.  So, if 
your view has a column that can be used as a primary key, 
you can get around them that way.

Greg

> -Original Message-
> From: Carl Manaster [mailto:[EMAIL PROTECTED] 
> Sent: Friday, December 01, 2006 2:02 PM
> To: torque-user@db.apache.org
> Subject: RE: Does torque support Mysql 5.0 and view
> 
> 
> Hi, Thomas,
> 
> Do I understand correctly that Torque supports only reading 
> from (and not writing to) views?
> 
> Thanks,
> --Carl
> 
> 
> Thomas Fischer wrote:
> > 
> > 
> > no problems were reported regarding Mysql 5, so this should work. 
> > Torque supports reading from views (just declare them like 
> you would 
> > declare a table but omit sql generation for it), but you have to 
> > create them manually. Torque does not use triggers at all, 
> but you can 
> > insert them manually without any problems.
> > 
> >Thomas
> > 
> > David Zhao <[EMAIL PROTECTED]> schrieb am 12.12.2005 21:19:06:
> > 
> >> Hi there,
> >>
> >> Does current version of torque support MySQL 5.0 and view, trigger 
> >> and
> > such?
> >> Thanks,
> >>
> >> David
> > 
> > 
> 
> --
> View this message in context: 
> http://www.nabble.com/Does-torque-support-Mysql-5.0-and-view-t
f730011.html#a7644209
> Sent from the Apache DB - Torque Users mailing list archive 
> at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are 
confidential communication or may otherwise be privileged or confidential and 
are intended solely for the individual or entity to whom they are addressed.  
If you are not the intended recipient you may not rely on the contents of this 
email or any attachments, and we ask that you  please not read, copy or 
retransmit this communication, but reply to the sender and destroy the email, 
its contents, and all copies thereof immediately.  Any unauthorized 
dissemination, distribution or copying of this communication is strictly 
prohibited.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



  1   2   3   >