Re: hsqldb and NullPointerException

2005-06-17 Thread Thomas Fischer




Ok, so far we have
- Torque is initialized when PatientBasePeer is loaded
- No exception is thrown when BasePeer.getMapBuilder(String) is called
(this does not mean anything, see below)

Fisr path of action is looking into the Map builder. It is located in the
map subpackage of the package where you generate the OM classes in and is
called
PatientMapBuilder.

It should have a doBuild() method, which should get called by the line

getMapBuilder(PatientMapBuilder.CLASS_NAME);

in the static initializer of PatientPeer.

The dobuild() method should look similar to this:
public void doBuild() throws TorqueException
{
dbMap = Torque.getDatabaseMap("nameOfYourDefaultDb");

dbMap.addTable("benutzer");
TableMap tMap = dbMap.getTable("benutzer");

tMap.setPrimaryKeyMethod("none");


  tMap.addPrimaryKey("benutzer.NSUNIQUEID", new String());
tMap.addColumn("benutzer.NAME", new String());
tMap.addColumn("benutzer.VORNAME", new String());
}

Can you please put a debug message into this method to see if it is called
?
If yes, can you replace the line

dbMap = Torque.getDatabaseMap("nameOfYourDefaultDb");

by

Torque.getDatabaseMap(Torque.getDefaultDb());

and see if it changes anything ?

If this does not change anything, can you print the contents of the
database map at the end of the method ? Then, the table should be there.
Perhaps it disappears again somewhere in between


Second path of action(if doBuild() in the Map builders is NOT getting
called): I have noticed that in BasePeer.getMapBuilder(String), all
exceptions are caught and NOT rethrown; only a log message is written. Do
you have a Torque logfile ? If yes, does it contain an error message like

BasePeer.MapBuilder failed trying to instantiate.

If you have no log file, can you put a system.out.println in the catch
block in BasePeer.getMapBuilder(String) and see if it runs into this.

Thomas


Vlada Djurovic <[EMAIL PROTECTED]> schrieb am 17.06.2005 15:24:46:

> This is what I got:
>
> In static initializer
> Torque initialized
> Map builder initialized
> BasePeer: tableName=patient
> BasePeer: dbName=cardiobip
> DBMap tables: [EMAIL PROTECTED]
> tableMap==null
> Exception occurred during event dispatching:
>
> Everything seems OK untill I call the tableMap. Looks like no
> tableMaps are added to dbMap, except for ID_TABLE.
> I use only one database, and that's the default.
> >
> >
> >
> > Hi,
> >
> > One quick shot: Do you use more than one database ? Database Maps are
per
> > database, and if the peer does not belong to the default db and you are
> > querying the default db, this problem appears.
> > You can check this by printing
> >
> > Torque.getDatabaseMap(PatientPeer.DATABASE_NAME).
> getTable(PatientPeer.TABLE_NAME)
> >
> > if this is not null, then the table is stored elswhere but not in the
> > default db.
> >
> >
> > But probably this is not the case. So we have to go deeper into it.
> > BasePatientPeer should have a static initializer similar to that:
> >
> > static
> > {
> >   NSUNIQUEID = "benutzer.NSUNIQUEID";
> >   NAME = "benutzer.NAME";
> >   VORNAME = "benutzer.VORNAME";
> >   if (Torque.isInit())
> > {
> > try
> > {
> > getMapBuilder(BenutzerMapBuilder.CLASS_NAME);
> > }
> > catch (Exception e)
> > {
> > log.error("Could not initialize Peer", e);
> > }
> > }
> > else
> > {
> > Torque.registerMapBuilder(BenutzerMapBuilder.CLASS_NAME);
> > }
> > }
> >
> > Please put in the following debug messages to isolate the problem
further:
> >
> > static
> > {
> > NSUNIQUEID = "benutzer.NSUNIQUEID";
> > NAME = "benutzer.NAME";
> > VORNAME = "benutzer.VORNAME";
> > if (Torque.isInit())
> > {
> > System.out.println("Torque is initialized");
> > try
> > {
> > getMapBuilder(BenutzerMapBuilder.CLASS_NAME);
> > System.out.println("Map builder initialized");
> > }
> > catch (Exception e)
> > {
> > log.error("Could not initialize Peer", e);
> > System.out.println("Could not initialize Peer" +
e.getMessage);
> > }
> > }
> > else
> > {
> > System.out.println("Torque is NOT initialized");
> > Torque.registerMapBuilder(BenutzerMapBuilder.CLASS_NAME);
> > }
> > }
> >
> > and send the output
> >
> > Thomas
> >
> > > OK, here's what I have so far:
> > > -I recompiled torque-3.1.1, and added this to
> > > BasePeer.doInsert(Criteria,Connection):
> > >
> > > DatabaseMap dbMap = Torque.getDatabaseMap(criteria.getDbName());
> > > System.out.println("BasePeer: dbName="+criteria.getDbName());
> > > dbMap.printTables(); //added this in DatabaseMap to print
tables
> > > TableMap tabl

RE: query with "exists" clause

2005-06-17 Thread Thomas Fischer




Hi,

subselects are not supported out of the box in Torque. there are various
threads in the user mailing list of how they can be implemented, the last
one should be only a few weeks ago. Please search the archives. The
solution involves Criteria.CUSTOM, but I cannot remember exactly how it
works.

  Thomas

Αντώνης Λεμπέσης <[EMAIL PROTECTED]> schrieb am 17.06.2005 16:25:53:

> Hello,
>
> I have these two tables:
> doc(id, title) and
> rel(source, target) (both 'source' and 'target' are foreign keys to
> doc.id)
>
> I want to form the following query, using Criteria:
>
> SELECT d1.title
> FROM doc d1
> WHERE EXISTS (
> SELECT *
> FROM doc d2, rel r
> WHERE r.source = d1.id AND r.target = d2.id AND d2.title = 'foo')
>
> Any ideas on how to do this???
>
> Thanks,
> Antonis
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

Re: hsqldb and NullPointerException

2005-06-17 Thread Thomas Fischer




Hi Vlada,

The more I think about it, the following scenario seems probable to me:

You wrote that you have put the torque.jar in the jre library path. So
maybe (I have no largeknowledge of class loaders) BasePeer tries to
instantiate the Map builder classes in the System class loader. In this
class loader, it cannot find the Map Builder classes.
This would result in the following:
- the static initializers of a Peer is called
- it calls BasePeer.getMapBuilder(String)
- This method cannot instantiate the Map Builder, but does not throw an
Exception (BUG, I have already added it to scarab)
- you end up with a message in your error log, but no other sign of the
error except no db maps present

Try to remove torque.jar from the jre path and (if you have a web
application) put it in WEB-INF/lib instead or (if you have a standalone
application) add it to the -classpath argument of your program start.

Please tell us if that worked.

  Thomas

Vlada Djurovic <[EMAIL PROTECTED]> schrieb am 17.06.2005 15:24:46:

> This is what I got:
>
> In static initializer
> Torque initialized
> Map builder initialized
> BasePeer: tableName=patient
> BasePeer: dbName=cardiobip
> DBMap tables: [EMAIL PROTECTED]
> tableMap==null
> Exception occurred during event dispatching:
>
> Everything seems OK untill I call the tableMap. Looks like no
> tableMaps are added to dbMap, except for ID_TABLE.
> I use only one database, and that's the default.
> >
> >
> >
> > Hi,
> >
> > One quick shot: Do you use more than one database ? Database Maps are
per
> > database, and if the peer does not belong to the default db and you are
> > querying the default db, this problem appears.
> > You can check this by printing
> >
> > Torque.getDatabaseMap(PatientPeer.DATABASE_NAME).
> getTable(PatientPeer.TABLE_NAME)
> >
> > if this is not null, then the table is stored elswhere but not in the
> > default db.
> >
> >
> > But probably this is not the case. So we have to go deeper into it.
> > BasePatientPeer should have a static initializer similar to that:
> >
> > static
> > {
> >   NSUNIQUEID = "benutzer.NSUNIQUEID";
> >   NAME = "benutzer.NAME";
> >   VORNAME = "benutzer.VORNAME";
> >   if (Torque.isInit())
> > {
> > try
> > {
> > getMapBuilder(BenutzerMapBuilder.CLASS_NAME);
> > }
> > catch (Exception e)
> > {
> > log.error("Could not initialize Peer", e);
> > }
> > }
> > else
> > {
> > Torque.registerMapBuilder(BenutzerMapBuilder.CLASS_NAME);
> > }
> > }
> >
> > Please put in the following debug messages to isolate the problem
further:
> >
> > static
> > {
> > NSUNIQUEID = "benutzer.NSUNIQUEID";
> > NAME = "benutzer.NAME";
> > VORNAME = "benutzer.VORNAME";
> > if (Torque.isInit())
> > {
> > System.out.println("Torque is initialized");
> > try
> > {
> > getMapBuilder(BenutzerMapBuilder.CLASS_NAME);
> > System.out.println("Map builder initialized");
> > }
> > catch (Exception e)
> > {
> > log.error("Could not initialize Peer", e);
> > System.out.println("Could not initialize Peer" +
e.getMessage);
> > }
> > }
> > else
> > {
> > System.out.println("Torque is NOT initialized");
> > Torque.registerMapBuilder(BenutzerMapBuilder.CLASS_NAME);
> > }
> > }
> >
> > and send the output
> >
> > Thomas
> >
> > > OK, here's what I have so far:
> > > -I recompiled torque-3.1.1, and added this to
> > > BasePeer.doInsert(Criteria,Connection):
> > >
> > > DatabaseMap dbMap = Torque.getDatabaseMap(criteria.getDbName());
> > > System.out.println("BasePeer: dbName="+criteria.getDbName());
> > > dbMap.printTables(); //added this in DatabaseMap to print
tables
> > > TableMap tableMap = dbMap.getTable(tableName);
> > > if(tableMap==null)
> > > System.out.println("tableMap==null");
> > >
> > > And after running the code, this is the output:
> > >
> > > In statis initializer
> > > Peer initialized
> > > BasePeer: tableName=patient
> > > BasePeer: dbName=cardiobip
> > > DBMap tables: [EMAIL PROTECTED]
> > > tableMap==null
> > > Exception occurred during event dispatching:
> > > java.lang.NullPointerException
> > > at
org.apache.torque.util.BasePeer.doInsert(BasePeer.java:666)
> > > at
org.apache.torque.util.BasePeer.doInsert(BasePeer.java:603)
> > > at com.euroicc.cardiobip.om.BasePatientPeer.
> > > doInsert(BasePatientPeer.ja
> > > a:228)
> > > at com.euroicc.cardiobip.om.BasePatientPeer.
> > > doInsert(BasePatientPeer.ja
> > > a:201)
> > > at com.euroicc.cardiobip.gui.NewPatientDialog.
> > > OKButtonActionPerformed(N
> > >
> > > So, I guess DBMap contains only one table, ID_TABLE and table
> > > 'patient' can not be found.
> > >
> > 

Re: hsqldb and NullPointerException

2005-06-17 Thread Thomas Fischer




Hi,

One quick shot: Do you use more than one database ? Database Maps are per
database, and if the peer does not belong to the default db and you are
querying the default db, this problem appears.
You can check this by printing

Torque.getDatabaseMap(PatientPeer.DATABASE_NAME).getTable(PatientPeer.TABLE_NAME)

if this is not null, then the table is stored elswhere but not in the
default db.


But probably this is not the case. So we have to go deeper into it.
BasePatientPeer should have a static initializer similar to that:

static
{
  NSUNIQUEID = "benutzer.NSUNIQUEID";
  NAME = "benutzer.NAME";
  VORNAME = "benutzer.VORNAME";
  if (Torque.isInit())
{
try
{
getMapBuilder(BenutzerMapBuilder.CLASS_NAME);
}
catch (Exception e)
{
log.error("Could not initialize Peer", e);
}
}
else
{
Torque.registerMapBuilder(BenutzerMapBuilder.CLASS_NAME);
}
}

Please put in the following debug messages to isolate the problem further:

static
{
NSUNIQUEID = "benutzer.NSUNIQUEID";
NAME = "benutzer.NAME";
VORNAME = "benutzer.VORNAME";
if (Torque.isInit())
{
System.out.println("Torque is initialized");
try
{
getMapBuilder(BenutzerMapBuilder.CLASS_NAME);
System.out.println("Map builder initialized");
}
catch (Exception e)
{
log.error("Could not initialize Peer", e);
System.out.println("Could not initialize Peer" + e.getMessage);
}
}
else
{
System.out.println("Torque is NOT initialized");
Torque.registerMapBuilder(BenutzerMapBuilder.CLASS_NAME);
}
}

and send the output

Thomas

> OK, here's what I have so far:
> -I recompiled torque-3.1.1, and added this to
> BasePeer.doInsert(Criteria,Connection):
>
> DatabaseMap dbMap = Torque.getDatabaseMap(criteria.getDbName());
> System.out.println("BasePeer: dbName="+criteria.getDbName());
> dbMap.printTables(); //added this in DatabaseMap to print tables
> TableMap tableMap = dbMap.getTable(tableName);
> if(tableMap==null)
> System.out.println("tableMap==null");
>
> And after running the code, this is the output:
>
> In statis initializer
> Peer initialized
> BasePeer: tableName=patient
> BasePeer: dbName=cardiobip
> DBMap tables: [EMAIL PROTECTED]
> tableMap==null
> Exception occurred during event dispatching:
> java.lang.NullPointerException
> at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:666)
> at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:603)
> at com.euroicc.cardiobip.om.BasePatientPeer.
> doInsert(BasePatientPeer.ja
> a:228)
> at com.euroicc.cardiobip.om.BasePatientPeer.
> doInsert(BasePatientPeer.ja
> a:201)
> at com.euroicc.cardiobip.gui.NewPatientDialog.
> OKButtonActionPerformed(N
>
> So, I guess DBMap contains only one table, ID_TABLE and table
> 'patient' can not be found.
>
> But I have no clue what could be causing this. I suppose you are right
> about it being a configuration issue, but what?
>
> @Raphael:
> I tried using object instead of criteria, but it's the same
>
> -
> 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: hsqldb and NullPointerException

2005-06-17 Thread Thomas Fischer





Hi Vlada,

look at
http://issues.apache.org/scarab/issues/id/TRQS228
to read about the problem in detail.

In a nutshell, for each table in a query, the corresponding Peer class has
to be loaded before the table can be used in a query. Loading the class
executes its static initializer and registers the Map Builder for the
table.
Since Torque 3.1.1, this is done if a coulumn name constant (like
PatientPeer.FIRSTNAME) in the Peer is accessed.
In earlier versions of Torque, this is done e.g. if you access a method of
the Peer (like PatientPeer.doInsert()).
So in your case, because you are accessing a method of the Peer for the
query, this should be ok for any versions of Torque.

I would guess that you have some unusual setup which breaks this mechanism.
(e.g., some weeks ago, someone had the same problem because he was using
Joins and RMI). To shed light on this, can you put a debug message in the
static initializer of BasePatientPeer to see when it is called ?

Please keep us informed about your findings

 Thomas


Vlada Djurovic <[EMAIL PROTECTED]> schrieb am 17.06.2005 11:25:42:

> > Hi,
> >
> > can you append a stack trace and (if it is not inside Torque) the
relevant
> > part of code ?
> > It sounds a bit like a configuration issue. The classpath is
improbable, I
> > have never seen a NullPointerException thrown because of a classpath
issue
> >
> > Thomas
> >
> Here's a part of stack trace:
> --
> Exception occurred during event dispatching:
> java.lang.NullPointerException
> at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:661)
> at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:603)
> at com.euroicc.cardiobip.om.BasePatientPeer.
> doInsert(BasePatientPeer.jav
> a:223)
> at com.euroicc.cardiobip.om.BasePatientPeer.
> doInsert(BasePatientPeer.jav
> a:196)
> at com.euroicc.cardiobip.gui.NewPatientDialog.
> OKButtonActionPerformed(Ne
> wPatientDialog.java:413)
>
---

> And the code:
>
> 
>  Criteria crit=new Criteria();
> crit.setDbName(Torque.getDefaultDB());
> System.out.println("Database="+crit.getDbName());//for
debugging
> crit.add(PatientPeer.FIRSTNAME,firstNameField.getText());
> crit.add(PatientPeer.LASTNAME,lastNameField.getText());
> crit.add(PatientPeer.HEIGHT,(new
> Integer(heightField.getText())).intValue());
> crit.add(PatientPeer.WEIGHT,(new
> Integer(weightField.getText())).intValue());
> crit.add(PatientPeer.CHEST,(new
> Integer(chestField.getText())).intValue());
> crit.add(PatientPeer.BIRTHDATE,dateOfBirth);
>
> ObjectKey ok=PatientPeer.doInsert(crit); ///HERE IS THE
EXCEPTION
> ++
>
> I did some lookin in Torque BasePeer class source, and it seems that
> it can't find appropriate table:
>
> DatabaseMap dbMap = Torque.getDatabaseMap(criteria.getDbName());
> TableMap tableMap = dbMap.getTable(tableName);  //THIS SEEMS
> TO RETURN null
> Object keyInfo = tableMap.getPrimaryKeyMethodInfo();//EXCEPTION
NPE
>
> I hope you can shed some light on this. Thanks
>
>
> >
> > Vlada Djurovic <[EMAIL PROTECTED]> schrieb am 17.06.2005 09:11:09:
> >
> > > > Hi,
> > > >
> > > > The usual way to cope with a null pointer exception is
> > > > 1) compile the sources with the debug option
> > > > 2) look at the stack trace to find out exactly where the exception
> > occurs
> > > > 3) look at the indicated line in the source code to see which
object is
> > > > null
> > > > 4) check (in the source code or elsewhere) why the object is null
> > > >
> > > > Did you already do that ?
> > > >
> > > > Thomas
> > >
> > > Yes, I did that, and everything else I could think of, but couldn't
> > > find anything wrong. As I said, it works perfectly inside the IDE,
but
> > > not outside.
> > > When I run the app standalone, I can connect to database, do simple
> > > querries, but if I try to do INSERT, UPDATE,DELETE or join, I get the
> > > NPE.
> > > First I thought it's a classpath issue, but I guess, if I can connect
> > > to database and do some things, than the classpath and configuration
> > > are OK, right? I use the same libs in the IDE and outside it, so it
> > > should be OK too.
> > > This is really frustrating:-(
> > >
> > > Thanks for a tip anyway.
> > >
> > > -
> > > 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: hsqldb and NullPointerException

2005-06-17 Thread Thomas Fischer




Hi,

can you append a stack trace and (if it is not inside Torque) the relevant
part of code ?
It sounds a bit like a configuration issue. The classpath is improbable, I
have never seen a NullPointerException thrown because of a classpath issue

Thomas


Vlada Djurovic <[EMAIL PROTECTED]> schrieb am 17.06.2005 09:11:09:

> > Hi,
> >
> > The usual way to cope with a null pointer exception is
> > 1) compile the sources with the debug option
> > 2) look at the stack trace to find out exactly where the exception
occurs
> > 3) look at the indicated line in the source code to see which object is
> > null
> > 4) check (in the source code or elsewhere) why the object is null
> >
> > Did you already do that ?
> >
> > Thomas
>
> Yes, I did that, and everything else I could think of, but couldn't
> find anything wrong. As I said, it works perfectly inside the IDE, but
> not outside.
> When I run the app standalone, I can connect to database, do simple
> querries, but if I try to do INSERT, UPDATE,DELETE or join, I get the
> NPE.
> First I thought it's a classpath issue, but I guess, if I can connect
> to database and do some things, than the classpath and configuration
> are OK, right? I use the same libs in the IDE and outside it, so it
> should be OK too.
> This is really frustrating:-(
>
> Thanks for a tip anyway.
>
> -
> 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: How to define Blob Field/Postgresql

2005-06-16 Thread Thomas Fischer




Well, if I look at the error message, it says

"cannot drop the currently open database"

which seems to be the reason for the error.

If you run the sql script from a console, it should work.
I have no idea how to fix it to run within maven

Thomas

"Ferruh Zamangoer" <[EMAIL PROTECTED]> schrieb am 15.06.2005
09:52:50:

> Thanks Thomas I used binary and it works. Another problem is when I use
> maven torque:create-db
>
> D:\Develop\eclipse\workspace\CONFUOCO>maven torque:create-db
>  __  __
> |  \/  |__ _Apache__ ___
> | |\/| / _` \ V / -_) ' \  ~ intelligent projects ~
> |_|  |_\__,_|\_/\___|_||_|  v. 1.0.2
>
> build:start:
>
> torque:init:
>
> torque:create-db:
> [torque-data-model] Using classpath
> [torque-data-model] Generating to file F:\Output\sql\create-db.sql
> [echo]
>   Executing the create-db.sql script ...
>
> [sql] Executing file: F:\Output\sql\create-db.sql
> [sql] [ERROR] Failed to execute: drop database confuoco
> [sql] [ERROR] org.postgresql.util.PSQLException: ERROR: cannot drop
the
> currently open database
>
> [sql] [ERROR] Failed to execute: create database confuoco
> [sql] [ERROR] org.postgresql.util.PSQLException: ERROR: database
> "confuoco" already exists
>
> [sql] 0 of 2 SQL statements executed successfully
> BUILD SUCCESSFUL
> Total time: 19 seconds
> Finished at: Wed Jun 15 09:49:43 CEST 2005
>
>
> Have you any idea, why this not works?
>
> Regards
> Ferruh
>
>
>
>
>
>
> -Ursprüngliche Nachricht-
> Von: Thomas Fischer [mailto:[EMAIL PROTECTED]
> Gesendet: Mittwoch, 15. Juni 2005 08:28
> An: Apache Torque Users List
> Betreff: RE: How to define Blob Field/Postgresql
>
>
>
>
>
>
> Hi,
>
> Two possible solutions:
> 1) use BINARY instead of BLOB for postgresql.
> 2) locate the file templates/sql/base/postgresql/db.props in the
generator
> and replace the line
> BLOB =
> by
> BLOB = BLOB
>
>  Thomas
>
> "Ferruh Zamangoer" <[EMAIL PROTECTED]> schrieb am 14.06.2005
> 16:03:08:
>
> > Hi,
> >
> >
> >
> > I have now installed my postgresql database and it works.  I had
noticed
> > that in the generation of the sql script was an error. I have defined
in
> > schema.xml some fields, which are from type BLOB.
> >
> >
> >
> >  >
> >   javaNamingMethod="underscore">
> >
> >  >
> >   name="ENTRY_ID"
> >
> >   required="true"
> >
> >   primaryKey="true"
> >
> >   type="INTEGER"
> >
> >   description="ENTRY_ID"/>
> >
> >  >
> >   name="CONTENT_ID"
> >
> >   required="true"
> >
> >   type="BLOB"
> >
> >   description="CONTENT_ID"/>
> >
> > ……….
> >
> > 
> >
> >
> >
> > In the sql script I saw that no type is set for the CONTENT_ID Field
> >
> >
> >
> > CREATE TABLE WHITE_LIST
> >
> > (
> >
> > ENTRY_ID integer DEFAULT
> > nextval('WHITE_LIST_SEQ') NOT NULL,
> >
> > CONTENT_ID NOT NULL,
> >
> > HASH_VALUE integer NOT NULL,
> >
> > CONTENT_ID_TYPE varchar (256) NOT
> NULL,
> >
> >   -- REFERENCES CONTENT
> > (CONTENT_REGISTRATION_ID)
> >
> > CONTENT_REGISTRATION_ID integer NOT NULL,
> >
> > DATE date NOT NULL,
> >
> > DESCRIPTION varchar (256),
> >
> > PRIMARY KEY (ENTRY_ID)
> >
> > );
> >
> >
> >
> > Which type I have to set in schema that the sql script sets the right
> data
> > type?´
> >
> >
> >
> > I had edit manually the script and set bytea which is blob field in
> > postgresql.
> >
> >
> >
> > Can anybody help?
> >
> >
> >
> > Regards
> >
> > Ferruh
> >
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

RE: hsqldb and NullPointerException

2005-06-16 Thread Thomas Fischer




Hi,

The usual way to cope with a null pointer exception is
1) compile the sources with the debug option
2) look at the stack trace to find out exactly where the exception occurs
3) look at the indicated line in the source code to see which object is
null
4) check (in the source code or elsewhere) why the object is null

Did you already do that ?

Thomas

Vlada Djurovic <[EMAIL PROTECTED]> schrieb am 16.06.2005 16:03:52:

> Hi.
> I'm not sure if this is the right place for this question, but I ran
> out of optoions.
> This is my problem: I'm using NetBeans IDE with HSQLDB and Torque for
> development.  I managed to get everything working from inside the IDE,
> but if try to run the app on it own, I get that damn
> NullPointerException, and I can;t figure out what's causing them.
> First I thought it's a classpath issue, but I got all the jars in
> jre/lib/ext, Torque.properties file is in the right place and
> everything looks OK.
> Seems like this exception happens when I use doInsert() or Criteria
> with addJoin() or addAscendingOrederByColumn().
> I looked all the messages mentioning simmilar probelm, tried every
> answer, but no luck.
>
> If somebody could give me a hint what could be wrong, I would be most
> gratefull...
> Thanks in advance.
>
> -
> 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]



ER: Please help on OJB+Xdoclet+Torque

2005-06-16 Thread Thomas Fischer




Hi,

I am afraid to say this is the first time I have heard about the
capabilities of Torque you describe. It has neither been in the users
mailing list nor in the dev mailing list in the last six months, So my
guess would be very little users use them.
This would mean two things
- probably, these features will not be very well tested
- it is unlikely that you will get help on the users list

So I regret to say that it will be mostly up to you to cope with the
problems you encounter :-(
However, if you are able to remove any bugs, please open up a scarab issue
on them so that they can be considered in future Torque releases.
Also, it is not very unusual for Torque users to modify the velocity
templates to get what you want.

 Hope this has clarified the situation a bit,

   Thomas

dyp <[EMAIL PROTECTED]> schrieb am 15.06.2005 20:38:31:

> Hello, all.
> We are developing web-application for cocoon with ojb and trying to
> generate all ojb and sql stuff from the source java files.
> We use ojb 1.0.1, xdoclet-ojb-module-1.2.2, torque-gen-3.1.1 and mysql.
>
> == PROBLEM ==
> The plot:
> We have java classes with xdoclet tags. From those we generate
> repository_user.xml (for ojb) and db-schema.xml (for torque) via ant
> tasks for xdoclet-ojb-module.
> Then torque-generator generates *.sql for database and repository*.xml
> files for OJB from db-schema.xml.
>
> Java classes:
> User.java:
>
> /**
>
>  * @ojb.class table="user"
>
>  *include-inherited="true"
>
>  * @ojb.field name="countryId"
>
>  *column="countryId"
>
>  *jdbc-type="BIGINT"
>
>  */
>
> public class User {
>
>   /**
>
>* @ojb.field column="uid"
>
>*jdbc-type="BIGINT"
>
>*autoincrement="database"
>
>*primarykey="true"
>
>*nullable="false"
>
>*default-fetch="true"
>
>*/
>
>   private Long uid;
>
>   /**
>
>* @ojb.field column="email"
>
>*jdbc-type="VARCHAR"
>
>*length="255"
>
>*default-fetch="true"
>
>*/
>
>   private String email;
>
>   /**
>
>* @ojb.reference auto-retrieve="true"
>
>*foreignkey="countryId"
>
>*database-foreignkey="true"
>
>*/
>
>   private Country country = new Country();
>
> }
>
>
> Country.java:
>
> /**
>
>  * @ojb.class table="country"
>
>  */
>
> public class Country {
>
>   /**
>
>* @ojb.field column="id"
>
>*jdbc-type="BIGINT"
>
>*autoincrement="database"
>
>*primarykey="true"
>
>*nullable="false"
>
>*default-fetch="true"
>
>*/
>
>   private Long id;
>
>
>   /**
>
>* @ojb.field column="name"
>
>*jdbc-type="VARCHAR"
>
>*length="255"
>
>*default-fetch="true"
>
>*/
>
>   private String name;
>
>
>
> From these source files XDoclet generates:
> 1. absolutely correct repository_user.xml. (with reference-descriptor
> and foreign-key ref)
> 2. project-schema.xml for Torque is unusable because of the 
> descriptor: the attribute defaultIdMethod="..." not generated, although
> attributes for fields marked with @ojb.field autoincrement="database"
> are generated correctly: autoIncrement="true".
>
> Question: why attribute defaultIdMethod not generated? Without it the
> generated schema is useless for Torque. It needs this attribute in
> schema to generate AUTO_INCREMENT for fields marked as  autoIncrement="true" /> in schema.
> Through the xdoclet-module source i've learnt that XDoclet (.xdt files)
> wasn't designed to generate this attribute. Sob.
> How can any get the working schema file from xdoclet for torque?
>
> Further..
> After xdoclet ojbdoclet and torqueschema ant tasks we have:
> project-schema.xml
> repository_user.xml
>
> We run the torque-gen build ant targets for producing *.sql files and
> repository*.xml files.
> 1. *.sql files are useless because of missing attribute
> defaultIdMethod="..." in  in project-schema.xml.
> 2. repository files for ojb are incorrect because of:
> repository.xml:
> - torque generates jdbc-connection-descriptor with our properties and
> with nested  element. How can we specify this
> sequence-manager for torque? The default generated
> (SequenceManagerHighLowImpl) is unneeded. We want
> SequenceManagerNativeImpl with our custom attributes. How could we
> specify it for Torque? And the generated jdbc-connection-descriptor is
> default, but we don't want it to be default. I've found that this is
> coded in MainRepository.vm in torque, but cannot find how to provide a
> custom secuence-manager. Via build.properties? via changing this
template?
> repository_project.xml:
> - torgue doesn't generates attribute access="anonymous" for anonymous
> fields and reference-descriptor for foreign-keys. Why?
> For now we just overwrite this repository_project.xml from torque with
> correct repository_project.xml form xdoclet-module.

RE: How to define Blob Field/Postgresql

2005-06-14 Thread Thomas Fischer





Hi,

Two possible solutions:
1) use BINARY instead of BLOB for postgresql.
2) locate the file templates/sql/base/postgresql/db.props in the generator
and replace the line
BLOB =
by
BLOB = BLOB

 Thomas

"Ferruh Zamangoer" <[EMAIL PROTECTED]> schrieb am 14.06.2005
16:03:08:

> Hi,
>
>
>
> I have now installed my postgresql database and it works.  I had noticed
> that in the generation of the sql script was an error. I have defined in
> schema.xml some fields, which are from type BLOB.
>
>
>
> 
>   javaNamingMethod="underscore">
>
> 
>   name="ENTRY_ID"
>
>   required="true"
>
>   primaryKey="true"
>
>   type="INTEGER"
>
>   description="ENTRY_ID"/>
>
> 
>   name="CONTENT_ID"
>
>   required="true"
>
>   type="BLOB"
>
>   description="CONTENT_ID"/>
>
> ……….
>
> 
>
>
>
> In the sql script I saw that no type is set for the CONTENT_ID Field
>
>
>
> CREATE TABLE WHITE_LIST
>
> (
>
> ENTRY_ID integer DEFAULT
> nextval('WHITE_LIST_SEQ') NOT NULL,
>
> CONTENT_ID NOT NULL,
>
> HASH_VALUE integer NOT NULL,
>
> CONTENT_ID_TYPE varchar (256) NOT
NULL,
>
>   -- REFERENCES CONTENT
> (CONTENT_REGISTRATION_ID)
>
> CONTENT_REGISTRATION_ID integer NOT NULL,
>
> DATE date NOT NULL,
>
> DESCRIPTION varchar (256),
>
> PRIMARY KEY (ENTRY_ID)
>
> );
>
>
>
> Which type I have to set in schema that the sql script sets the right
data
> type?´
>
>
>
> I had edit manually the script and set bytea which is blob field in
> postgresql.
>
>
>
> Can anybody help?
>
>
>
> Regards
>
> Ferruh
>

Re: maven torque:insert-sql produces errors with oracle

2005-06-14 Thread Thomas Fischer




Jon,

this seems stange to me. A lot of people, including me, are using Torque
3.1 with oracle without any problems (However, I am using ant with 3.1, but
this should not make any difference)
Did you modify something in your Torque installation ?
Can you provide a small snippet of your schema.xml which produces above
errors ?

  Thomas


Jon August <[EMAIL PROTECTED]> schrieb am 14.06.2005 21:04:39:

> Thomas,
>
> I put in the templates from 3.1, and now it's putting an extra comma
> on the end of the fields for each table.  It's unable to execute the
> CREATE statements.  I get these errors:
>
>  [torque-sql-exec] [ERROR] Failed to execute: CREATE TABLE
> gd_sales_unit_rcs ( busseg VARCHAR2 (6), sales_unit VARCHAR2 (6), )
>  [torque-sql-exec] [ERROR] java.sql.SQLException: ORA-00904: :
> invalid identifier
>
>
> I had this problem before with 3.1 and MySQL.  The solution was to
> use 3.1.1.  :-oWhat should I do?
>
>  -Jon
>
>
>
> On Jun 14, 2005, at 3:35 AM, Thomas Fischer wrote:
>
> >
> >
> >
> >
> > Hi,
> >
> > There was a problem with the oracle templates in the 3.1.1 release.
> > See
> > http://issues.apache.org/scarab/issues/id/TRQS222 for details.
> > The solution is to use the oracle templates from 3.1 or from CVS
> >
> >  Thomas
> >
> > "Dressler,Erik(externe MA)" <[EMAIL PROTECTED]>
> > schrieb am
> > 14.06.2005 07:59:52:
> >
> >
> >>
> >> hi!
> >>
> >> i had the same problem. are you using turbine, too? turbine allocates
> >> oracle-scripts in a special folder.
> >>
> >> i think torque is originally designed for open-source-databases
> >> (mysql).
> >> oracle has problems with the syntax of the generated scripts. you
> >>
> > manipulate
> >
> >> them manually and run them in a sql plus window, too!
> >>
> >> greetz, erik
> >>
> >>
> >>> -Original Message-
> >>> From:   Jon August [SMTP:[EMAIL PROTECTED]
> >>> Sent:   13 June 2005 23:03
> >>> To:   Apache Torque Users List
> >>> Subject:   maven torque:insert-sql produces errors with oracle
> >>>
> >>> when I do a:
> >>>
> >>> maven torque:insert-sql
> >>>
> >>> I get the following errors for each of my tables.
> >>>
> >>>  [torque-sql-exec] [ERROR] Failed to execute: EXCEPTION WHEN
> >>> TABLE_DOES_NOT_EXIST THEN NULL
> >>>  [torque-sql-exec] [ERROR] java.sql.SQLException: ORA-00900:
> >>> invalid SQL statement
> >>>
> >>>  [torque-sql-exec] [ERROR] Failed to execute: END
> >>>  [torque-sql-exec] [ERROR] java.sql.SQLException: ORA-00900:
> >>> invalid SQL statement
> >>>
> >>>  [torque-sql-exec] [ERROR] Failed to execute: / CREATE TABLE
> >>> gd_position_rcs ( position VARCHAR2 (5) ) / DECLARE
> >>> TABLE_DOES_NOT_EXIST EXCEPTION
> >>>  [torque-sql-exec] [ERROR] java.sql.SQLException: ORA-00900:
> >>> invalid SQL statement
> >>>
> >>>  [torque-sql-exec] [ERROR] Failed to execute: PRAGMA
> >>> EXCEPTION_INIT(TABLE_DOES_NOT_EXIST, -942)
> >>>  [torque-sql-exec] [ERROR] java.sql.SQLException: ORA-00900:
> >>> invalid SQL statement
> >>>
> >>>  [torque-sql-exec] [ERROR] Failed to execute: BEGIN EXECUTE
> >>> IMMEDIATE 'DROP TABLE gd_sales_unit_rcs CASCADE CONSTRAINTS'
> >>>  [torque-sql-exec] [ERROR] java.sql.SQLException: ORA-06550:
> >>> line
> >>> 1, column 74:
> >>> PLS-00103: Encountered the symbol "end-of-file" when expecting
> >>> one of
> >>> the following:
> >>>
> >>> I see this problem has been discussed before on the mailing list,
> >>> and
> >>> the solution was to replace "template" files with older versions.
> >>> Unfortunately, I don't seem to have any template files in my
> >>> configuration (I can't locate any).  My configuration works just
> >>> fine
> >>> with MySQL.
> >>>
> >>> Thanks for any help.
> >>>
> >>>  -Jon
> >>>
> >>>
> >>> 
> >>> -
> >>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>> For additional comm

RE: Problems by creating the Database and Tables with maven

2005-06-14 Thread Thomas Fischer




Hi,

I remember a solution to this was posted some time ago (I wuold guess
abbout half a year ago) in the users list. Please search the archives.

   Thomas

"Ferruh Zamangoer" <[EMAIL PROTECTED]> schrieb am 14.06.2005
10:53:25:

> Hi,
>
>
>
> I'am trying to create my database with maven how it's described in the
> tutorial. I know that it's classpath problem? But where I have to put the
> postgres.jar. Where does searches for the lib. In my eclipse project I
have
> added the postgres.jar?
>
>
>
> Any help is appricated.
>
>
>
> Regards
>
> Ferruh
>
>
>
>
>
>
>
>
>
>
>
> D:\Develop\eclipse\workspace\CONFUOCO>maven torque:create-db
>
>  __  __
>
> |  \/  |__ _Apache__ ___
>
> | |\/| / _` \ V / -_) ' \  ~ intelligent projects ~
>
> |_|  |_\__,_|\_/\___|_||_|  v. 1.0.2
>
>
>
> build:start:
>
>
>
> torque:init:
>
>
>
> torque:create-db:
>
> [torque-data-model] Using classpath
>
> [torque-data-model] Generating to file F:\Output\sql\create-db.sql
>
> [echo]
>
>   Executing the create-db.sql script ...
>
>
>
>
>
> BUILD FAILED
>
> File.. C:\Dokumente und
> Einstellungen\trebun\.maven\cache\maven-torque-plugin-3.1.1\plugin.jelly
>
> Element... sql
>
> Line.. 394
>
> Column 44
>
> Class Not Found: JDBC driver org.postgresql.Driver could not be loaded
>
> Total time: 8 seconds
>
> Finished at: Tue Jun 14 10:46:35 CEST 2005
>
>
>
> D:\Develop\eclipse\workspace\CONFUOCO>
>


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



RE: Setting pk manually

2005-06-14 Thread Thomas Fischer




Hi,

Try the following:

Pseudonmys pseudonyms = new Pseudonyms();
pseudonyms.setNickname("myNickname");
...
pseudonyms.save();

Thomas

"Ferruh Zamangoer" <[EMAIL PROTECTED]> schrieb am 14.06.2005
11:00:39:

> Hi,
>
>
>
> another problem is that I have a table where the primary key is a
varchar. I
> use in my schema the defaultIdMethod = native. How can I set the pk
manually
> in this table. In the pseudonyms table I had set the idMethod="none".
>
>
>
>
>
> 
> defaultJavaType="object"
>
> defaultIdMethod="native"
>
> skipSql="false">
>
>
>
> 
>
>
>
> 
>   javaNamingMethod="underscore">
>
> 
>   name="NICKNAME"
>
>   required="true"
>
>   primaryKey="true"
>
>   type="VARCHAR"
>
>   size="256"
>
>   description="NICKNAME"/>
>
> 
>   name="USER_ID"
>
>   required="true"
>
>   type="INTEGER"
>
>   description="USER_ID"/>
>
> 
>   name="STATUS"
>
>   required="true"
>
>   type="INTEGER"
>
>   size="1"
>
>   description="STATUS"/>
>
> 
>
> 
> local="USER_ID"
>
> foreign="ID"/>
>
> 
>
> 
>
> ...
>
>
>
>
>
> Can I set an entry like:
>
>
>
> Pseudonyms pseudonyms = new Pseudonyms();
>
> pseudonyms.setNickname(pseudonym);
>
> pseudonyms.setUserId(primaryKeyUser);
>
> pseudonyms.setStatus(new Integer(1));
>
> pseudonyms.save();
>
>
>
> Thanks for any help.
>
> Ferruh
>
>
>
>
>
>
>
>
>
>
>


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



RE: criteria-problem

2005-06-14 Thread Thomas Fischer




Hi,

the problem is that at the moment, joins between two tables other than
using the = operator are not possible as far as I know.
Perhaps it is possible to split the query into two. The last resort would
be to create the query by hand and use BasePeer.doSelect()

 Thomas
"Dressler,Erik(externe MA)" <[EMAIL PROTECTED]> schrieb am
10.06.2005 11:02:04:

>
> hello, everybody!
>
> is it possible to create a criteria for the statement below???
>
> SELECT p.statecode AS Vater, s.statecode AS Nachfolger
> FROM processstate p, processstate s
> WHERE s.lft BETWEEN p.lft AND p.rgt
> AND s.statecode = 'D225'
> ORDER BY p.lft;
>
> i have problems to assign one table two aliases and to select the same
> column twice with two different aliases!!!
>
> i'm completely mystified
>
> greetz, erik
>
> *  *  *  *  *  *  D I S C L A I M E R  *  *  *  *  *  *  *
>
> This message is confidential and intended for the named addressee(s)
only.
> If you are not the intended recipient, please contact the sender by
E-Mail
> return and then delete this message from your system. You should not copy
> or use it or disclose its contents to any other person.
>
> If any part of this message is illegible or if you suspect that the
message
> may have been intercepted or amended, please contact the sender.
> Dresdner Bank Luxembourg S.A. cannot accept any responsibility for the
> accuracy or completeness of this message without further investigation.
>
>
>
> -
> 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: maven torque:insert-sql produces errors with oracle

2005-06-14 Thread Thomas Fischer




Hi,

There was a problem with the oracle templates in the 3.1.1 release. See
http://issues.apache.org/scarab/issues/id/TRQS222 for details.
The solution is to use the oracle templates from 3.1 or from CVS

 Thomas

"Dressler,Erik(externe MA)" <[EMAIL PROTECTED]> schrieb am
14.06.2005 07:59:52:

>
> hi!
>
> i had the same problem. are you using turbine, too? turbine allocates
> oracle-scripts in a special folder.
>
> i think torque is originally designed for open-source-databases (mysql).
> oracle has problems with the syntax of the generated scripts. you
manipulate
> them manually and run them in a sql plus window, too!
>
> greetz, erik
>
> > -Original Message-
> > From:   Jon August [SMTP:[EMAIL PROTECTED]
> > Sent:   13 June 2005 23:03
> > To:   Apache Torque Users List
> > Subject:   maven torque:insert-sql produces errors with oracle
> >
> > when I do a:
> >
> > maven torque:insert-sql
> >
> > I get the following errors for each of my tables.
> >
> >  [torque-sql-exec] [ERROR] Failed to execute: EXCEPTION WHEN
> > TABLE_DOES_NOT_EXIST THEN NULL
> >  [torque-sql-exec] [ERROR] java.sql.SQLException: ORA-00900:
> > invalid SQL statement
> >
> >  [torque-sql-exec] [ERROR] Failed to execute: END
> >  [torque-sql-exec] [ERROR] java.sql.SQLException: ORA-00900:
> > invalid SQL statement
> >
> >  [torque-sql-exec] [ERROR] Failed to execute: / CREATE TABLE
> > gd_position_rcs ( position VARCHAR2 (5) ) / DECLARE
> > TABLE_DOES_NOT_EXIST EXCEPTION
> >  [torque-sql-exec] [ERROR] java.sql.SQLException: ORA-00900:
> > invalid SQL statement
> >
> >  [torque-sql-exec] [ERROR] Failed to execute: PRAGMA
> > EXCEPTION_INIT(TABLE_DOES_NOT_EXIST, -942)
> >  [torque-sql-exec] [ERROR] java.sql.SQLException: ORA-00900:
> > invalid SQL statement
> >
> >  [torque-sql-exec] [ERROR] Failed to execute: BEGIN EXECUTE
> > IMMEDIATE 'DROP TABLE gd_sales_unit_rcs CASCADE CONSTRAINTS'
> >  [torque-sql-exec] [ERROR] java.sql.SQLException: ORA-06550: line
> > 1, column 74:
> > PLS-00103: Encountered the symbol "end-of-file" when expecting one of
> > the following:
> >
> > I see this problem has been discussed before on the mailing list, and
> > the solution was to replace "template" files with older versions.
> > Unfortunately, I don't seem to have any template files in my
> > configuration (I can't locate any).  My configuration works just fine
> > with MySQL.
> >
> > Thanks for any help.
> >
> >  -Jon
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> *  *  *  *  *  *  D I S C L A I M E R  *  *  *  *  *  *  *
>
> This message is confidential and intended for the named addressee(s)
only.
> If you are not the intended recipient, please contact the sender by
E-Mail
> return and then delete this message from your system. You should not copy
> or use it or disclose its contents to any other person.
>
> If any part of this message is illegible or if you suspect that the
message
> may have been intercepted or amended, please contact the sender.
> Dresdner Bank Luxembourg S.A. cannot accept any responsibility for the
> accuracy or completeness of this message without further investigation.
>
>
>
> -
> 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: Join with the same table

2005-06-10 Thread Thomas Fischer




Hi,

You have to add an alias for the table. Assuming the table is called Menu
and the relevamnt columns are ID and PARENT_ID, something like this should
work:

...
criteria.addAlias("parent", MenuPeer.TABLE_NAME);
criteria.addJoin("parent.ID", MenuPeer.PARENT_ID);


Thomas

"Kintzel Levente" <[EMAIL PROTECTED]> schrieb am 10.06.2005
09:51:47:

> Hi!
>
> I encoded a menu system in a database table. Each element has an ID,
> a Caption and the ParentID (the ID of the parent element in the menu
> item, it is an ID of an other record form the current table). Now I
> want to Join the table with him-self to make a list with the caption
> of the element and the caption of the parent element. Ok, that can
> be done without join, but I want to sort the lines of this list by
> the caption of the parent element. For this I think join is inevitable.
> Can anybody help me constructing this join? Thank you!
>
> Regards,
>  Levy


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



RE: Schema name

2005-06-10 Thread Thomas Fischer




Hi,

As far as I know, schema support is only added in the CVS version.
I have heard that some people have rewritten the generator templates or
used sophisticated search-and-replace-methods to achieve the same in 3.1
and 3.1.1, but it is not supported out of the box. One problem is e.g. that
in 3.1.1 and soone, Torque is not able to extract the correct column name
from a String like "creator.MYTABLE.someColumn".

Thomas

"Gerhard Otte" <[EMAIL PROTECTED]> schrieb am 10.06.2005 16:46:24:

> Hello !
>
> Im using torque 3.1 and wonder if it's possible to have a
> schema name prefixed to the tablename.
>
> The generated sql should look like this
> select COL1 from creator.MYTABLE where ...
>
> When I generated my objectmodel I specified
> torque.database.schema = creator
> in my build property file.
>
> TIA
> Gerhard Otte
> __
> mailto:[EMAIL PROTECTED] emediapark GmbH http://www.emediapark.de
> Tel:+49 (0)941 630804-2 Fax:-9  Hemauerstr.14,93047 Regensburg,Germany
>
> -
> 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 doesn't work with PG 8.0 (although works with PG 7.3)

2005-06-10 Thread Thomas Fischer




Could you please open a scarab issue on that ?

 Thanks,

 Thomas

"Nikhil G. Daddikar" <[EMAIL PROTECTED]> schrieb am 09.06.2005 09:48:57:

>
> If you have the following simple criteria:
>
> Criteria c = new Criteria();
> c.add("work.percent_complete", 100, c.LESS_THAN);
>
> it doesn't work on PG 8.0 but works on 7.3.
>
> The reason is that in Criterion.appendPsTo, it calls:
>
> params.add (value.toString());
>
> and consequently on the preparedStatement setString is called.
>
> Read this for more info:
> http://archives.postgresql.org/pgsql-jdbc/2005-03/msg00060.php
>
> In PG 7.3, the protocal version is V2 while in 8.0 is V3. In fact you
> can still get the stuff to work in 8.0 if you specify
> "protocolVersion=2" in the jdbc URL. However, I think this is a serious
> issue and  is not a long term solution and might break other databases
> in the future.
>
> SOLUTION:
> I think the solution is not to call the "toString" in appendPsTo AND use
> setObject in the prepared statement. I don't know if this works with all
> databases.
>
>
>
>
>
>
>
>
>
>
>


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



RE: Searching in Arrays

2005-06-08 Thread Thomas Fischer




Hi,

I would guess this is not a feature supported natively by Torque.
I would try two things

1)
Criteria criteria = new Criteria();
criteria.add(SalEmpPeer.PAY_BY_QUARTER + "[1]", 1);
criteria.add(SalEmpPeer.PAY_BY_QUARTER + "[2]", 1000);
...
SalEmpPeer.doSelect(criteria);

This may fail because Torque might try to add pay_by_quarter[1]... to the
list of columns to select from.

2)
It might work with criteria.custom using "[1]=", "[2]=" as operators.
Probably your column names are equal then, so you probably have to use
Criterions and the constructor

Criterion(String table, String column, Object val, SqlEnum comp)

Please mail us the results.

Thomas

"Ferruh Zamangoer" <[EMAIL PROTECTED]> schrieb am 08.06.2005
17:10:30:

> Hi,
>
>
>
> we want to use Torque with a PostgresSQL Database does Torque support
> searching in arrays? On the postgresSQL website I see that postgres
supports
> it. The search query is below:
>
>
>
> SELECT * FROM sal_emp WHERE pay_by_quarter[1] = 1 AND
>
> pay_by_quarter[2] = 1000 AND
>
> pay_by_quarter[3] = 1000 AND
>
> pay_by_quarter[4] = 1000;
>
>
>
> Thanks for any help in advance.
>
> Regards
>
> Ferruh
>
>
>


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



RE: foreign key

2005-06-08 Thread Thomas Fischer




Hi,

you can ask the generated MapBuilder class whether a column is a foreign
key.

For this, use
MapBuilder.getDatabaseMap();

Look at the doBuild() method of a generated MapBuilder to see what
informations are put in there.

You can get the MapBuilder of a Peer class by its getMapBuilder() method

   Thomas


[EMAIL PROTECTED] schrieb am 07.06.2005 17:56:49:

> Hello,
>
> there is a method which tests if the field is a foreign key ?
>
> Thanks
>
>
>
> -
> 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: maven & m2

2005-06-07 Thread Thomas Fischer




Hi,

can you please elaborate a bit more for maven non-experts what the problem
is ?

   Thanks,

Thomas

Matthieu HELLEBOID <[EMAIL PROTECTED]> schrieb am 07.06.2005 14:29:06:

> Hello,
>
> I can see that torque and torque-gen 3.1.1 don't have a pom on ibiblio
for
> maven, while versions 3.1.1-rc* have one. So there is no converted pom
for
> 3.1.1 with m2, and transitive dependencies cannot be used.
>
> Thanks a lot !
>
> -
> 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 : IDBroker problems

2005-06-07 Thread Thomas Fischer




Hi,

The reason might be that only the dtd knows about the default values for
some attributes. The XML parser already fills in the default values if it
reads the dtd. The application itself does not do any checks, but always
uses the values from the XML parser, so the error goes unnoticed.

I will see if some checks can be built into the application to check if
required attributes are there, in order to be able to discover the error
more easily.

   Thomas

[EMAIL PROTECTED] schrieb am 03.06.2005 17:52:48:

> Figured out the problem.  This line was commented out in my schema file
> (because we had problems with it early on).  I am not sure why this would
> cause this problem.
>
>
>   "http://db.apache.org/torque/dtd/database_3_1.dtd";>
>
>
> Thank you to all for your help!
>
>
>
>
>
> Regards,
>
>
> C. Jason Harrelson
>
>
>
>
>
>
>

>   Thomas Fischer

>   <[EMAIL PROTECTED]  To:
> "Apache Torque Users List" 
>   t> cc:

>  Subject: RE :
> IDBroker problems
>

>   06/02/05 10:23 AM

>   Please respond to

>   "Apache Torque Users

>   List"

>

>

>
>
>
>
>
>
>
> Hi,
>
> this might be this bug:
>
> http://issues.apache.org/scarab/issues/id/TRQS296
>
> There was also a discussion in the users list about this some weeks ago.
>
>Thomas
>
> "KERNEUZET FREDERIC" <[EMAIL PROTECTED]> schrieb am
02.06.2005
> 15:37:07:
>
> > Hi everybody,
> >
> > I'm also getting some trouble with (i think) my ID_TABLE :
> > Since a couple of days, we're getting some PRIMARY KEY Violation on
> > a "big" table. This is the biggest table of the application, where
> > we insert data each time an "business object" is saved (to get an
> > excellent trace of users actions).
> > ID are managed by IdBroker, so i'm wondering how could a conflict
> > exists between to object of this table ?
> > The quantity seems to be OK comparing to this table (4590).
> >
> >
> > Has someone got an idea about this ?
> > Thanks a lot.
> >
> >
> >  Message d'origine
> > De:   Dressler,Erik(externe MA) [mailto:[EMAIL PROTECTED]
> > Date:   jeu. 02/06/2005 09:24
> > À:   'Apache Torque Users List'
> > Cc:
> > Objet:   RE: IDBroker problems
> >
> > hi!
> >
> > that was no try! that was definitely an error!
> >
> > the id-table needs an init-value itself. something like this:
> >
> > insert into ID_TABLE (id_table_id, table_name, next_id, quantity)
VALUES
> > (1100, 'ID_TABLE', 1000, 10)
> >
> > greetz, erik
> >
> > > -Original Message-
> > > From:   Jason Harrelson [SMTP:[EMAIL PROTECTED]
> > > Sent:   02 June 2005 04:41
> > > To:   'Apache Torque Users List'
> > > Subject:   RE: IDBroker problems
> > >
> > > I tried this to no avail.  Once again the record is added to the
table
> > > with
> > > a primary key of 0.  Of course the next record still fails as it
tries
> to
> > > insert another primary key of 0.
> > >
> > > Thanks for the try.  Any other ideas out there?
> > >
> > > -Original Message-
> > > From: Dressler,Erik(externe MA)
[mailto:[EMAIL PROTECTED]
>
> > > Sent: Friday, May 27, 2005 5:48 AM
> > > To: 'Apache Torque Users List'
> > > Subject: RE: IDBroker problems
> > >
> > >
> > > i think i can help you!
> > >
> > > look at this row: defaultIdMethod="idBroker">
> > >
> > > xml is case sensitive. you have to write: defaultIdMethod="idbroker">
> > >
> > > good luck, drezze
> > >
> > >
> > > > -Original Message-
> > > > From:   Jason Harrelson [SMTP:[EMAIL PROTECTED]
> > > > Sent:   27 May 2005 04:33
> > > > To:   torque-user@db.apache.org
> > > > Subject:   IDBroker problems
> > > >
> > > > I am new to Torque.  I have been successful at creating my DB and
> > > classes.
> > > > Everything works correctly, excluding the primary key incrementing,
> or
> > > > populating at all.  When I add a record to my account table, I get
a
> 0
> > > > in the primary key c

RE: Functions in databse

2005-06-06 Thread Thomas Fischer




Hi,

the only way I know of how db functions can be used is to create at least
parts of the database query by hand, e.g. by using criteria.custom. Look at
the criteria howto and/or the javadoc to see how criteria.custom can be
used.

Thomas

Jakub Piechnik <[EMAIL PROTECTED]> schrieb am 05.06.2005 22:55:11:

> Hello
>
> I've got a question - is it possible to invoke functions written in
> plpsql and loaded into database (in my case postgresql) from the torque
> level? If so - can You send me any links to examples?
>
> Greetings
>
> Jakub Piechnik
>
>
> -
> 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: nullpointer BasePeer

2005-06-03 Thread Thomas Fischer





Hi Robert,

the query looks ok to me. This is not the problem.

Hopefully you can debug your code. If yes, try to locate the static
initializer in your AdresPeer class. It is quite at the beginning and it
looks like the following
(with changed variable names,).

...
  /** the column name for the NAME field */
public static final String NAME;
  /** the column name for the VORNAME field */
public static final String VORNAME;

static
{
   NAME = "benutzer.NAME";
  VORNAME = "benutzer.VORNAME";
  if (Torque.isInit())
...

Try to put a breakpoint into the first line into the "static { " block,
i.e. in my case the line  "NAME = "benutzer.NAME";".
Do the same for one other class with which you have no problem (just to see
that the breakpoints work at tthat place)

Then put also a breakpoint at your doSelect statement.
Start your application and see whether the static initializer gets called
before the select.
If yes, debug into the following lines of the static initializer. There,
the Adres Map builder should be put into the dbMap.

Please mail back to the list with your findings.

 Thomas

Robert Kromkamp <[EMAIL PROTECTED]> schrieb am 03.06.2005 10:48:58:

> Hi Thomas,
>
> Thanks for your reaction and time! I've tried really a lot, also changed
the
> orderning of calling methods, but nothing solved the error. I still get
the
> NullPointer, cause the Adres table is not in the dbMap, while I try to
sort
> on it.
>
> String package = 'nl.pagelink.torque.opm';
> String table = 'OBJECTEN';
> String column = 'NAAM_OBJECT';
> String class = 'Objecten';
> String value = "%drie%";
>
> Criteria critiera = new Criteria();
> Criterion criterion = criteria.getNewCriterion (table+"."+column, value,
> criteriaObject.ILIKE);
> criteria.add(criterion);
> criteria.addJoin(ObjectenPeer.OBJECT_ID, ObjectAdresPeer.OBJECT_ID);
> criteria.addJoin(ObjectAdresPeer.ADRES_ID, AdresPeer.ADRES_ID);
> criteria.addAscendingOrderByColumn("ADRES.POSTCODE");
>
> List objecten = ObjectenPeer.doSelect(criteria);
>
> It result in the following query:
>
> SELECT OBJECTEN.OBJECT_ID, OBJECTEN.NAAM_OBJECT,
> OBJECTEN.X_COORDINAAT_ADRES, OBJECTEN.Y_COORDINAAT_ADRES,
> OBJECTEN.Z_COORDINAAT_ADRES, UPPER(ADRES.ADRES_ID) FROM OBJECTEN,
> OBJECT_ADRES, ADRES WHERE OBJECTEN.NAAM_OBJECT ILIKE '%drie%' AND
> OBJECTEN.OBJECT_ID=OBJECT_ADRES.OBJECT_ID AND
> OBJECT_ADRES.ADRES_ID=ADRES.ADRES_ID ORDER BY UPPER(ADRES.ADRES_ID) ASC
>
> There are no columns of the joined tables in the query, is this correct?
>
> Hopefully I forgot something ... perhaps do you have some new ideas?
>
> Robert
>
> -Original Message-
> From: Thomas Fischer [mailto:[EMAIL PROTECTED]
> Sent: donderdag 2 juni 2005 17:07
> To: Apache Torque Users List
> Subject: RE: nullpointer BasePeer
>
>
>
>
>
>
> Hi,
>
> your problem is that you do not use the constants in the peer class to
> create the link, but use String constants instead. For example, you use
>
> criteria.addJoin("OBJECTEN.OBJECT_ID", "OBJECT_ADRES.OBJECT_ID");
>
> instead of (hopefully I got the name of the constants right)
>
> criteria.addJoin(ObjektenPeer.OBJECT_ID, ObjectAdresPeer.OBJECT_ID);
>
> If you do not access a Peer class before executing a query which uses
> information from this Peer, the problem occurs.
>
> If you are interested in the background, see
> http://issues.apache.org/scarab/issues/id/TRQS228
>
>Thomas
>
>
>
> Robert Kromkamp <[EMAIL PROTECTED]> schrieb am 01.06.2005 16:05:17:
>
> > Hi Thomas,
> >
> > Thanks for your reaction! I'm using Torque 3.1.1. I really don't know
> what
> > is going wrong.
> >
> > I'm sure I added the adres into the schema.xml. When I change the order
> by
> > to the top table (on which the doSelect is executed), everything works
> fine
> > and I also get addresses in my result.
> >
> > I've 3 tables which are involved in my example, namely
> >
> > OBJECTEN (top)
> > OBJECT_ADRES (Mapping table which has a foreign key to Objecten and a
> > Foreign Key to Adres )
> > ADRES (Contains the order by)
> >
> > String package = 'nl.pagelink.torque.opm';
> > String table = 'OBJECTEN';
> > String column = 'NAAM_OBJECT';
> > String class = 'Objecten';
> > String value = "%drie%";
> > String comparator = 'ILIKE';
> >
> > Criteria critiera = new Criteria();
> > Criterion criterion = 

RE: IDBroker problems

2005-06-03 Thread Thomas Fischer




Hi,

As Erik already said, it seems also to me that the idbroker is not
initialized correctly. Usually, this should be done automatically, but in
your case, it fails.

One option you have is to find out why the idbroker does not get
initialized properly. Maybe it helps to invoke maven with the --debug
option.
As you wrote, the line "File '_recipe-schema.sql' in sqldbmap does not
exist" looks strange. Can you find that file manually somewhere in the
generated files ? If not, can you find a file called 'recipe-schema.sql'
instead ? If yes, does it work to execute that file manually (via a mysql
console)?
You can also try to get the tutorial running, and revert things one after
another to get your current status. By doing this, you should be able to
pinpoint exactly what causes the error to happen.
If you find out what is going on, please post your findings to the list.

Another option is to use the idMethod=native instead of idBroker. This
should usually work well in the case of mysql.

Still another option you have is to try to do initialize the idbroker
manually.

   Thomas

"C. Jason Harrelson" <[EMAIL PROTECTED]> schrieb am 03.06.2005
02:59:26:

> Here is the output when I create the db, om, and init.  Any ideas?
>
> The line:
>
> [torque-sql-exec] File '_recipe-schema.sql' in sqldbmap does not exist,
so
> skipp
> ing it.
>
> From the init-sql section loks strange to me.
>
>
> D:\CodingProjects\Eclipse\Recipe\WEB-INF>d:
>
> D:\CodingProjects\Eclipse\Recipe\WEB-INF>cd
> \CodingProjects\Eclipse\Recipe\WEB-I
> NF
>
> D:\CodingProjects\Eclipse\Recipe\WEB-INF>call ant -f build-torque.xml
> Buildfile: build-torque.xml
>
> main:
>
> check-use-classpath:
>
> check-run-only-on-schema-change:
>
> sql-check:
>
> sql:
>  [echo] +--+
>  [echo] |  |
>  [echo] | Generating SQL for YOUR Torque project!  |
>  [echo] |  |
>  [echo] +--+
>
> sql-classpath:
>  [echo] loading templates from classpath
> [torque-sql] Using contextProperties file:
> D:\CodingProjects\Eclipse\Recipe\WEB-
> INF\build.properties
> [torque-sql] Using classpath
> [torque-sql] Generating to file
> D:\CodingProjects\Eclipse\Recipe\WEB-INF\src\sql
> \report.recipe.sql.generation
> [torque-sql] 2005-06-02 19:16:27,224 [main] INFO
> org.apache.torque.engine.datab
> ase.transform.XmlToAppData - Parsing file: 'id-table-schema.xml'
> [torque-sql] 2005-06-02 19:16:27,264 [main] INFO
> org.apache.torque.engine.datab
> ase.transform.DTDResolver - Resolver: used database.dtd from
> 'org.apache.torque.
> engine.database.transform' package
> [torque-sql] 2005-06-02 19:16:27,314 [main] INFO
> org.apache.torque.engine.datab
> ase.transform.XmlToAppData - Parsing file: 'recipe-schema.xml'
>
> sql-template:
>
> check-use-classpath:
>
> check-run-only-on-schema-change:
>
> om-check:
>
> om:
>  [echo] +--+
>  [echo] |  |
>  [echo] | Generating Peer-based Object Model for   |
>  [echo] | YOUR Torque project! |
>  [echo] |  |
>  [echo] +--+
>
> om-classpath:
> [torque-data-model] Using contextProperties file:
> D:\CodingProjects\Eclipse\Reci
> pe\WEB-INF\build.properties
> [torque-data-model] Using classpath
> [torque-data-model] Generating to file
> D:\CodingProjects\Eclipse\Recipe\WEB-INF\
> src\java\report.recipe.om.generation
> [torque-data-model] 2005-06-02 19:16:30,739 [main] INFO
> org.apache.torque.engin
> e.database.transform.XmlToAppData - Parsing file: 'recipe-schema.xml'
>
> om-template:
>
> BUILD SUCCESSFUL
> Total time: 9 seconds
> Buildfile: build-torque.xml
>
> create-db-check:
>
> create-db:
> [torque-data-model] templates
> [torque-data-model] Using classpath
> [torque-data-model] Generating to file
> D:\CodingProjects\Eclipse\Recipe\WEB-INF\
> src\sql\create-db.sql
> [torque-data-model] 2005-06-02 19:16:35,335 [main] INFO
> org.apache.torque.engin
> e.database.transform.XmlToAppData - Parsing file: 'id-table-schema.xml'
> [torque-data-model] 2005-06-02 19:16:35,355 [main] INFO
> org.apache.torque.engin
> e.database.transform.DTDResolver - Resolver: used database.dtd from
> 'org.apache.
> torque.engine.database.transform' package
> [torque-data-model] 2005-06-02 19:16:35,425 [main] INFO
> org.apache.torque.engin
> e.database.transform.XmlToAppData - Parsing file: 'recipe-schema.xml'
>  [echo]
>  [echo]   Executing the create-db.sql script ...
>  [echo]
>   [sql] Executing file:
> D:\CodingProjects\Eclipse\Recipe\WEB-INF\src\sql\cre
> ate-db.sql
>   [sql] 2 of 2 SQL statements executed successfully
>
> BUILD SUCCESSFUL
> Total time: 2 seconds
> Buildfile: build-torque.xml
>
> id-table-init-sql:
>  [echo] +-

RE : IDBroker problems

2005-06-02 Thread Thomas Fischer




Hi,

this might be this bug:

http://issues.apache.org/scarab/issues/id/TRQS296

There was also a discussion in the users list about this some weeks ago.

   Thomas

"KERNEUZET FREDERIC" <[EMAIL PROTECTED]> schrieb am 02.06.2005
15:37:07:

> Hi everybody,
>
> I'm also getting some trouble with (i think) my ID_TABLE :
> Since a couple of days, we're getting some PRIMARY KEY Violation on
> a "big" table. This is the biggest table of the application, where
> we insert data each time an "business object" is saved (to get an
> excellent trace of users actions).
> ID are managed by IdBroker, so i'm wondering how could a conflict
> exists between to object of this table ?
> The quantity seems to be OK comparing to this table (4590).
>
>
> Has someone got an idea about this ?
> Thanks a lot.
>
>
>  Message d'origine
> De:   Dressler,Erik(externe MA) [mailto:[EMAIL PROTECTED]
> Date:   jeu. 02/06/2005 09:24
> À:   'Apache Torque Users List'
> Cc:
> Objet:   RE: IDBroker problems
>
> hi!
>
> that was no try! that was definitely an error!
>
> the id-table needs an init-value itself. something like this:
>
> insert into ID_TABLE (id_table_id, table_name, next_id, quantity) VALUES
> (1100, 'ID_TABLE', 1000, 10)
>
> greetz, erik
>
> > -Original Message-
> > From:   Jason Harrelson [SMTP:[EMAIL PROTECTED]
> > Sent:   02 June 2005 04:41
> > To:   'Apache Torque Users List'
> > Subject:   RE: IDBroker problems
> >
> > I tried this to no avail.  Once again the record is added to the table
> > with
> > a primary key of 0.  Of course the next record still fails as it tries
to
> > insert another primary key of 0.
> >
> > Thanks for the try.  Any other ideas out there?
> >
> > -Original Message-
> > From: Dressler,Erik(externe MA) [mailto:[EMAIL PROTECTED]

> > Sent: Friday, May 27, 2005 5:48 AM
> > To: 'Apache Torque Users List'
> > Subject: RE: IDBroker problems
> >
> >
> > i think i can help you!
> >
> > look at this row: defaultIdMethod="idBroker">
> >
> > xml is case sensitive. you have to write: defaultIdMethod="idbroker">
> >
> > good luck, drezze
> >
> >
> > > -Original Message-
> > > From:   Jason Harrelson [SMTP:[EMAIL PROTECTED]
> > > Sent:   27 May 2005 04:33
> > > To:   torque-user@db.apache.org
> > > Subject:   IDBroker problems
> > >
> > > I am new to Torque.  I have been successful at creating my DB and
> > classes.
> > > Everything works correctly, excluding the primary key incrementing,
or
> > > populating at all.  When I add a record to my account table, I get a
0
> > > in the primary key column.  A second record added also yields a 0,
> > > thus it fails.
> > >
> > > Here is an excerpt from my schema file for the account table:
> > >
> > >  > >
> > > name="recipe"
> > >
> > > defaultIdMethod="idBroker">
> > >
> > > 
> > >
> > >  > >
> > > name="account_id"
> > >
> > > required="true"
> > >
> > > primaryKey="true"
> > >
> > > type="INTEGER"
> > >
> > > description="Key of the account record"/>
> > >
> > >  > >
> > > name="account_type"
> > >
> > > required="true"
> > >
> > > primaryKey="false"
> > >
> > > type="INTEGER"
> > >
> > > description=""/>
> > >
> > >  > >
> > > name="name_first"
> > >
> > > required="true"
> > >
> > > primaryKey="false"
> > >
> > > type="VARCHAR"
> > >
> > > size="25"
> > >
> > > description="User's first name"/>
> > >
> > >  > >
> > > name="name_last"
> > >
> > > required="true"
> > >
> > > primaryKey="false"
> > >
> > > type="VARCHAR"
> > >
> > > size="25"
> > >
> > > description="User's last name"/>
> > >
> > >  > >
> > > name="street_address"
> > >
> > > required="true"
> > >
> > > primaryKey="false"
> > >
> > > type="VARCHAR"
> > >
> > > size="35"
> > >
> > > description=""/>
> > >
> > >  > >
> > > name="city"
> > >
> > > required="true"
> > >
> > > primaryKey="false"
> > >
> > > type="VARCHAR"
> > >
> > > size="25"
> > >
> > > description=""/>
> > >
> > >  > >
> > > name="state"
> > >
> > > required="true"
> > >
> > > primaryKey="false"
> > >
> > > type="VARCHAR"
> > >
> > > size="2"
> > >
> > > description=""/>
> > >
> > >  > >
> > > name="zip"
> > >
> > > required="true"
> > >
> > > primaryKey="false"
> > >
> > > type="VARCHAR"
> > >
> > > size="9"
> > >
> > > description=""/>
> > >
> > >  > >
> > > name="email"
> > >
> > > required="false"
> > >
> > > primaryKey="false"
> > >
> > > type="VARCHAR"
> > >
> > > size="50"
> > >
> > > description=""/>
> > >
> > >  > >
> > > name="password"
> > >
> > > required="true"
> > >
> > > primaryKey="false"
> > >
> > > type="VARCHAR"
> > >
> > > size="10"
> > >
> > > description=""/>
> > >
> > >  > >
> > > name="nickname"
> > >
> > > required="true"
> > >
> > > primaryKey="false"
> > >
> > > type="VARCHAR"
> > >
> > > size="25"
> > >
> > > description=""/>
> > >
> > > 
> > >
> > >
> > >
> > > The id_table has an entry for account with next_id = 1000 and
quantity
> > > = 10.
> > >
> > >
> > >
> > > I am not sure what else to post to help with the putting anyone on
the
> > > correct trail.  Everyt

RE: nullpointer BasePeer

2005-06-02 Thread Thomas Fischer




Hi,

your problem is that you do not use the constants in the peer class to
create the link, but use String constants instead. For example, you use

criteria.addJoin("OBJECTEN.OBJECT_ID", "OBJECT_ADRES.OBJECT_ID");

instead of (hopefully I got the name of the constants right)

criteria.addJoin(ObjektenPeer.OBJECT_ID, ObjectAdresPeer.OBJECT_ID);

If you do not access a Peer class before executing a query which uses
information from this Peer, the problem occurs.

If you are interested in the background, see
http://issues.apache.org/scarab/issues/id/TRQS228

   Thomas



Robert Kromkamp <[EMAIL PROTECTED]> schrieb am 01.06.2005 16:05:17:

> Hi Thomas,
>
> Thanks for your reaction! I'm using Torque 3.1.1. I really don't know
what
> is going wrong.
>
> I'm sure I added the adres into the schema.xml. When I change the order
by
> to the top table (on which the doSelect is executed), everything works
fine
> and I also get addresses in my result.
>
> I've 3 tables which are involved in my example, namely
>
> OBJECTEN (top)
> OBJECT_ADRES (Mapping table which has a foreign key to Objecten and a
> Foreign Key to Adres )
> ADRES (Contains the order by)
>
> String package = 'nl.pagelink.torque.opm';
> String table = 'OBJECTEN';
> String column = 'NAAM_OBJECT';
> String class = 'Objecten';
> String value = "%drie%";
> String comparator = 'ILIKE';
>
> Criteria critiera = new Criteria();
> Criterion criterion = criteria.getNewCriterion (table+"."+column, value,
> criteriaObject.ILIKE);
> criteria.add(criterion);
> criteria.addJoin("OBJECTEN.OBJECT_ID", "OBJECT_ADRES.OBJECT_ID");
> criteria.addJoin("OBJECT_ADRES.ADRES_ID", "ADRES.ADRES_ID");
> criteria.addAscendingOrderByColumn("ADRES.POSTCODE");
>
> List objecten = ObjectenPeer.doSelect(criteria);
>
>
> This occurs the following exception:
>
> java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at
> nl.pagelink.engine.common.CommonEngine.getObjectsByCriteria(Unknown S
> ource)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
> at sun.rmi.transport.Transport$1.run(Unknown Source)
> at java.security.AccessController.doPrivileged(Native Method)
> at sun.rmi.transport.Transport.serviceCall(Unknown Source)
> at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown
Source)
> at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown
> Sour
> ce)
> at java.lang.Thread.run(Unknown Source)
> Caused by: org.apache.torque.TorqueException:
java.lang.NullPointerException
> at
> org.apache.torque.util.BasePeer.throwTorqueException(BasePeer.java:20
> 0)
> at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1204)
> at
> nl.pagelink.torque.opm.BaseObjectenPeer.doSelectVillageRecords(BaseOb
> jectenPeer.java:402)
> at
> nl.pagelink.torque.opm.BaseObjectenPeer.doSelectVillageRecords(BaseOb
> jectenPeer.java:374)
> at
> nl.pagelink.torque.opm.BaseObjectenPeer.doSelect(BaseObjectenPeer.jav
> a:343)
> ... 16 more
> Caused by: java.lang.NullPointerException
> at
org.apache.torque.util.BasePeer.createQuery(BasePeer.java:1148)
> at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1221)
> at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1198)
> ... 19 more
>
>
> When I a print the dbMap before the error occurs, I see only the tables
> ID_TABLE and OBJECTEN are stored in dbMap.
> Because of the order by it needs to know the type of the column, but the
> Adres table is not part of the dbMap.
> Result -> NullPointer. Does anyone know why Adres is not in the dbMap? Is
> something missing in the criteria?
>
>
> Met vriendelijke groet,
> Robert Kromkamp
>
>
>
> Pagelink | improves business
>
> Bornsestraat 1d
> 7556 BA  Hengelo
>
> Postbus 76
> 7550 AB  Hengelo
>
> tel 074 750 12 50
> fax 074 750 12 51
>
> mailto:[EMAIL PROTECTED]
> http://www.pagelink.nl
> http://www.perrit.nl

RE: Query a blob field + PK Field

2005-06-01 Thread Thomas Fischer




Hi,

most databases do not allow to use a blob field in a where clause.
Probably Torque also does not support it, but you can check it by putting
it into a criteria and see what happens. But even then, you can always use
Criteria.CUSTOM if you know how the SQL should look like.

   Thomas


"Ferruh Zamangoer" <[EMAIL PROTECTED]> schrieb am 01.06.2005
15:23:03:

> Hi,
>
>
>
> we are developing a legal p2p-filesharing system in JXTA combined with
web
> services and additionally we want to use a persistence layer. Our web
> services are running on a tomcat server. Before our p2p clients can
exchange
> any data they must verify on a Trusted Third Party(TTP) our web services
if
> the content they want to exchange is legal. Our web service have to
access a
> centralized database where we have for example two tables. One
Table(White
> List) holds the contents which are registered as sharable and a another
> table(Black List) contains the contents which are registered as not
> sharable. In these two tables the primary key is a blob field.
>
>
>
> My question is it possible to query in these fields. What I mean is that
my
> clients sends a byte[] and what the service had to do is to query these
two
> tables to see if it match to the primary key fields in theses two tables.
>
>
>
> Regards
>
> Ferruh
>


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



RE: nullpointer BasePeer

2005-05-31 Thread Thomas Fischer




Hi,

Is the table you want to use for joining (Adres) in your schema.xml ?

If not, you have to put it in there (this means you have to edit the db
scripts manually in order not to create and drop that table automatically,
but that is the price to pay)

If yes, which Torque version are you using and which is the exact code you
use to do the join ?

   Thomas

Robert Kromkamp <[EMAIL PROTECTED]> schrieb am 30.05.2005 14:50:04:

> Hi all,
>
> I'm trying to do a query with an order by on a foreign table.
> A foreign table means another table than the one on which the doSelect is
> executed. By example:
>
> Get a person (PersonPeer executes the doSelect query) and order by
Zipcode
> (Adres is the foreign orderby table)
>
> When i execute this i will get an error in BasePeer.java on line 1148:
>
> ColumnMap column = dbMap.getTable(table).getColumn(columnName);
>
> The adres table is not part a the dbMap (the Person table is part of it).
> Is this a bug, do I do something wrong or does anyone have a solution?
>
> Cheers,
> Robert
>
> -
> 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: Torque and Struts

2005-05-31 Thread Thomas Fischer





Hi,

you can also extend the Struts Action Servlet and override the init()
method (do not forget to call super.init() somewhere in there)
This also works if you do not want to use load-on-startup

  Thomas

[EMAIL PROTECTED] schrieb am 31.05.2005 07:07:16:

> Czesz Jakub,
>
> we have actally two projekts using torque and struts.
>
> If you use struts and torque with Apache Tomcat, you have to put the
> initialisation into
> a class, which will be executet as a servlet during start of tomcat. The
> configuration is
> in the web.xml file of your application:
>
>   
>   
> initSystem
> YourInitClass
> 
>   
>   res-ref-name
>   jdbc/YOUR_DB
> 
> 2
>   
> ...
>   
> 
>   Resource reference to a factory for java.sql.Connection
>   instances that may be used for talking to a particular
>   database that is configured in the server.xml file.
> 
> 
>   jdbc/YOUR_DB
> 
> 
>   javax.sql.DataSource
> 
> 
>   Container
> 
>   
>
> The java class YourInitClass looks like this:
>
> public class YourInitClass extends HttpServlet
> {
>
> /** Ressource Reference */
> private static final String CONFIG_RESREFKEY = "res-ref-name";
>
> private static InitTorque m_TorqueDbcpInitialisation = null;
>
>  /**
>   *  initialisieren des Automatisierungstools.
>   */
>  public void init(ServletConfig config) throws ServletException
>  {
>  super.init(config);
>
>  String jndiRes =
> config.getInitParameter(CONFIG_RESREFKEY);
>  try
>  {
>  new InitTorque().initJNDI(jndiRes);
>  }
>  catch (TorqueException dbe)
>  {
>  throw new ServletException(dbe);
>  }
>  }
> }
>
> And finally the InitTorque class:
>
> public class InitTorque
> {
> private static final String TORQUE_PROPERTIES =
> "torque.properties";
>
> private static final String TORQUE_KEY = "torque.";
>
> private static final String TORQUE_DS = "torque.dsfactory.";
>
> private static final String J2EE_JNDI_REALM = "java:comp/env/";
>
> public PropertiesConfiguration m_torqueProps = null;
>
> public String m_dbName = null;
>
> /**
>  * initialisiere ServletContainer Context für JNDI.
>  *
>  * @param javaNamingComponent
>  * @throws TorqueException
>  */
> public void initJNDI(String javaNamingComponent) throws
> TorqueException
> {
> initResource();
> initTorque();
> log.debug("end");
> }
>
> /**
>  * initialisiere Ressource für DB Access.
>  *
>  * @return PropertiesConfiguration die Standardparameter.
>  * @throws IOException
>  */
> private void initResource() throws TorqueException {
>
> InputStream configStream =
> this.getClass().getClassLoader().getResourceAsStream(TORQUE_PROPERTIES);
> if (configStream == null)
> {
> throw new TorqueException("DB Initialisierung " +

> TORQUE_PROPERTIES + " nicht gefunden.");
> }
>
> m_torqueProps = new PropertiesConfiguration();
> try
> {
> m_torqueProps.load(configStream);
>
> Iterator it = m_torqueProps.getKeys();
>
> while (it.hasNext())
> {
> String key = (String)it.next();
> log.info("|- " + key + " = " +
> m_torqueProps.getProperty(key).toString());
> } // while ends
>
> m_dbName = m_torqueProps.getString(TORQUE_KEY +
> "database.default");
> if (m_dbName == null)
> {
> throw new TorqueException("DB
> Initialisierung Default DB Name nicht gefunden.");
> }
> }
> catch (ConfigurationException e)
> {
> throw new TorqueException(e);
> }
> }
>
> public void shutdown()
> {
> log.debug("start");
> Torque.shutdown();
> log.debug("end");
> }
>
> /**
>  * Initialisierung von Torque.
>  *
>  * @throws TorqueException
>  */
> private void initTorque() throws TorqueException {
>
> if (false == Torque.isInit())
> {
> Torque.init(m_torqueProps);
> }
>
> log.debug("end");
> }
> } // InitTorque
>
> Hope that helps,
> Arndt
>
>
>
>
>
>
> "Jakub Piech

RE: Communication failure during handshake

2005-05-30 Thread Thomas Fischer




Hi,

This is no fault of Torque. The jdbc driver cannot contact your database.
Perhaps try "localhost" instead of 127.0.0.1 (Sometimes it makes a
difference).

Thomas

Jon August <[EMAIL PROTECTED]> schrieb am 29.05.2005 02:09:20:

> Hi,
>
> I saw this question asked before on the list, but I didn't see a
> result.  I just installed mysql 4.1.12 and maven 1.0.2.  I'm using
> configuration files that worked on a previous installation.  When I
> did a maven torque:create-db, I get the following.  MySQL works just
> fine with "mysql" and Navicat, so I'm at a loss.  Any help is
> appreciated.
>
> -Jon
>
> __  __
> |  \/  |__ _Apache__ ___
> | |\/| / _` \ V / -_) ' \  ~ intelligent projects ~
> |_|  |_\__,_|\_/\___|_||_|  v. 1.0.2
>
> build:start:
>
> torque:init:
>
> torque:create-db:
>  [torque-data-model] Using classpath
>  [torque-data-model] Generating to file /Users/jon/jbproject/
> RCSSecurity/target/sql/create-db.sql
>  [echo]
>Executing the create-db.sql script ...
>
>
> BUILD FAILED
> File.. /Users/jon/.maven/cache/maven-torque-plugin-3.1.1/
> plugin.jelly
> Element... sql
> Line.. 394
> Column 44
> java.sql.SQLException: Communication failure during handshake. Is
> there a server running on 127.0.0.1:3306?
> Total time: 8 seconds
> Finished at: Sat May 28 19:46:24 EDT 2005
>
>
> -
> 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: Example problem

2005-05-25 Thread Thomas Fischer




Carl Ludewig <[EMAIL PROTECTED]> schrieb am 24.05.2005 17:07:00:
>
> As for the portability vs. flexibility question, my general
> impression is that one can use the the id broker for maximum
> portability, but choosing the "native" id method should make the best
> use of inherent db features.

Yes, but what is the "best way" to create ids in postgresql ? Certainly one
which works out of the box, this is why I prefer the method in CVS to the
3.1.1 method. Also, it is the usual way to work with sequences in other
databases that you have to define them yourself, so in my opinion, if this
also works in postgresql this is the way to go. But of course, one wants to
give people access to non-standard features of the database as well, if
this can be done with reasonable effort...

 Thomas


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



Re: Example problem

2005-05-23 Thread Thomas Fischer




Hi,

It seems this problem was introduced in Torque 3.1.1. It should be fixed in
the cvs version ("fixed" means that you do not have to insert additional
parameters in your schema for id generation). Check out the cvs and look at
the "building" section of http://db.apache.org/torque/developer-guide.html
to do the build.

If you want a released version, the templates from Torque  3.1.0 should
also work. To replace only the templates, locate the directory
templates/sql/base/postgresql (this should be either in torque-gen.jar or
in the directory structure of the generator, depending on whether you
downloaded the jar or the zip or the tar.gz version of the generator).
Remove the files in there, get the files from 3.1.0 in the same directory
and put them in there.

Matt, thanks for the link provided. I have not seen this discussion before.
I am not sure of the general direction to go, but there are two opposing
interests:
- flexibility to use any id generation in postgresql
- portability to other databases
Perhaps a solution can be found which satisfies both, but not so sure what
this could be.

  Thomas


Matt Hughes <[EMAIL PROTECTED]> schrieb am 23.05.2005 22:29:58:

> Carl Ludewig wrote:
> > I'm using Torque 3.1.1 and Postgresql and have run into a problem
> > related to this thread of discussion. Something seems to be wrong in
> > this version regarding primary keys and sequences.
>
> I'm still using 3.1 because it works and I never bothered to upgrade, so
> the rest of this is in part rampant speculation.
>
> From Torque 3.1 to Torque 3.1.1, the stuff to create PostgreSQL
> sequences used by Torque has been removed. Instead, PostgreSQL is used
> to automatically generate sequences by setting the column type to serial
> instead of int, but this only happens when autoIncrement="true".
>
> This thread on the dev list discusses it a bit:
> http://nagoya.apache.org/eyebrowse/BrowseList?listName=torque-
> [EMAIL PROTECTED]&by=thread&from=871983
>
> >
> > If I set my table to use idMethod="native", then torque generates sql
> > that refers to a non-existence sequence and I can't insert any rows.
>
> Because of the number of options that have to be set, it seems to be
> really easy to select a set which results in a non-working system.
>
> >
> > If I add autoIncrement="true" to my primary key, then I get working
sql
> > and I can insert rows via psql. BUT I can't insert any rows via  the
> > peer objects, because the generated Java code refers to a  sequence
that
> > does not exist.
>
> Try using id-method-param to tell Torque about the autogenerated
> sequence, as suggested by Scott
> (http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]
> apache.org&msgNo=4108):
>
>
>  
>  primaryKey="true" type="INTEGER"/>
> 
> 
>   
>
> Use psql and '\ds' to find out what the generated sequences are named.
>
> --
>  Matt Hughes
>   + [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]



Are there any interbase/firebird users around ?

2005-05-22 Thread Thomas Fischer

Hi,

I have been trying to get the runtimetest running against Firebird 1.5.1. 
In order to do this, I had to change the templates for creating the tables 
in the database:

- change the style of comments from /* ... */ to standard-SQL --
   at the beginning of the line
- remove the double quotes (") around the column name in the
  CREATE TABLE statement

Does anybody know whether this breaks anything for older 
interbase/firebird versions ? If yes, I would appreciate some feedback


Thomas

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



RE: [torque] Oracle 9 and Oracle Label Security

2005-05-21 Thread Thomas Fischer




Hi,

Torque is agnostic of which database user accesses the database. It just
asks the pool to get a connection, and uses whatever connection the pool
gives back.
The difficulty would be to tell the pool which user is logged on; I see no
way to do this via Torque.

However, you can use any method to get your own connection for the specific
user, and use this connection to do whatever you want with torqe. For
almost all methods which access the database, there is a version where you
can supply your own connection (e.g. someObject.save(connection),
SomePeer.doSelect(Criteria, Connection)). This is usually used for
transaction management, but you can also use it for using different
database connections for different users. Just make sure to close every
conection you use (best use a try...finally block) if you get connections
explicitly.

Maybe you can use the PerUserPoolDataSource in commons-dbcp
(http://jakarta.apache.org/commons/dbcp) for supporting multiple users. I
could not find out from a quick glance how one has to configure this pool,
but it sounds as if it supports different users in one pool (which is what
you want)

   Thomas

"Eric Jablow" <[EMAIL PROTECTED]> schrieb am 20.05.2005 21:48:33:

> In my current project, we are using Oracle 9, and we
> need to introduce Oracle Label Security. OLS adds a
> column to secured tables and restricts what users may
> see and do with the secured tables based on their
> privileges and the tables' rows' security column.
>
> For this to work, a user must to log onto the database
> using his own identity.  I get the feeling though that users
> using a Torque-based application reach the database through
> one particular Torque user, the one the database schema was
> constructed with.  Is there any way to usefully have a user
> reach the database through his own credentials and not the
> standard Torque user?
>
> Respectfully,
> Eric Jablow
>


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



RE: nested select-statement

2005-05-20 Thread Thomas Fischer




There was a Thread in the users mailing list one or two weeks ago in the
users list. Look for "subselect". The idea is to use criteria.custom.

 Thomas


"Bouvet Konsulent" <[EMAIL PROTECTED]> schrieb am 20.05.2005 09:58:40:

> hello list,
> is there a convenient way to do the following with Criteria:
>
> select distinct document_id from channel_document_latest
> where channel_id=26942 and document_id not in
> (select document_id from channel_document_latest where channel_id =
> 26945 or channel_id = 26944)
>
> or would the easiest way be to use BasePeer.executeQuery(sql)?
>
>
> cheers,
> pj
>
>
>
> Statnett SF, Tel. head office +47 22527000, Enterprise No. NO 962
> 986 633 VAT, www.statnett.no, [EMAIL PROTECTED]
> _
>
> This e-mail and any attached files are confidential and may be
> legally privileged. If you have received this transmission in error
> please notify the sender by reply e-mail immediately and then delete
> the e-mail.
> E-mail transmission cannot be guaranteed to be secure or error free
> as information could be intercepted, corrupted, lost, destroyed,
> arrive late or incomplete. If verification is required please
> request a hard copy version. This e-mail message has been virus
> checked by the virus programs used by Statnett SF.
>
>
> -
> 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: IDBroker giving duplicate keys

2005-05-19 Thread Thomas Fischer




Hi,

I am not lucky with preventing duplicate bugs in IdBroker by
synchronisation, because I am not sure whether this works in distributed
environments (several clients accessing the same database). But I am not
sure about this, I did not look into the code to see whether IdBroker is
supposed to work in distributed environments at all.

So I would like to find out how the duplicate ids can happen before I apply
any patch. However, if you do not use more than one client, synchronizing
the method should be fine.

  Thomas



David Ware <[EMAIL PROTECTED]> schrieb am 20.05.2005 03:10:27:

> Hi,
>
> I've been having problems with IDBroker giving duplicate keys in long
> running transactions.  To make sure I made a stress test situation where
> in a loop I'd simply create a new row object and save it.  With a loop
> size of 20 this would usually result in the error occuring.  Using
> P6Spy I verified that it was trying to insert the same ID on 2 different
> objects sequentially.
> Here's an some info I got from spy.log from the last time I ran it, this
> shows the last 2 times ID_TABLE was accessed/changed, and which ID was
> duplicated:
>
> ID_TABLE updates: QUANTITY = 39496
>   NEXT_ID = 62913
> primary key of next insert : 23417
> ...
> ...
> ID_TABLE updates: QUANTITY = 39496
>   NEXT_ID = 102409
> primary key of next insert : 28676
> ...
> ...
> attempts to insert primary key 62912 twice.
>
> This is using hypersonic database.  This seems to be solved by
> synchronizing the 'storeIDs' method of IDBroker as suggested in issue
> TRQS296.
>
> David Ware
>
>
> -
> 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: TorqueInstance & non-static initialization Help!

2005-05-19 Thread Thomas Fischer
' torque api.
> >
> > Perhaps another way to go about this would be to extend the Torque
class
> > and hard code the database names into it per schema.
> >
> > static TorqueMirror extends Torque
> > All references in BaseProduct, Product, BaseProductPeer, ProductPeer
> > would reference TorqueMirror rather than Torque. (the same for other
> > tables in this db)
> >
> > static TorqueSalesmen extends Torque
> > All references in BaseEmployee, Product, BaseEmployeePeer, EmployeePeer
> > would reference TorqueSalesmen rather than Torque. (the same for other
> > tables in this db)
> >
> > Then we could initialize by:
> > TorqueMirror.init("mirror.properties");
> > TorqueSalesmen.init("salesmen.properties");
> >
> >
> >
> > I understand that I can multiple databases in the torque schema, but I
> > want to avoid having one torque generated api to encompass any and all
> > database access.
> >
> >
> > Aaron
> >
> >
> >
> >
> >
> >
> > -Original Message-
> > From: Thomas Fischer [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, May 18, 2005 8:46 AM
> > To: Apache Torque Users List
> > Subject: RE: TorqueInstance & non-static initialization Help!
> >
> >
> >
> >
> >
> > Hi Aaron,
> >
> > at the moment, the TorqueInstance is a singleton, and as such, it is
not
> > possible to have multiple instances at the moment.
> > I believe that this can not be changed easily. E.g. the peer classes
> > rely
> > on TorqueInstance being a Singleton for retrieving a connection, and I
> > see
> > no easy way to tell the Peer clases which instance they should use, if
> > there are multiple instances.
> >
> > What do you need the multiple instances of Torque for ?
> >
> >   Thomas
> >
> >
> > "Aaron Loucks" <[EMAIL PROTECTED]> schrieb am 18.05.2005 14:14:51:
> >
> > >
> > > EDIT:
> > > Criteria c = new Criteria(ProductPeer.DATA_BASE_NAME);
> > >
> > >
> > > From: Aaron Loucks [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, May 17, 2005 5:02 PM
> > > To: Apache Torque Users List
> > > Subject: TorqueInstance & non-static initialization Help!
> > >
> > > I'm trying to initialize torque in a non-static way so that I can
have
> > > multiple instances (for different databases/functionality) in a
single
> > > web application.
> > >
> > > I tried initializing a TorqueInstance and pass the database name and
> > > connection to a peer class, without success:
> > >
> > > ...
> > >
> > > TorqueInstance torqueInstance = new TorqueInstance();
> > > torqueInstance.setConfiguration(config);
> > > torqueInstance.initalize();
> > >
> > > Criteria c = ProductPeer.DATABASE_NAME;
> > >
> > > List list = ProductPeer.doSelect(c, torqueInstance.getConnection());
> > >
> > >
> > > java.lang.NullPointerException
> > >at
> > > org.apache.torque.TorqueInstance.getDB(TorqueInstance.java:772)
> > >at org.apache.torque.Torque.getDB(Torque.java:299)
> > >at
> > > org.apache.torque.util.BasePeer.createQuery(BasePeer.java:918)
> > >at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1221)
> > >at
> > >
> >
test.torque.BaseProductPeer.doSelectVillageRecords(BaseProductPeer.java:
> > > 664)
> > >at
> > > test.torque.BaseProductPeer.doSelect(BaseProductPeer.java:607)
> > >at test.torque.Product.lookup(Product.java:318)
> > >at test.actions.Test1.execute(Test1.java:63)
> > >
> > > ...
> > >
> > > I looked into the source code a bit, and saw that the static Torque
> > > wrapper creates a new instance of TorqueInstance if the static
> > > torqueSingleton is null. This leads me to believe that what I'm
trying
> > > to do isn't possible, but according to the change log, this feature
> > was
> > > implemented long ago:
> > >
> > >
> > > Release 3.1-BETA1 - 2003-08-19
> > > update Introduced the TorqueInstance class to do away with
> > > static initialization woes and allow multiple instances of Torque per
> > > ClassLoader.
> > >
> > >
> > > Apparently, I'm missing something... Any help would be highly
> > > appreciated.
> > >
> > >
> > >
> > >
> > > Aaron Loucks
> > > Web Developer
> > > Gardner, Inc.
> > > 3641 Interchange Road
> > > Columbus, OH 43204
> > > 614.456.3492
> > >
> > > -
> > > 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]
> >
> >
> > -
> > 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: TorqueInstance & non-static initialization Help!

2005-05-18 Thread Thomas Fischer




Hi Aaron,

at the moment, the TorqueInstance is a singleton, and as such, it is not
possible to have multiple instances at the moment.
I believe that this can not be changed easily. E.g. the peer classes rely
on TorqueInstance being a Singleton for retrieving a connection, and I see
no easy way to tell the Peer clases which instance they should use, if
there are multiple instances.

What do you need the multiple instances of Torque for ?

  Thomas


"Aaron Loucks" <[EMAIL PROTECTED]> schrieb am 18.05.2005 14:14:51:

>
> EDIT:
> Criteria c = new Criteria(ProductPeer.DATA_BASE_NAME);
>
>
> From: Aaron Loucks [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, May 17, 2005 5:02 PM
> To: Apache Torque Users List
> Subject: TorqueInstance & non-static initialization Help!
>
> I'm trying to initialize torque in a non-static way so that I can have
> multiple instances (for different databases/functionality) in a single
> web application.
>
> I tried initializing a TorqueInstance and pass the database name and
> connection to a peer class, without success:
>
> ...
>
> TorqueInstance torqueInstance = new TorqueInstance();
> torqueInstance.setConfiguration(config);
> torqueInstance.initalize();
>
> Criteria c = ProductPeer.DATABASE_NAME;
>
> List list = ProductPeer.doSelect(c, torqueInstance.getConnection());
>
>
> java.lang.NullPointerException
>at
> org.apache.torque.TorqueInstance.getDB(TorqueInstance.java:772)
>at org.apache.torque.Torque.getDB(Torque.java:299)
>at
> org.apache.torque.util.BasePeer.createQuery(BasePeer.java:918)
>at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1221)
>at
> test.torque.BaseProductPeer.doSelectVillageRecords(BaseProductPeer.java:
> 664)
>at
> test.torque.BaseProductPeer.doSelect(BaseProductPeer.java:607)
>at test.torque.Product.lookup(Product.java:318)
>at test.actions.Test1.execute(Test1.java:63)
>
> ...
>
> I looked into the source code a bit, and saw that the static Torque
> wrapper creates a new instance of TorqueInstance if the static
> torqueSingleton is null. This leads me to believe that what I'm trying
> to do isn't possible, but according to the change log, this feature was
> implemented long ago:
>
>
> Release 3.1-BETA1 - 2003-08-19
> update Introduced the TorqueInstance class to do away with
> static initialization woes and allow multiple instances of Torque per
> ClassLoader.
>
>
> Apparently, I'm missing something... Any help would be highly
> appreciated.
>
>
>
>
> Aaron Loucks
> Web Developer
> Gardner, Inc.
> 3641 Interchange Road
> Columbus, OH 43204
> 614.456.3492
>
> -
> 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: submitted patch which allows left joins, right joins and explicit inner joins

2005-05-18 Thread Thomas Fischer




Hi Janneke,

Hope you do not mind if I answer in english because this might also be
interesting for torque users list who do not speak german.

To resummarize the problem, in some cases (see attached mail) the left join
seems to behave like a "normal" inner join.

A colleague of mine just found out that in some databases (e.g. Oracle),
if you use a left join and use the table you left joined on in the where
clause, the left join gets "converted" to an inner join. You would have to
include all parts of the where clause to the join clause to get what you
are looking for.

so what you would want is
SELECT ... FROM AUFLAGEN LEFT JOIN BILDER ON
AUFLAGEN.AUF_ID=3DBILDER.BI_REF_ID AND BILDER.BI_RS_ID<>3 AND
BILDER.BI_REFTABNAME=3D'AUFLAGEN';

and not (this is what you get at the moment)
SELECT ... FROM AUFLAGEN LEFT JOIN BILDER ON
AUFLAGEN.AUF_ID=3DBILDER.BI_REF_ID WHERE BILDER.BI_RS_ID<>3 AND
BILDER.BI_REFTABNAME=3D'AUFLAGEN';

I am afraid this is not supported by Torque at the moment :-(
(see also
http://issues.apache.org/scarab/issues/id/TRQS258 in the issue
tracker)

 Thomas



"Janneke Cloppen" <[EMAIL PROTECTED]> schrieb am 18.05.2005 10:52:51:

> Hallo Thomas
>
> Die normalen Joins funktionieren einwandfrei, hab bis jetzt nur left =
und
> right getestet. Mir ist aufgefallen, dass er dies nicht als left-join=

> verwendet sondern das normale Join. Hier ein Beispiel wo ich es verwe=
nde
> (wurde ein bi=DFkel gek=FCrzt)
>
>   Criteria lcriteria=3Dnew Criteria();
>
>
> lcriteria.addJoin(AuflagenPeer.AUF_ID,BilderPeer.BI_REF_ID,Criteria.
> LEFT_JOIN);
>  lcriteria.addJoin(AuflagenPeer.AUF_VT_ID,VerteilerPeer.VT_ID=
);
>  lcriteria.addJoin(VerteilerPeer.VT_ADR_ID,AdressenPeer.ADR_I=
D);
>  lcriteria.add(BilderPeer.BI_REFTABNAME,AuflagenPeer.TABLE_NA=
ME);
>
>
> lcriteria.add(BilderPeer.BI_RS_ID,Settings.RECORDSTATUS_DELETE,
> Criteria.NOT_EQUAL);
>  lcriteria.addSelectColumn(AuflagenPeer.AUF_LASTFAHRT);
>  lcriteria.addSelectColumn(AdressenPeer.ADR_FIRMA);
>  lcriteria.addSelectColumn(AuflagenPeer.AUF_TEXT);
>  lcriteria.addSelectColumn(BilderPeer.BI_ID);
>  lcriteria.addSelectColumn(BilderPeer.BI_DATEINAME);
>
> lRw =3D AuflagenPeer.doSelectVillageRecords(lcriteria);
>
> In diesem Fall werden nur Auflagen angezeigt, die auch Bilder haben, =
aber
> dies m=FC=DFte eigentlich auch Auflagen anzeigen, die keine bilder be=
sitzen.
> Hier die Ausgabe vom Criteria als String.
>
> Criteria:: AUFLAGEN.AUF_STR_ID<=3D>AUFLAGEN.AUF_STR_ID IS NULL :
> BILDER.BI_RS_ID<=3D>BILDER.BI_RS_ID<>3:
> BILDER.BI_REFTABNAME<=3D>BILDER.BI_REFTABNAME=3D'AUFLAGEN':
> AUFLAGEN.AUF_RS_ID<=3D>AUFLAGEN.AUF_RS_ID<>3:
> AUFLAGEN.AUF_ANT_ID<=3D>AUFLAGEN.AUF_ANT_ID=3D142:
>
>
> Current Query SQL (may not be complete or applicable): SELECT
> AUFLAGEN.AUF_LASTFAHRT, ADRESSEN.ADR_FIRMA, AUFLAGEN.AUF_TEXT,
BILDER.BI_ID,
> BILDER.BI_DATEINAME, AUFLAGEN.AUF_GPSPOS, AUFLAGEN.AUF_POSITION FROM
> AUFLAGEN LEFT JOIN BILDER ON AUFLAGEN.AUF_ID=3DBILDER.BI_REF_ID, VERT=
EILER,
> ADRESSEN WHERE AUFLAGEN.AUF_VT_ID=3DVERTEILER.VT_ID AND
> VERTEILER.VT_ADR_ID=3DADRESSEN.ADR_ID AND AUFLAGEN.AUF_STR_ID IS NULL=
  AND
> BILDER.BI_RS_ID<>3 AND BILDER.BI_REFTABNAME=3D'AUFLAGEN' AND
> AUFLAGEN.AUF_RS_ID<>3 AND AUFLAGEN.AUF_ANT_ID=3D142 ORDER BY
> AUFLAGEN.AUF_LASTFAHRT DESC, VERTEILER.VT_POSITION ASC
>


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



RE: torque and intersect

2005-05-18 Thread Thomas Fischer




Hi,

Torque is just a tool for talking to the database, not for further
processing the results. You can ask the database for the intersection using
criteria.addIn(). However, if you already have the two resultsets in
memory, it might be more performant to compute the differences by hand
using List.contains() and overriding the equals() method of the objects.

Thomas

"Dressler, Erik(externe MA)" <[EMAIL PROTECTED]> schrieb am
17.05.2005 17:11:25:

>
> hello!
>
> i have two resullists from two different selects. is it possible to get
the
> intersection of these selects via torque? if the answer is yes, please
give
> me a hint!
>
> greets, erik
>
> *  *  *  *  *  *  D I S C L A I M E R  *  *  *  *  *  *  *
>
> This message is confidential and intended for the named addressee(s)
only.
> If you are not the intended recipient, please contact the sender by
E-Mail
> return and then delete this message from your system. You should not copy
> or use it or disclose its contents to any other person.
>
> If any part of this message is illegible or if you suspect that the
message
> may have been intercepted or amended, please contact the sender.
> Dresdner Bank Luxembourg S.A. cannot accept any responsibility for the
> accuracy or completeness of this message without further investigation.
>
>
>
> -
> 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: ORA-01002 when Oracle is i in serialised mode

2005-05-17 Thread Thomas Fischer





Raphael,

which pool are you using ? I have tried to reproduce your issue using the
dbcp pool and am not able to get a serializable connection which is not in
auto-commit mode. If I set the transaction isolation to serializable and
leave auto-commit true, then I am not able to reproduce your issue (but I
do not see any point in this configuration)
I have used the following lines to configure this

torque.dsfactory.bookstore.pool.defaultTransactionIsolation = 8
torque.dsfactory.bookstore.pool.defaultAutoCommit = false

Not being able to get a serializable connection which is not auto-commit
seems a dbcp issue to me, but I have to dive deeper into that to be sure.

   Thomas

"Raphael Mankin,,," <[EMAIL PROTECTED]> schrieb am 13.05.2005 17:31:54:

>
> On 13-May-2005 Florin Vancea wrote:
> > I've seen that, but not with Torque.
> > In my case, it was the following sequence of operations:
> >
> > one connection opened with DB
> > some statement performed outside transaction (using implicit commit
mode)
> > transaction started
> > some select
> > Bang --> ORA-01002
> >
> > My workaround was to close the connection and open it again at thesame
time
> > the transaction was started.
>
> Your solution will, of course, not work with torque, because of the
connection
> pooling.
>
> In my case, I have not got as far as starting any explicit transactions,
other
> than those Torque does for one. In my example, the pari of statements I
wrote
> will be a transaction all by themselves.
>
>
> I was really wondering whether this was a Torque problem, in which case
we
> can find a fix, or do I have to shout at Oracle, which is much more
difficult.
>
>
> >
> > - Original Message -
> > From: <[EMAIL PROTECTED]>
> > To: "Apache Torque Users List" 
> > Sent: Friday, May 13, 2005 3:56 PM
> > Subject: ORA-01002 when Oracle is i in serialised mode
> >
> >
> >> We have been quite happily running an application based on Torque for
> > about
> >> a year now. Recently, we found what looked like a  bug in Oracle's
> >> transaction management. To work around this we changed the database
mode
> >> from the default Oracle locking to SERIALIZABLE. We now cannot get
Torque
> >> to do anything with the DB.
> >>
> >> The following code gives 'ORA-01002 fetch out of sequence'
> >>
> >> Criteriacrit  = new Criteria()
> >> List  l = PersonPeer.doSelect(crit);
> >>
> >> Resetting the DB into Oracle's default locking mode clears the problem
-
> >> but of course leaves us with the original transaction mgt problem.
> >>
> >>
> >> Any suggestions?
> >>
> >>
> >>
> >>
> >> -
> >> 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]
>
> --
>Lead us not into temptation; we
>can find our own way.
>
>
> Raphael Mankin
> --
>
> -
> 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: Problem with BOOLEAN fields

2005-05-16 Thread Thomas Fischer





Hi,

Piechu <[EMAIL PROTECTED]> schrieb am 15.05.2005 22:11:44:

> Hello
>
> Thanks. But where can I find information about which Torque type is an
> equivalent for the type from database ? is there any rule.
>

In the generator source, look for files template/sql/base//db.props. There is one for every database, it contains the mapping
Torque type -> database type

> Another problem is - when I used type "CLOB" I've got BUILDING FAILED
> message caused in *.jelly - and it's probably something wrong with
> Torque types. What should I use for Text filed in database and is there
> any equivalent type for type Money in database?
>

I have tried to generate a clob field using the postgresql setting and it
looks fine to me (I could not run the classes, I do not have a postgresql
installation running here). For this, I used the schema.xml from the
tutorial, and changed the ISBN number to CLOB:



  
...

...

Perhaps you have another issue in your schema.xml.
Regarding the money type, it is not supported natively by Torque because it
is postgresql-specific. You can try and change the db.props file in the
genrator and insert it (no idea whether that works), or you can change the
mapping of an unused Torque datatype to money (that should work, but is
very unintuitive if one reads the schema.xml)


> And last thing - should schema.xml file describe whole database - or if
> some things are programmed in database, such as auto numeration for
> primary keys, unique fields, default values - should it be also included
> in schema.xml file? If not - how should I mark a primary key which is
> auto-numeration field?

Everything you can do in the schema.xml, you should do in the schema.xml.
Primary keys are autoincrement in most cases (the only exception known to
me is mysql), but it does not hurt to specify it by setting
autoincrement="true"

>
> Greetings
> Jakub Piechnik
>

Thomas


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



generator does not validate schema.xml against dtd

2005-05-15 Thread Thomas Fischer




Hi,

has anybody looked into it why the generator does not fail if the
schema.xml does not comply with the dtd ? I have looked into the code and
seen that the parser is set to validating, but somehow it does not throw an
error.

  Thomas


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



RE: Problem with BOOLEAN fields

2005-05-15 Thread Thomas Fischer




Hi,

Boolean is not a Torque type. The type in the schema xml must be declared
in the
dtd, this is

  BIT  | TINYINT | SMALLINT| INTEGER| BIGINT| FLOAT
| REAL | NUMERIC | DECIMAL | CHAR   | VARCHAR   | LONGVARCHAR
| DATE | TIME| TIMESTAMP   | BINARY | VARBINARY | LONGVARBINARY
| NULL | OTHER   | JAVA_OBJECT | DISTINCT   | STRUCT| ARRAY
| BLOB | CLOB| REF | BOOLEANINT | BOOLEANCHAR
| DOUBLE


For Booleans, use BIT, BOOLEANINT, or BOOLEANCHAR

   Thomas

"Piechu Piechu" <[EMAIL PROTECTED]> schrieb am 15.05.2005 15:00:02:

> Hello
>
> I'm rather new to Torque, so maybe my problem seems very easy, but I
> haven't any idea how to sole it.
>
> I've created a schema file with my database description. I have
> there few fields that are pointed as a BOOLEAN type. After succesful
> build using Maven, when I put all classes to Eclipse - there are a
> lot of errors with fields which were pointed as Boolean type. These
> errors are for example:
> -> private int clubDeleted = new int(false);
> /*
>Where in schema file was:
>type="BOOLEAN"
>default="false"/>
> */
> -> obj.setClubDeleted(row.getValue(offset + 2).$col.VillageMethod);
> /*
>Eclipse doesn't recognize the '$col' (it says "$col cannot be
> resolved or is not a field) - the same occurs with every fields that
> was pointed as BOOLEAN type
> */
>
> They only occure in both Base* and Base*Peer files.
> I'm using JDBC driver -> postgresql-8.1dev-400.jdbc3.jar, java 1.
> 5_02 and torque 3.1.1
>
> Greetings
>
> Jakub Piechnik
>
> 
> THE CHEMICAL BROTHERS -> Zagrają koncert w Sopocie 21 czerwca!
> To będzie gigantyczna impreza z efektami multimedialnymi XXI wieku!
> Kliknij: http://klik.wp.pl/?adr=http%3A%2F%2Fmuzyka.wp.pl%2Fniusy.
> html%3Fid%3D16176&sid=379
>
>
>
> -
> 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: torque and subqueries

2005-05-13 Thread Thomas Fischer




Erik,

I have just come across an example of how to build a hand-built subquery
into an existing criteria. Perhaps one can also try to build the subquery
by using another criteria and use its toString()-Method or some more
sophisticated methods...

Criteria criteria = new Criteria();
...
criteria.add(StatistikEintragPeer.PERSON_ID, person.getId());
criteria.add(StatistikEintragPeer.STATISTIK_EINTRAG_ID,
(Object)(StatistikEintragPeer.STATISTIK_EINTRAG_ID+" IN (SELECT
MAX("+StatistikEintragPeer.STATISTIK_EINTRAG_ID+") FROM
"+StatistikEintragPeer.TABLE_NAME+" GROUP BY
"+StatistikEintragPeer.PERSON_ID+")"), Criteria.CUSTOM);

List result = StatistikEintragPeer.doSelect(criteria, connection);

  Regards,

 Thomas


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



Re: updating autoincrement value after save

2005-05-10 Thread Thomas Fischer
Hi Arndt,
I could not reproduce your problem using the current cvs version.
I have used the bookstore-schema from the runtimetest:

...
  

...
and the author id is not zero after a save (note that in cvs, primary 
keys are autoincrement by default)
However, this does not mean that this problem could not exist in Torque 
3.1.x, as Henning has done some garbage collection in the id generation 
code.

Have you tried to debug into Torque code and see what happens ?
Thomas
On Fri, 6 May 2005 [EMAIL PROTECTED] wrote:
Hi torque-users,
I'm trying to get the primary key (generated by the databses using
autoincrements)
after saving my object, but the id of the object is 0.
object.save()
object.getId() ---> 0
If I select the object after saving it, I get the correct value.
object.save()
object = ObjectPeer.doSelect(...)
object.getId() ---> 4711
Im Using Torque 3.1.1 with MySql 4.1.1.
What can I do to get the id without selecting the object again.
Thanks for your answers,
Arndt
-
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: torque and subqueries

2005-05-09 Thread Thomas Fischer




Hi,

To my knowledge, it is not possible to create subqueries via criteria. You
have to create the query by hand and use e.g.
BasePeer.doSelectVillageRecords() to execute it.
Alternatively, if it is not too much overhead, you can also compose the
subquery, execute it to get the results, and build a new criteria from it.
Another possibility might be the following: Perhaps your query is such that
it is possible to use a view for it. Then, in the schema.xml, you have to
insert a table which corresponds to the view, and only read from it. For
this, you would have to edit the db create sql script by hand.

Thomas

"Dressler, Erik(externe MA)" <[EMAIL PROTECTED]> schrieb am
09.05.2005 15:56:16:

>
> hi, folks!
>
> is it possible, to map subqueries with torque? if the answer is yes,
please
> tell me how!!! :D
>
> greetz, erik dressler
>
> *  *  *  *  *  *  D I S C L A I M E R  *  *  *  *  *  *  *
>
> This message is confidential and intended for the named addressee(s)
only.
> If you are not the intended recipient, please contact the sender by
E-Mail
> return and then delete this message from your system. You should not copy
> or use it or disclose its contents to any other person.
>
> If any part of this message is illegible or if you suspect that the
message
> may have been intercepted or amended, please contact the sender.
> Dresdner Bank Luxembourg S.A. cannot accept any responsibility for the
> accuracy or completeness of this message without further investigation.
>
>
>
> -
> 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: date fields / oracle

2005-05-09 Thread Thomas Fischer




Hi,

to provide a little background: In the Torque 3.1.1 release, the Torque
types date, time and timestamp ar all mapped to oracle type Date.
Unfortunately, the underlying village library (not the database!) truncates
all dates to date accuracy. So, if plain 3.1.1 is used, all the above
Torque types have day accuracy.

However, it is possible to change the mapping of Torque type Timestamp to
oracle type timestamp in the oracle db.props file, which changes the
accuracy of Torque type timestamp to at least milliseconds. I am not sure
if you have to regenerate your object model afterwards, maybe you can just
alter the table in the database.
There is nothing easy to be done about the Torque type time, I'm afraid.

See also http://issues.apache.org/scarab/issues/id/TRQS263

Thomas



[EMAIL PROTECTED] schrieb am 09.05.2005 16:42:47:

> http://www.devaki.org/nextobjects/torque-type-map.html
>
> Adam
>
>
>
>
>

>   [EMAIL PROTECTED]

>   c.fr   To:
> "Apache Torque Users List" 

>  cc:

>  Subject: Réf. :
> Re: date fields / oracle
>   05/09/05 09:47 AM

>   Please respond to

>   "Apache Torque Users

>   List"

>

>

>
>
>
>
> For Torque 3.1 (OM classes generated with Ant)
>
> \templates\sql\base\oracle\db.proprs
>
>
>
>
> Roel van Dijk
>
> <[EMAIL PROTECTED]Pour :  Apache Torque Users List
> 
> l.com>   cc :
>
>  Objet :  Re: date fields /
> oracle
> 09/05/2005
>
> 16:26
>
> Veuillez
>
> répondre à
>
> "Apache
>
> Torque Users
>
> List"
>
>
>
>
>
>
>
> > As a sidenote, where can I find a list of the available column types
> > that I can use in my XML schema?
>
> And a related question: where can I find the mapping between these
> column types (as defined in the XML schema), and the Java objects in
> the created OM classes? (e.g. VARCHAR to String, INTEGER to int, DATE
> to Date, etc..)
>
> --
> Roel -- [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]
>
>
>
>
>
> -
> 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: Doubt reg Mysql4.1 and Turbine connectivity

2005-05-09 Thread Thomas Fischer




There have been no complaints so far that Torque does not work with MySQL
4.1 (and there is no reason why it should not).
Maybe some configuration issue or no mysql driver jar in the classpath, if
it is Torque that does not work. Check your logfiles to pinpoint the error.

Thomas

"sri dhar" <[EMAIL PROTECTED]> schrieb am 07.05.2005 14:45:56:

>
> Hi,
>  I got one error connecting mysql 4.1 with Turbine , when i try to
> login in i cant able to connect thro the browser, pls help to solve
> this problem.
>   Whether it is possible to connect mysql4.1 and tubine 2.3?
> Thanks in Advance
> Regards
> Sridhar


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



RE: Speed

2005-05-06 Thread Thomas Fischer




I guess the mailing lists do not accept appended messages.

Anyhow, If you are looking after speed issues, it is a good idea to turn
logging on. the logfiles usually contain time information, so you can see
which component causes the delay.

   Thomas

"jill han" <[EMAIL PROTECTED]> schrieb am 04.05.2005 18:15:59:

> I hope the file will be attached correctly this time.
> Thanks a lot.
>
> -Original Message-
> From: jill han
> Sent: Wednesday, May 04, 2005 11:04 AM
> To: 'Apache Torque Users List'
> Subject: Speed
>
> We have a web application built with Turbine/Torque(Oracle)/Velocity.
> The problem is that it will take about 6 minutes to generate such a
> report. See the attached.
> I am not sure what caused that, db issue? Or template issue?
> Is there anyway that may help to speed it up?
>
>
>
>
> -
> 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: torque:datasql, oracle and ampersand

2005-05-03 Thread Thomas Fischer




Roel,

Thanks for the hint.

>From the web sites you have quoted, this seems to be a problem of the
sqlplus console rather than the oracle db itself.
I guess that you execute the created scripts via sqlplus. Does this also
happen if ant executes the created script via jdbc ?

Thomas

Roel van Dijk <[EMAIL PROTECTED]> schrieb am 02.05.2005 09:26:36:

> I'm using Torque as part of Jetspeed, and it's working without any
troubles.
>
> Just a note though: I'm using the 'datasql' goal to create the .sql
> file from a project-data.xml file.The creation process works fine
> (Maven needed some extra memory for the few thousand entries..).  I'm
> using an Oracle database. However, the created insert-statements are
> not clean when there's a ampersand in the data. The created SQL looks
> something like:
>
> INSERT INTO MYTABLE (MYCOLUMN)
>VALUES('this is & my data');
>
> However, you cannot insert an ampersand in Oracle this way. References:
>
> http://www.jlcomp.demon.co.uk/faq/litampersand.html
> http://www.orafaq.com/faqplus.htm#NOAT
>
> Not sure what the proper solution is for Torque, but I thought Torque
> developers should know.
>
> --
> Roel -- [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]



SV: Column ambiguously defined

2005-04-28 Thread Thomas Fischer





"Bouvet Konsulent" <[EMAIL PROTECTED]> schrieb am 28.04.2005 12:05:37:

> hello again,
> thank you for all your help, it has been very useful.
>

You are welcome.

> 1. Your diagnoisis was right. Using criteria.setLimit(0); made the
> query work fine
>
> 2. I tried to do a
> ChannelDocumentLatestPeer.doSelectJoinDocument(crit);
> This did not work very well, however. The generated SQL was exactly
> like the query which generated a 'ORA-00918: column ambiguously
> defined' error.
> I am using Oracle 8.1.7, which does not handle joins very well.
> Keywords like 'inner join' were not introduced before version 9.
> Maybe that has something to do with it? Does Torque generate SQL
> based on the _version_ of the database, by using the corresponding
jdbc-jar?

No, this would also fail within Oracle 10g. It is a problem with the way
oracle handles limit/offset and how it is handled in Torque.

>
> 3. I ended up doing
> List docs = DocumentPeer.doSelectVillageRecords(crit);
> transfer docs into objects
> building a criteria for ChannelDocumentLatest
> List l = ChannelDocumentLatestPeer.doSelectVillageRecords(cdlCriteria);
> transfer l into object 'latest'
> doc.setOriginatingChannel(latest.getOriginatingChannelId());
>
> so I ended up with one more SQL-query to get my foreign key to add
> to the Document-object, but I guess that is ok.

I do the same most of the time.

>
> once more: thank you for your help!
>
> cheers,
> pj
>

Thomas


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



SV: Column ambiguously defined

2005-04-27 Thread Thomas Fischer
 logger.debug("crit 41="+crit);
> ChannelDocumentLatestPeer.addSelectColumns(crit);
> logger.debug("crit 42="+crit);
> crit.addDescendingOrderByColumn(DocumentPeer.CHANGED);
> crit.addDescendingOrderByColumn(DocumentPeer.ID);
>
> //Join two tables
> List documents = null;
> try{
> List experiment = DocumentPeer.doSelectVillageRecords(crit);
> documents = new ArrayList(experiment.size());
> // populate the object(s)
> for (int i = 0; i < experiment.size(); i++)
> {
> Record row = (Record) experiment.get(i);
> no.acme.om.Document doc = DocumentPeer.
> row2Object(row, 1, DocumentPeer.getOMClass());
> ChannelDocumentLatest latest =
> ChannelDocumentLatestPeer.row2Object(row, DocumentPeer.numColumns +
> 1, ChannelDocumentLatestPeer.getOMClass());
>
doc.setOriginatingChannel(latest.getOriginatingChannelId());
> documents.add(doc);
> }
> }
> catch(TorqueException e){
> logger.warn("Problems finding Documents: "+e);
> }
>
>
>
> -Opprinnelig melding-
> Fra: Thomas Fischer [mailto:[EMAIL PROTECTED]
> Sendt: 27. april 2005 09:38
> Til: Apache Torque Users List
> Emne: RE: Column ambiguously defined
>
>
>
>
>
>
> Hi,
>
> The problem seems to be the limit and offset processing. Limit and Offset
> work differently in postgres and oracle.
> Which Torque version do you use ?
> How do you construct the criteria to get this query ?
>
>  Thomas
>
> "Bouvet Konsulent" <[EMAIL PROTECTED]> schrieb am 26.04.2005
15:24:04:
>
> > hello again,
> > I got the following output from Torque:
> >
> > DEBUG http-8080-Processor24 org.apache.torque.util.BasePeer - SELECT
> > B.* FROM ( SELECT A.*, rownum AS TORQUE$ROWNUM FROM ( SELECT
> > DISTINCT document.ID, document.URL, document.FILENAME, document.
> > FILEPREFIX, document.OBJECTTYPE_ID, document.IS_DELETED, document.
> > TITLE, document.IS_NEW, document.CREATED, document.CHANGED,
> > channel_document_latest.DOCUMENT_ID, channel_document_latest.
> > CHANNEL_ID, channel_document_latest.ORIGINATING_CHANNEL_ID,
> > channel_document_latest.CHANGED FROM document,
> > channel_document_latest WHERE document.IS_DELETED=1 AND
> > channel_document_latest.CHANNEL_ID=26944 AND document.
> > ID=channel_document_latest.DOCUMENT_ID ORDER BY document.CHANGED
> > DESC, document.ID DESC ) A  ) B WHERE  B.TORQUE$ROWNUM <= 10
> >
> > this gives the following error:
> > org.apache.torque.TorqueException: ORA-00918: column ambiguously
defined
> >
> > The SQL above is a bit complex, but the following SQL would give the
> > same result:
> > select A.* from (select document.CHANGED, channel_document_latest.
> > CHANGED from document, channel_document_latest) A;
> >
> > I have a column called CHANGED in both tables document and
> > channel_document_latest, which Oracle 8.1.7 does not like.
> > The following SQL would be valid for Oracle:
> > select A.* from (select document.CHANGED, channel_document_latest.
> > CHANGED CHANGED_1 from document, channel_document_latest) A;
> >
> > The code was previously running fine on Postgres, which may indicate
> > that Postgres inserts aliases automatically?
> >
> > As BasePeer is the class that generates this SQL, I do not see how I
> > could solve this without changing the columnnames of my database
> > (which would be quite a challenge)
> >
> > any suggestions?
> >
> > cheers,
> > Per Jorgen
> >
> > -Opprinnelig melding-
> > Fra: Thomas Fischer [mailto:[EMAIL PROTECTED]
> > Sendt: 26. april 2005 12:16
> > Til: Apache Torque Users List
> > Emne: RE: Column ambiguously defined
> >
> >
> >
> >
> >
> >
> > Hi,
> >
> > Torque does not handle ambiguously defined columns by itself. Usually,
> this
> > does not appear if  you use the constants defined for the column names
in
> > the Peer classes (which have the tablename prepended to the columnname,
> so
> > that the column names are unique within the schema).
> >
> > You can look at the Torque debug log to get more information about the
> > error. For this, you have to configure a logger supported by the
> > org.apache.commons.logging framework. Perhaps it can also be found in
the
> > JBoss logs. If it is a select that causes the error and you have chosen
> the
> > loglevel to be "debug&qu

RE: Column ambiguously defined

2005-04-27 Thread Thomas Fischer




Hi,

The problem seems to be the limit and offset processing. Limit and Offset
work differently in postgres and oracle.
Which Torque version do you use ?
How do you construct the criteria to get this query ?

 Thomas

"Bouvet Konsulent" <[EMAIL PROTECTED]> schrieb am 26.04.2005 15:24:04:

> hello again,
> I got the following output from Torque:
>
> DEBUG http-8080-Processor24 org.apache.torque.util.BasePeer - SELECT
> B.* FROM ( SELECT A.*, rownum AS TORQUE$ROWNUM FROM ( SELECT
> DISTINCT document.ID, document.URL, document.FILENAME, document.
> FILEPREFIX, document.OBJECTTYPE_ID, document.IS_DELETED, document.
> TITLE, document.IS_NEW, document.CREATED, document.CHANGED,
> channel_document_latest.DOCUMENT_ID, channel_document_latest.
> CHANNEL_ID, channel_document_latest.ORIGINATING_CHANNEL_ID,
> channel_document_latest.CHANGED FROM document,
> channel_document_latest WHERE document.IS_DELETED=1 AND
> channel_document_latest.CHANNEL_ID=26944 AND document.
> ID=channel_document_latest.DOCUMENT_ID ORDER BY document.CHANGED
> DESC, document.ID DESC ) A  ) B WHERE  B.TORQUE$ROWNUM <= 10
>
> this gives the following error:
> org.apache.torque.TorqueException: ORA-00918: column ambiguously defined
>
> The SQL above is a bit complex, but the following SQL would give the
> same result:
> select A.* from (select document.CHANGED, channel_document_latest.
> CHANGED from document, channel_document_latest) A;
>
> I have a column called CHANGED in both tables document and
> channel_document_latest, which Oracle 8.1.7 does not like.
> The following SQL would be valid for Oracle:
> select A.* from (select document.CHANGED, channel_document_latest.
> CHANGED CHANGED_1 from document, channel_document_latest) A;
>
> The code was previously running fine on Postgres, which may indicate
> that Postgres inserts aliases automatically?
>
> As BasePeer is the class that generates this SQL, I do not see how I
> could solve this without changing the columnnames of my database
> (which would be quite a challenge)
>
> any suggestions?
>
> cheers,
> Per Jorgen
>
> -Opprinnelig melding-
> Fra: Thomas Fischer [mailto:[EMAIL PROTECTED]
> Sendt: 26. april 2005 12:16
> Til: Apache Torque Users List
> Emne: RE: Column ambiguously defined
>
>
>
>
>
>
> Hi,
>
> Torque does not handle ambiguously defined columns by itself. Usually,
this
> does not appear if  you use the constants defined for the column names in
> the Peer classes (which have the tablename prepended to the columnname,
so
> that the column names are unique within the schema).
>
> You can look at the Torque debug log to get more information about the
> error. For this, you have to configure a logger supported by the
> org.apache.commons.logging framework. Perhaps it can also be found in the
> JBoss logs. If it is a select that causes the error and you have chosen
the
> loglevel to be "debug", the query should be logged in the debug log.
>
>Thomas
>
> "Bouvet Konsulent" <[EMAIL PROTECTED]> schrieb am 26.04.2005
11:45:08:
>
> > hello list,
> > has anyone seen the following error when using Torque 3.1, Oracle 8.
> > 1.7 and jBoss 4.0.1 (Tomcat 5)?
> >
> > INFO  [STDOUT] org.apache.torque.TorqueException: ORA-00918: column
> > ambiguously defined
> >
> > I understand the ORA-error, but I just don't know where this could
> > come from within Torque... no stack-trace, nothing, just this
> > message. Eventually, the application crashes with a javax.servlet.
> > jsp.JspException, but that stack trace does not give any helpful
> > information either. I thought Torque should be able to handle
> > ambiguous column-names?
> >
> > Anny suggestions would be appreciated...
> >
> > cheers,
> > Per Jorgen
> >
> >
> >
> >
> > Statnett SF, Tel. head office +47 22527000, Enterprise No. NO 962
> > 986 633 VAT, www.statnett.no, [EMAIL PROTECTED]
> > _
> >
> > This e-mail and any attached files are confidential and may be
> > legally privileged. If you have received this transmission in error
> > please notify the sender by reply e-mail immediately and then delete
> > the e-mail.
> > E-mail transmission cannot be guaranteed to be secure or error free
> > as information could be intercepted, corrupted, lost, destroyed,
> > arrive late or incomplete. If verification is required please
> > request a hard copy version. This e-mail message has been virus
> > checked by the virus programs used by Statnett SF.
> >
>

RE: Column ambiguously defined

2005-04-26 Thread Thomas Fischer




Hi,

Torque does not handle ambiguously defined columns by itself. Usually, this
does not appear if  you use the constants defined for the column names in
the Peer classes (which have the tablename prepended to the columnname, so
that the column names are unique within the schema).

You can look at the Torque debug log to get more information about the
error. For this, you have to configure a logger supported by the
org.apache.commons.logging framework. Perhaps it can also be found in the
JBoss logs. If it is a select that causes the error and you have chosen the
loglevel to be "debug", the query should be logged in the debug log.

   Thomas

"Bouvet Konsulent" <[EMAIL PROTECTED]> schrieb am 26.04.2005 11:45:08:

> hello list,
> has anyone seen the following error when using Torque 3.1, Oracle 8.
> 1.7 and jBoss 4.0.1 (Tomcat 5)?
>
> INFO  [STDOUT] org.apache.torque.TorqueException: ORA-00918: column
> ambiguously defined
>
> I understand the ORA-error, but I just don't know where this could
> come from within Torque... no stack-trace, nothing, just this
> message. Eventually, the application crashes with a javax.servlet.
> jsp.JspException, but that stack trace does not give any helpful
> information either. I thought Torque should be able to handle
> ambiguous column-names?
>
> Anny suggestions would be appreciated...
>
> cheers,
> Per Jorgen
>
>
>
>
> Statnett SF, Tel. head office +47 22527000, Enterprise No. NO 962
> 986 633 VAT, www.statnett.no, [EMAIL PROTECTED]
> _
>
> This e-mail and any attached files are confidential and may be
> legally privileged. If you have received this transmission in error
> please notify the sender by reply e-mail immediately and then delete
> the e-mail.
> E-mail transmission cannot be guaranteed to be secure or error free
> as information could be intercepted, corrupted, lost, destroyed,
> arrive late or incomplete. If verification is required please
> request a hard copy version. This e-mail message has been virus
> checked by the virus programs used by Statnett SF.
>
>
> -
> 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: XMLSchema to Torque's relational schema transform

2005-04-21 Thread Thomas Fischer




I do not know if this is what you want, but if you use the cvs version,
Torque can also generate simple javaBeans which can be used to construct
persistent database objects and vice versa. See

http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgNo=5104

This would mean that you do not need digester to create the beans, Torque
would create them for you.
However, there is no way at the moment to generate only the beans and
nothing else.

Hope that helps,

   Thomas

Pietro Federico <[EMAIL PROTECTED]> schrieb am 21.04.2005
11:27:16:

> Hi,
>
> I need something where I write a new simple XMLSchema and obtain
> automatically tables and javabeans.
> Then, receiving a piece of XML conforming the XMLSchema, have a unique
> way to save XML data to DB, probably using the beans. (I need the beans
> use the data afterwards)
>
> I'm trying to do a thing like the following:
>
> - having (quite simple) XML Schema definitions (that I can control)
> - automatically transform them to Torque XML Database Schemas
> - automatically obtain DB and JavaBeans with torque
>
> Then having a piece of XML conforming to a previously defined XMLSchema,
> create an initialize the corrisponfing JavaBean and use torque
> persistence to save it in DB.
>
> My idea is to use a unique XSL transform to obtaing XML Database schemas
> automatically and then use commons-digester to do the XML to javaBean
> mapping.
>
> If you know, are there any other projects doing something similar out
there?
>
> Pietro.-
>
>
> -
> 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: Bad Zip in download area

2005-04-20 Thread Thomas Fischer




Well, if somebody absolutely wants to use ant instead of maven, the ant
scripts contained  in Torque 3.1 still run with 3.1.. However, I'd
recommend to use maven.

   Thomas

Robert Kromkamp <[EMAIL PROTECTED]> schrieb am 20.04.2005 16:11:16:

> Hi,
>
> It's correct. Ant is replaced by maven in torque-3.1.1 you can read it
in:
>
> http://db.apache.org/torque/maven-howto.html
>
> Cheers,
> Robert
>
> -Original Message-
> From: Pietro Federico [mailto:[EMAIL PROTECTED]
> Sent: woensdag 20 april 2005 16:09
> To: torque-user@db.apache.org
> Subject: Bad Zip in download area
>
>
> hi All,
> I have noticed that in the download area the zip for torque-gen-3.1.1
> doesn't contain all the files, expecially for the build.xml ant script.
> Is that correct?
>
> Pietro.-
>
> -
> 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]



Antwort: connection recovery

2005-04-20 Thread Thomas Fischer





Hi,

looking in the code, Torque.shutdown() does not close the connection pools
it opened at init(). You would have to shutdown the pool manually.
Hoverer, it is not easy to do this. Currently, I found no way how you could
retrieve the Connection Pool from Torque, because the method
TorqueInstance.getDataSourceFactory(String), which is used by Torque to get
the data source, is protected.

Either you find a way to configure the pool such that it tests connections
before it hands them out (SharedPoolDataSource can do it, look at the dbcp
documentation in jakarta commons), or you have to get Torque's source, make
TorqueInstance.getDataSourceFactory(String) public, and rebuild it.

This is not the way Torque should behave in a case of shutdown. I have
added a bug report in scarab about this.

Thomas

"Jinsong Hu" <[EMAIL PROTECTED]> schrieb am 20.04.2005 07:41:23:

> Hi, There,
>   I have been using torque in our project.I am trying to get this to
work:
>
> 1. use Torque.init();
> 2. use the torque connections for various tasks.
> 3. shutdown the database manually. at this stage, no connection can be
used.
> 4. start database manually, and in the java code, try to use db
> connection again.
>
> what happens is that for oracle database, in step 4, the connection
> will work, and I
> can continue to select/insert data without special effort.
>
> but if the database is ms sql, then the connections will always
> fail, saying broken pipe.
>
> I have to restart my application to get connection work again.
>
> I wonder if in torque there is a method to ask the torque to re-
> establish db connection.
> it looks trying shutdown() then init() doesn't do the trick.
>
> I am using torque 3.1
>
>
> Jinsong


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



RE: Orcale, Criteria and Date

2005-04-19 Thread Thomas Fischer




Hi,

I am not sure whether this is exactly the same thing, but there is a
related issue in the issue tracker:

http://issues.apache.org/scarab/issues/id/TRQS284

you might want to add a comment to that and describe your problem there.
Create a login in scarab and request a role as observer in the module
Torque>Source to do that.
However, this is not yet fixed in CVS.

As for a temporary workaround, you might try to use Criteria.CUSTOM (as I
just learned this morning). See

http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgNo=4833

for details.
Unfortunately, this means to create DB-dependant code, but I do not see
another possibility at the moment :-(

   Thomas

"Bouvet Konsulent" <[EMAIL PROTECTED]> schrieb am 19.04.2005 10:22:53:

> hello list,
> I have been given the task to move an existing application using
> Torque 3.1 from Postgres to Oracle. I am new to Torque, so I am
> sorry if this question is insulting anyone ;-)
> I have re-generated the databases with "torque.databse=oracle" in
> the build.properties-file, the jdbc-connection is working fine etc.
>
> I am running the following code:
>
> Criteria crit = new Criteria();
> crit.add(DocumentPeer.IS_DELETED, 1);
> Object  o = (new Date(System.currentTimeMillis() - keeptime).toString());
> //Object  o = sdf.format(new Date(System.currentTimeMillis() -
keeptime));
> crit.add(DocumentPeer.CHANGED, o, Criteria.LESS_THAN);
> log("Criteria="+crit+", o="+o+", keeptime="+keeptime);
> DocumentPeer.doDelete(crit);
>
> which generates the following output:
>
> 2005-04-19 10:08:14,258 INFO  [org.jboss.web.localhost.Engine]
> StandardContext[/mywebapp]Criteria=Criteria:: document.
> CHANGED<=>document.CHANGED<'18.02.2005 09:08:14':  document.
> IS_DELETED<=>document.IS_DELETED=1:
> Current Query SQL (may not be complete or applicable): SELECT  FROM
> document WHERE document.CHANGED<'18.02.2005 09:08:14' AND document.
> IS_DELETED=1, o=18.02.2005 09:08:14, keeptime=518400
> 2005-04-19 10:08:14,265 ERROR [org.jboss.web.localhost.Engine]
> StandardContext[/mywebapp]IndexWorkerServlet:WorkerThread:
> updateFiles() :Unable to delete files
> java.sql.SQLException: ORA-01830: date format picture ends before
> converting entire input string
>
> I understand that Oracle does not like the date-format here, and if
> I were to run directly towards an Oracle database, I would use the
> TO_DATE function like this:
> TO_DATE('18.04.2005 09:08:14','DD.MM. HH.MI.SS')
>
> However, I am not able to do this here, as I thought Torque would
> take care of everything for me!?
> I see that Criteria also has an addDate-function, but this does not
> give me the option of adding time of day, only day, month and year.
>
> If anyone has a solution, I would highly appreciate it!
>
> /pj
>
>
>
> Statnett SF, Tel. head office +47 22527000, Enterprise No. NO 962
> 986 633 VAT, www.statnett.no, [EMAIL PROTECTED]
> _
>
> This e-mail and any attached files are confidential and may be
> legally privileged. If you have received this transmission in error
> please notify the sender by reply e-mail immediately and then delete
> the e-mail.
> E-mail transmission cannot be guaranteed to be secure or error free
> as information could be intercepted, corrupted, lost, destroyed,
> arrive late or incomplete. If verification is required please
> request a hard copy version. This e-mail message has been virus
> checked by the virus programs used by Statnett SF.
>
>
> -
> 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: Format of create-db.sql with Oracle.

2005-04-12 Thread Thomas Fischer




Laran,

which Torque version are you using ?
Can you please append a snippet of your schema.xml which produced this
particular line ?

   Thomas

Laran Evans <[EMAIL PROTECTED]> schrieb am 11.04.2005 20:15:34:

> Oracle create-db.sql is not right.
>
> It's creating the following line:
>
> FIN_COA_ACTIVE_IND VARCHAR2 (1) default ''N' ' NOT NULL,
>
> it should be:
>
> FIN_COA_ACTIVE_IND VARCHAR2 (1) default 'N' NOT NULL,
>
> The extra quotes are breaking the script.
>
> Is this a bug? Or have I just misconfigured something?
>
> Thanks.
>
>
> -
> 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: select max(column)

2005-04-06 Thread Thomas Fischer




Well, the reason why one cannot use XXXPeer.doSelect() to find out the
maximum value of a colum is that the XXX Object has not got a place to hold
the value of MAX(someColumn), at least not a place that Torque knows of.
This is independent of the type of the column. So one ends up using the
BasePeer.doSelectVillageRecords() methods.

The difference between criteria.and and Criteria.add is that Criteria.add()
never keeps a order of precedence of operators (such like (conditon1 and
(condition2 and condition3))), but Criteria.and does, if there exists
another condition for the specified column. But most of the time, they are
the same (see criteria Source code appended below).
I have never used Criteria.and myself. If you do not have a reason for
doing otherwise, use Criteria.add().

/**
 * This method adds a prepared Criterion object to the Criteria.
 * You can get a new, empty Criterion object with the
 * getNewCriterion() method. If a criterion for the requested column
 * already exists, it is "AND"ed to the existing criterion.
 * This is used as follows:
 *
 * 
 * 
 * Criteria crit = new Criteria();
 * Criteria.Criterion c = crit.getNewCriterion(BasePeer.ID, new
Integer(5),
 * Criteria.LESS_THAN);
 * crit.and(c);
 * 
 *
 * @param c A Criterion object
 * @return A modified Criteria object.
 */
public Criteria and(Criterion c)
{
Criterion oc = getCriterion(c.getTable() + '.' + c.getColumn());

if (oc == null)
{
add(c);
}
else
{
oc.and(c);
}
return this;
}


"jill han" <[EMAIL PROTECTED]> schrieb am 05.04.2005 23:08:14:

> I tried to get a max value of a column with type date.
> The codes are like:
>
> Criteria crit = new Criteria();
> crit.add(Peer.String, Object, Criteria.EQUAL);
> crit.addSelectColumn("MAX(" + Peer.aDate + ")");
> crit.add(Peer.String, Object, Criteria.EQUAL);
> List result = Peer.doSelect(crit);
>
> But it is not working.
> The exception says:
> Error: org.apache.torque.TorqueException: Illegal conversion:
> com.workingdogs.village.DataSetException: Invalid type for Integer
>
> Does it mean it is type related?
> Another question, what is the key difference between Criteria.add and
> Criteria.and?
>
> Thanks in advance.
>
> Jill
>
>
>
> -Original Message-
> From: Thomas Fischer [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 29, 2005 2:01 AM
> To: Apache Torque Users List
> Subject: RE: select max(column)
>
>
>
>
>
> Look in the wiki. Ther it is described how to select count(*) from a
> table.
> The same procedure can be used to find out "max(" + SomePeer.COLUMN_NAME
> +")";
>
> http://wiki.apache.org/db-torque/FrequentlyAskedQuestions#head-9317e897d
> 07dbd597993796d47bfbbe2443bc5bf
>
> Thomas
>
>
> "Kintzel Levente" <[EMAIL PROTECTED]> schrieb am 24.03.2005
> 14:19:30:
>
> >
> >Hi!
> >
> > I want to determine the max value of a column with Torque. How can I
> do
> > this? Thanx!
> >
> >  Levi Kintzel
> >
> >
> >
> >
> > -
> > 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]
>


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



RE: How to fetch the rows with Peer class

2005-04-05 Thread Thomas Fischer




Hi,

you can use the criteria.setLimit() and setOffset() methods to limit the
numbers of datasets to retrieve. Then you can iterate through the whole
table by increasing the offset in a loop, until you find no more datasets.

Hope that is what you were looking for.

 Thomas

Kenji Ichikawa <[EMAIL PROTECTED]> schrieb am 05.04.2005 04:00:30:

>
> Hello, I'm ichikawa.
>
> I would like to implement to fetch the rows with Peer class of Torque,
> becase the table row size is too large, so probably OutOfMemoryError
> will heppen if the following code is executed.
>
>
>
> Criteria criteria = new Criteria();
> List list = MyTablePeer.doSelect( criteria );
>
>
>
> I would like to know how to fetch the rows with Peer class,
> it's like the following code of JDBC implementation.
>
>
>
> Statement st = conn.createStatement();
> st.setFetchSize(50);
> ResultSet rs = st.executeQuery("SELECT * FROM my_table");
> while (rs.next()) {
> System.out.print("a row was returned.");
> }
> rs.close();
> st.close();
>
>
>
> If you know how to do, Could you give me advice ?
>
>
>
>
>
> ---
> Kenji Ichikawa
> mailto:[EMAIL PROTECTED]
> http://www.seta.co.jp/
>
>
> -
> 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: create-db.sql and default database

2005-04-01 Thread Thomas Fischer
Laran,
you have used 'default' as database name. 'default' is a reseverd word in 
Mysql (and in many other databases) and should not be used as name of a 
database or table or column.

Please choose another name.
Thomas
On Fri, 1 Apr 2005, Laran Evans wrote:
I'm running Torque 3.1.1 (torque itself and generator) against MySQL 
4.1.10a-nt.

When I run create-db the sql file that is generated contains the text:
---
drop database if exists default;
create database default;
---
When I run the target I get :
---
[sql] Failed to execute:  drop database if exists default
[sql] java.sql.SQLException: You have an error in your SQL syntax; check t
he manual that corresponds to your MySQL server version for the right syntax 
to
use near 'default' at line 1
[sql] Failed to execute:  create database default
[sql] java.sql.SQLException: You have an error in your SQL syntax; check t
he manual that corresponds to your MySQL server version for the right syntax 
to
use near 'default' at line 1
[sql] 0 of 2 SQL statements executed successfully

Is there a way around this? I have set the name of my schema in the build 
file.

Thanks
-
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: [Encoding] Oracle 8.1.7 and Jdk 1.4.1_07

2005-04-01 Thread Thomas Fischer





Hello Raphael,

character encoding problems are very ugly in my experience. They are hard
to find by the user, and even harder by remote advice.

The only thing I can advice you is to pluck the process apart, and find out
exactly where the problem sits, e.g. by inserting and retrieving via sql
console as compared to insert by jdbc and retrieving via sql console, and
so on...

One point worth while checking is that the database encoding is such that
it can actually store accentuated characters correctly.

I am quite sure that it is not a Torque problem.
One thing you might want to know for further research is that Torque uses
prepared statements for all inserts.

Thomas

Raphaël Piéroni <[EMAIL PROTECTED]> schrieb am 31.03.2005 16:15:36:

> Hello,
>
> I'm currently having some troubles using Torque 3.0 on linux (debian
> stable kernel 2.4.20) with the Sun jdk (1.4.1_07-b02).
>
> I now present the problem :
> i use the maven torque plugin 3.0 to insert sql files in the database
> (when i cat those files, i can see correctly the accentuated
> characters)
>
> then i use junit tests to check the retreiving of values in the
> database
>
> i systematically had the error
> expected <...?> but was <...?>
>
> i know it is an encoding problem, but i cannot figure how to get rid of
> it.
>
> may someone please help me.
>
> Best regards
>
> Raphaël
>
> 
> | Raphaël Piéroni  |
> | 33+ 223 351 354  |
> | mailto:[EMAIL PROTECTED]|
> | http://www.dexem.com |
> | mailing:[EMAIL PROTECTED] |
> 
>
>
>
>
>
>
> __
> Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour
> vos mails !
> Créez votre Yahoo! Mail sur http://fr.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]



RE: Criteria.setIgnoreCase() and boolean fields?

2005-04-01 Thread Thomas Fischer




Robert,

what I still do not understand is why upper(apd_notification.IS_VALID) does
not work. I am no postgresql guru and I have no postgresql implementation
available now, but I thought that one can do an upper() on a char column.

can you do something like
describe (Apd_Notification);
(or whatever that command is in postgresql) in a postgresql console and see
if the IS_VALID column is indeed a char ?

If not, can you regenerate the sql to create the db and see what type the
IS_VALID column in Apd_Notification is generated ?
If yes, can you create a test table in postgresql with a char column and
see whether upper() works on that column ?

Thomas


Robert Bowen <[EMAIL PROTECTED]> schrieb am 01.04.2005 10:36:49:

> Hello Thomas, sorry about the delay.
>
> In my templates/sql/base/postgresql/db.props I have:
>
> BOOLEANCHAR = char
>
> In my build.properties I have:
>
> torque.database = postgresql
>
> My Java is the following:
>
> criteria.add(ApdNotificationPeer.IS_VALID, false);
>
> And the generated SQL is this:
>
> SELECT * FROM apd_notification
> WHERE UPPER(apd_notification.IS_VALID)=UPPER(0)
>
> If I change the Java to:
>
> criteria.add(ApdNotificationPeer.IS_VALID, "false");
>
> The Sql is:
>
> UPPER(apd_notification.IS_VALID)=UPPER('false')
>
> And the error is the same -- can't perform an UPPER()
> on a boolean field. So it seems the problem isn't with
> the UPPER(0) or (UPPER('false') but rather the
> UPPER(apd_notification.IS_VALID).
>
> I'd *love* to have a workaround ... Unfortunately I
> can't really just piece together a SQL statement and
> call the Peer.execute() because the SQL is very
> long.
>
> Still looking ...
> Bob
>
>
> --- Thomas Fischer <[EMAIL PROTECTED]> wrote:
>
> >
> >
> >
> >
> > Robert,
> >
> > please omit also the port number:
> >
> >
> http://issues.apache.org/scarab/issues/template/Confirm.vm/confirm/...
> >
> > Can you please check your db.props file in the
> > generator ? There it should
> > say
> > BOOLEANCHAR = char
> >
> > so the column in the database should be a char
> > column, and the upper()
> > should work.
> >
> > Are you sure you have set
> >
> > torque.database = postgresql
> >
> > in your generator properties file ?
> >
> >Thomas
> >
> >
> > Robert Bowen <[EMAIL PROTECTED]> schrieb am 31.03.2005
> > 12:19:52:
> >
> > > Hi Thomas,
> > >
> > > I am using Postgre 8.0.1 for Windoze, Torque 3.1.
> > >
> > > In my Torque schema I use data type BOOLEANCHAR,
> > but
> > > the field in the database itself is boolean. I
> > don't
> > > think there is a 'boolchar' option, or anything
> > > similar in Postgre. I guess that's why it's
> > crashing.
> > > Ideally Torque would recognize that it is a
> > boolean
> > > field and not try to perform an UPPER() on it.
> > >
> > > Incidentally, I registered for an account on
> > scarab
> > > and got a message to confirm my subscription.
> > > Unfortunately the link sent in the confirm email
> > is
> > > wrong:
> > >
> > >
> >
> http://localhost:38080/scarab/issues/template/Confirm.vm/confirm/...
> > >
> > > localhost!?
> > >
> > > I tried putting issues.apache.org and
> > www.apache.org
> > > instead of localhost but it doesn't work.
> > >
> > > Any idea?
> > >
> > > Tanky,
> > > Bob
> > >
> > >
> > > @seitenbau.net> wrote:
> > > >
> > > >
> > > >
> > > >
> > > > Robert,
> > > >
> > > > Which database and Torque version are you using
> > ?
> > > > To my knowledge, booleanchar is usually
> > implemented
> > > > as a char field in the
> > > > database (at least for oracle and Torque 3.1.1),
> > so
> > > > upper should work
> > > > there.
> > > >
> > > > by the way, Scarab is the issue tracker for
> > torqe:
> > > > http://issues.apache.org/scarab/issues
> > > > request a role as observer for Torque->Source
> > and
> > > > then you are able to
> > > > create issues
> > > >
> > > >  Thomas
> > > >
> > > >
> > > >
> > > > Robert Bowen <[EMAIL PROTE

RE: sql/db-init/Control.vm & ResourceNotFoundException

2005-04-01 Thread Thomas Fischer




Laran,

which database are you using (the torque.database setting in the
build.properties of the generator) ? And which Torque version are you using
?

  Thomas

"Laran Evans" <[EMAIL PROTECTED]> schrieb am 31.03.2005 21:01:01:

> I get this when running the create-db Ant task.
>
> org.apache.velocity.exception.ResourceNotFoundException: Unable to find
> resource
>  'sql/db-init/Control.vm'
>
> The torque and torque-gen .jars are in my classpath.  I've tried with
both
> torque.useClasspath=true and torque.useClasspath=false. Both failed.
>
> Any suggestions?
>
> --
> Laran Evans - Cornell University
> p: (607) 255-6864 f: (607) 255-0327
>
>
> -
> 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.setIgnoreCase() and boolean fields?

2005-03-31 Thread Thomas Fischer




Robert,

please omit also the port number:

http://issues.apache.org/scarab/issues/template/Confirm.vm/confirm/...

Can you please check your db.props file in the generator ? There it should
say
BOOLEANCHAR = char

so the column in the database should be a char column, and the upper()
should work.

Are you sure you have set

torque.database = postgresql

in your generator properties file ?

   Thomas


Robert Bowen <[EMAIL PROTECTED]> schrieb am 31.03.2005 12:19:52:

> Hi Thomas,
>
> I am using Postgre 8.0.1 for Windoze, Torque 3.1.
>
> In my Torque schema I use data type BOOLEANCHAR, but
> the field in the database itself is boolean. I don't
> think there is a 'boolchar' option, or anything
> similar in Postgre. I guess that's why it's crashing.
> Ideally Torque would recognize that it is a boolean
> field and not try to perform an UPPER() on it.
>
> Incidentally, I registered for an account on scarab
> and got a message to confirm my subscription.
> Unfortunately the link sent in the confirm email is
> wrong:
>
> http://localhost:38080/scarab/issues/template/Confirm.vm/confirm/...
>
> localhost!?
>
> I tried putting issues.apache.org and www.apache.org
> instead of localhost but it doesn't work.
>
> Any idea?
>
> Tanky,
> Bob
>
>
> @seitenbau.net> wrote:
> >
> >
> >
> >
> > Robert,
> >
> > Which database and Torque version are you using ?
> > To my knowledge, booleanchar is usually implemented
> > as a char field in the
> > database (at least for oracle and Torque 3.1.1), so
> > upper should work
> > there.
> >
> > by the way, Scarab is the issue tracker for torqe:
> > http://issues.apache.org/scarab/issues
> > request a role as observer for Torque->Source and
> > then you are able to
> > create issues
> >
> >  Thomas
> >
> >
> >
> > Robert Bowen <[EMAIL PROTECTED]> schrieb am 31.03.2005
> > 11:03:00:
> >
> > > I *am* using BOOLEANCHAR, and it still doesn't
> > work.
> > >
> > > I'll have to take a look at scarab, don't know
> > what it
> > > is!
> > >
> > > syg
> > >
> > > --- Thomas Fischer <[EMAIL PROTECTED]> wrote:
> > > >
> > > >
> > > >
> > > >
> > > > Sounds like a bug to me. Can you please enter
> > this
> > > > in scarab, including the
> > > > database and the torque version you use ?
> > > >
> > > > As a workaround, you can try to change your
> > > > datamodel such that you use the
> > > > data type booleanchar instead of boolean.
> > > >
> > > >Thomas
> > > >
> > > > Robert Bowen <[EMAIL PROTECTED]> schrieb am
> > 31.03.2005
> > > > 10:02:13:
> > > >
> > > > > Hello all. I have a class that sets a whole
> > bunch
> > > > of
> > > > > conditions for a search. Most of the fields I
> > > > search
> > > > > on are text so using Criteria.setIgnoreCase()
> > has
> > > > been
> > > > > working.
> > > > >
> > > > > I recently added another search criteria, on a
> > > > boolean
> > > > > field:
> > > > >
> > > > > criteria.add(NotificationPeer.IS_COMPLETE,
> > false);
> > > > >
> > > > > But since the setIgnoreCase() is set to true
> > for
> > > > the
> > > > > Criteria, Torque tries to do an UPPER() on a
> > > > boolean
> > > > > field!
> > > > >
> > > > > Can I avoid this somehow? Currently it crashes
> > in
> > > > a
> > > > > rather ugly way ...
> > > > >
> > > > > Thanks!
> > > > > syg
> > > > >
> > > > >
> > > > >
> > > > > __
> > > > > Do you Yahoo!?
> > > > > Make Yahoo! your home page
> > > > > http://www.yahoo.com/r/hs
> > > > >
> > > > >
> > > >
> > >
> >
> -
> > > > > To unsubscribe, e-mail:
> > > > [EMAIL PROTECTED]
> > > > > For additional commands, e-mail:
> > > > [EMAIL PROTECTED]
> > > > >
> > > >
> > > >
> &

RE: Criteria.setIgnoreCase() and boolean fields?

2005-03-31 Thread Thomas Fischer




Robert,

Which database and Torque version are you using ?
To my knowledge, booleanchar is usually implemented as a char field in the
database (at least for oracle and Torque 3.1.1), so upper should work
there.

by the way, Scarab is the issue tracker for torqe:
http://issues.apache.org/scarab/issues
request a role as observer for Torque->Source and then you are able to
create issues

 Thomas



Robert Bowen <[EMAIL PROTECTED]> schrieb am 31.03.2005 11:03:00:

> I *am* using BOOLEANCHAR, and it still doesn't work.
>
> I'll have to take a look at scarab, don't know what it
> is!
>
> syg
>
> --- Thomas Fischer <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> > Sounds like a bug to me. Can you please enter this
> > in scarab, including the
> > database and the torque version you use ?
> >
> > As a workaround, you can try to change your
> > datamodel such that you use the
> > data type booleanchar instead of boolean.
> >
> >Thomas
> >
> > Robert Bowen <[EMAIL PROTECTED]> schrieb am 31.03.2005
> > 10:02:13:
> >
> > > Hello all. I have a class that sets a whole bunch
> > of
> > > conditions for a search. Most of the fields I
> > search
> > > on are text so using Criteria.setIgnoreCase() has
> > been
> > > working.
> > >
> > > I recently added another search criteria, on a
> > boolean
> > > field:
> > >
> > > criteria.add(NotificationPeer.IS_COMPLETE, false);
> > >
> > > But since the setIgnoreCase() is set to true for
> > the
> > > Criteria, Torque tries to do an UPPER() on a
> > boolean
> > > field!
> > >
> > > Can I avoid this somehow? Currently it crashes in
> > a
> > > rather ugly way ...
> > >
> > > Thanks!
> > > syg
> > >
> > >
> > >
> > > __
> > > Do you Yahoo!?
> > > Make Yahoo! your home page
> > > http://www.yahoo.com/r/hs
> > >
> > >
> >
> -
> > > 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!?
> Yahoo! Small Business - Try our new resources site!
> http://smallbusiness.yahoo.com/resources/
>
> -
> 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.setIgnoreCase() and boolean fields?

2005-03-31 Thread Thomas Fischer




Sounds like a bug to me. Can you please enter this in scarab, including the
database and the torque version you use ?

As a workaround, you can try to change your datamodel such that you use the
data type booleanchar instead of boolean.

   Thomas

Robert Bowen <[EMAIL PROTECTED]> schrieb am 31.03.2005 10:02:13:

> Hello all. I have a class that sets a whole bunch of
> conditions for a search. Most of the fields I search
> on are text so using Criteria.setIgnoreCase() has been
> working.
>
> I recently added another search criteria, on a boolean
> field:
>
> criteria.add(NotificationPeer.IS_COMPLETE, false);
>
> But since the setIgnoreCase() is set to true for the
> Criteria, Torque tries to do an UPPER() on a boolean
> field!
>
> Can I avoid this somehow? Currently it crashes in a
> rather ugly way ...
>
> Thanks!
> syg
>
>
>
> __
> Do you Yahoo!?
> Make Yahoo! your home page
> http://www.yahoo.com/r/hs
>
> -
> 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: DATE / DATETIME

2005-03-30 Thread Thomas Fischer




In the generator templates, edit the db.props file for mysql and replace
the line

DATE = DATETIME

by

DATE = DATE

 Thomas


"Aaron Loucks" <[EMAIL PROTECTED]> schrieb am 30.03.2005 22:43:58:

> Is there a way to force the column type to DATE rather than DATETIME
> with mysql? In my schema I have my column type set to "DATE" but the
> generated sql always specifies the column as a DATETIME.
>
> Aaron Loucks
> Web Developer
> Gardner, Inc.
> 3641 Interchange Road
> Columbus, OH 43204
> 614.456.3492
>
>
> -
> 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: torque and xmltype

2005-03-30 Thread Thomas Fischer




Erik,

xmltype it is not supported out of the box.

if you use any release up to 3.1.1, you have to change the db.props file in
the sql/base/database_name (in your case sql/base/oracle) and map a
datatype to sqltype.
I have no idea whether you can add a new type (this would be a clean
solution), or whether you have to "abuse" an existing one (e. g. the "char"
type). Make sure this datataype is not yet used in your application !!!

If it works, please let us know how you did it.

  Thomas

"Dressler, Erik(externe MA)" <[EMAIL PROTECTED]> schrieb am
30.03.2005 10:22:26:

>
> hi, everybody!
>
> i'm using torque 3.1.1 and oracle 9i. in my project-schema.xml-file i
tried
> to declare a column as a "xmltype"-column. the "maven torque"-goal
failed.
>
> is it anyhow possible to use the "new" datatype "xmltype" with torque?
>
> greetz, erik
>
> *  *  *  *  *  *  D I S C L A I M E R  *  *  *  *  *  *  *
>
> This message is confidential and intended for the named addressee(s)
only.
> If you are not the intended recipient, please contact the sender by
E-Mail
> return and then delete this message from your system. You should not copy
> or use it or disclose its contents to any other person.
>
> If any part of this message is illegible or if you suspect that the
message
> may have been intercepted or amended, please contact the sender.
> Dresdner Bank Luxembourg S.A. cannot accept any responsibility for the
> accuracy or completeness of this message without further investigation.
>
>
>
> -
> 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: oracle 9i and torque

2005-03-29 Thread Thomas Fischer




I have an oracle9i running with just Torque, using the
SharedPoolDataSourceFactory.

I agree, if time has a larger priority than the more stable pool, use the
old one. Also, the rest of the application should be insensitive to which
pool is used, so you can always change it later without changing anything
else.

 Thomas

"Dressler, Erik(externe MA)" <[EMAIL PROTECTED]> schrieb am
29.03.2005 10:14:47:

>
> i wasted more than a week of my life to get the project started! by the
way,
> i am writing my diplom-work and i have only three months left. if there
is
> any time in the end, i will try to use the new datasourcefactory. now i
take
> a look at the web-site, which you've posted.
>
> do you have an oracle 9i database running with turbine and torque?
>
> > -----Original Message-
> > From:   Thomas Fischer [SMTP:[EMAIL PROTECTED]
> > Sent:   29 March 2005 09:50
> > To:   Apache Torque Users List
> > Subject:   RE: oracle 9i and torque
> >
> >
> >
> >
> >
> > Erik,
> >
> > I am not sure that you will get lucky with the old DataSourceFacory. It
> > will be removed in the next release. If I were you, I would not use it,
if
> > you want to use the system in production.
> >
> > It is true that some of the documentation still describe the old
> > properties. However, if you look at
> > http://jakarta.apache.org/commons/dbcp/configuration.html
> > you can find all the properties of the new pool.
> >
> > It might also be that Turbine passes the wrong properties to Torque,
but I
> > have no experience with Turbine, so I cannot help you there.
> >
> >Thomas
> >
> >
> > "Dressler, Erik(externe MA)" <[EMAIL PROTECTED]> schrieb
am
> > 29.03.2005 09:35:03:
> >
> > >
> > > hi, thomas!
> > >
> > > i solved the problem after a few days!! :)
> > >
> > > i changed the datasourcefactory. instead of the new
> > > "SharedPoolDataSourceFactory", i took the the deprecated
> > > "TorqueDataSourceFactory"!!! from that point i got "ora-xxx"-error
> > messages
> > > and i knew i was on the right way. in my opinion the torque-website
> > should
> > > be updated and improved!
> > >
> > > greets from luxembourg, erik
> > >
> > > > -Original Message-
> > > > From:   Thomas Fischer [SMTP:[EMAIL PROTECTED]
> > > > Sent:   29 March 2005 09:22
> > > > To:   Apache Torque Users List
> > > > Subject:   RE: oracle 9i and torque
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Hi,
> > > >
> > > > seems that your database connection does not work.
> > > > Are you sure you have the right SID, username and password ? Also,
a
> > > > firewall might be problematic...
> > > >
> > > >  Thomas
> > > >
> > > > "Dressler, Erik(externe MA)" <[EMAIL PROTECTED]>
schrieb
> > am
> > > > 18.03.2005 15:15:30:
> > > >
> > > > >
> > > > > hello, everybody!
> > > > >
> > > > > i have a big problem! i wasted days of my life trying to get
> > turbine,
> > > > torque
> > > > > and oracle started! i'm a little bit confused now. so i need your
> > > > help!!!
> > > > >
> > > > > i'm using:
> > > > > turbine 2.3.1
> > > > > torque 3.1.1
> > > > > oracle 9i
> > > > > java 1.4
> > > > > tomcat 5.0.28
> > > > > maven 1.0.2
> > > > >
> > > > > my build.properties:
> > > > >
> > > > > #
> > > >
> >

> > > > > # P A R A M E T E R   F O R   B U I L D I N G
> > > > > #
> > > > > # $Id: build.properties,v 1.3 2004/10/31 16:11:36 henning Exp $
> > > > > #
> > > > > #
> > > >
> >

> > > > >
> > > > > project.home = c:/Diplomarbeit/portal01
> > > > >
> > > > > #
> > > > > # Application Server configuration
> > > > > #
> > > > > maven.appserver.home =  C:/Programme/Apache/Tomcat5.0/
> > > > > maven.appserver.

RE: select max(column)

2005-03-29 Thread Thomas Fischer




Look in the wiki. Ther it is described how to select count(*) from a table.
The same procedure can be used to find out "max(" + SomePeer.COLUMN_NAME
+")";

http://wiki.apache.org/db-torque/FrequentlyAskedQuestions#head-9317e897d07dbd597993796d47bfbbe2443bc5bf

Thomas


"Kintzel Levente" <[EMAIL PROTECTED]> schrieb am 24.03.2005
14:19:30:

>
>Hi!
>
> I want to determine the max value of a column with Torque. How can I do
> this? Thanx!
>
>  Levi Kintzel
>
>
>
>
> -
> 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: oracle 9i and torque

2005-03-28 Thread Thomas Fischer




Erik,

I am not sure that you will get lucky with the old DataSourceFacory. It
will be removed in the next release. If I were you, I would not use it, if
you want to use the system in production.

It is true that some of the documentation still describe the old
properties. However, if you look at
http://jakarta.apache.org/commons/dbcp/configuration.html
you can find all the properties of the new pool.

It might also be that Turbine passes the wrong properties to Torque, but I
have no experience with Turbine, so I cannot help you there.

   Thomas


"Dressler, Erik(externe MA)" <[EMAIL PROTECTED]> schrieb am
29.03.2005 09:35:03:

>
> hi, thomas!
>
> i solved the problem after a few days!! :)
>
> i changed the datasourcefactory. instead of the new
> "SharedPoolDataSourceFactory", i took the the deprecated
> "TorqueDataSourceFactory"!!! from that point i got "ora-xxx"-error
messages
> and i knew i was on the right way. in my opinion the torque-website
should
> be updated and improved!
>
> greets from luxembourg, erik
>
> > -Original Message-
> > From:   Thomas Fischer [SMTP:[EMAIL PROTECTED]
> > Sent:   29 March 2005 09:22
> > To:   Apache Torque Users List
> > Subject:   RE: oracle 9i and torque
> >
> >
> >
> >
> >
> > Hi,
> >
> > seems that your database connection does not work.
> > Are you sure you have the right SID, username and password ? Also, a
> > firewall might be problematic...
> >
> >  Thomas
> >
> > "Dressler, Erik(externe MA)" <[EMAIL PROTECTED]> schrieb
am
> > 18.03.2005 15:15:30:
> >
> > >
> > > hello, everybody!
> > >
> > > i have a big problem! i wasted days of my life trying to get turbine,
> > torque
> > > and oracle started! i'm a little bit confused now. so i need your
> > help!!!
> > >
> > > i'm using:
> > > turbine 2.3.1
> > > torque 3.1.1
> > > oracle 9i
> > > java 1.4
> > > tomcat 5.0.28
> > > maven 1.0.2
> > >
> > > my build.properties:
> > >
> > > #
> >

> > > # P A R A M E T E R   F O R   B U I L D I N G
> > > #
> > > # $Id: build.properties,v 1.3 2004/10/31 16:11:36 henning Exp $
> > > #
> > > #
> >

> > >
> > > project.home = c:/Diplomarbeit/portal01
> > >
> > > #
> > > # Application Server configuration
> > > #
> > > maven.appserver.home =  C:/Programme/Apache/Tomcat5.0/
> > > maven.appserver.name =  tomcat
> > >
> > > #
> > > # Initial ID values for the ID_TABLE
> > > #
> > > initialID = 1100
> > > initialIDValue = 100
> > > initialIDStep = 10
> > >
> > > torque.database.driver = oracle.jdbc.driver.OracleDriver
> > > torque.database.user = portal01
> > > torque.database.password = portal01
> > > torque.database.buildUrl =
jdbc:oracle:thin:@130.3.15.173:1530:EAITEST9
> > > torque.database.createUrl =
jdbc:oracle:thin:@130.3.15.173:1530:EAITEST9
> > >
> > > my torque-relevant entries in TurbineResources.properties:
> > >
> > > # Torque
> > >
> > > torque.database.default.driver = oracle.jdbc.driver.OracleDriver
> > > torque.database.default.url =
> > jdbc:oracle:thin:@130.3.15.173:1530:EAITEST9
> > > torque.database.default.username = portal01
> > > torque.database.default.password = portal01
> > >
> > > torque.database.adapter = oracle
> > > torque.database.adapter.oracle = oracle.jdbc.driver.OracleDriver
> > >
> > > my Torque.properties:
> > >
> > > #
> > > # application database
> > > #
> > > torque.database.default = portal01
> > > torque.database.portal01.adapter = oracle
> > > torque.dsfactory.portal01.factory =
> > > org.apache.torque.dsfactory.SharedPoolDataSourceFactory
> > > torque.dsfactory.portal01.connection.driver =
> > > oracle.jdbc.driver.OracleDriver
> > > torque.dsfactory.portal01.connection.url =
> > > jdbc:oracle:thin:@130.3.15.173:1530:EAITEST9
> > > torque.dsfactory.portal01.connection.user =   portal01
> > > torque.dsfactory.portal01.connection.password =   portal01
> > >
> > > torque.dsfactory.portal01.pool.maxActive = 30
> > > torque.dsfactory.portal01.pool.testOnBorr

RE: Problem with Criteria After Deserializing

2005-03-28 Thread Thomas Fischer




Hi,

I do not have any experience with serialisation and deserialisation. I did
not find any custom serialize() and deserialize() methods in criteria, but
I thought the JDK handles this automatically. Ist that not true ?

By the way, I do not see the Criteria object as a long-lived object. They
tend to get modified in Queries, so I usually just throw them away after
they are used.

 Thomas

Robert Kromkamp <[EMAIL PROTECTED]> schrieb am 29.03.2005 09:20:56:

> I had the same problem. To solve it I've written my own serialize and
> deserialize functions for Criteria.java for torque 3.1.1:
>
> /** Serialize this Object in a manner which is binary-compatible with the
> JDK */
> private void writeObject(ObjectOutputStream s) throws IOException {
>  ObjectOutputStream.PutField oFields;
>  Iterator it = entrySet().iterator();
>  Map.Entry oEntry;
>  oFields = s.putFields();
>
>  oFields.put("offset", this.offset);
>  oFields.put("limit", this.limit);
>  oFields.put("ignoreCase", ignoreCase);
>  oFields.put("singleRecord", isSingleRecord());
>  oFields.put("cascade", isCascade());
>  oFields.put("dbName", getDbName());
>
>  oFields.put("selectModifiers",
> getSelectModifiers());
>  oFields.put("selectColumns", getSelectColumns());
>  oFields.put("orderByColumns", getOrderByColumns());
>
>  oFields.put("groupByColumns", getGroupByColumns());
>  oFields.put("having", getHaving());
>  oFields.put("asColumns", getAsColumns());
>  oFields.put("joinL", getJoinL());
>  oFields.put("joinR", getJoinR());
>  oFields.put("aliases", this.aliases);
>
>  oFields.put("useTransaction", this.useTransaction);
>  oFields.put("originalDbName", this.originalDbName);
>
>  s.writeFields();
>
>  //s.writeInt(capacity);
>  s.writeInt(super.size());
>  while (it.hasNext())
>  {
> oEntry = (Map.Entry) it.next();
> String key = (String)oEntry.getKey();
> s.writeObject(key);
> s.writeObject(oEntry.getValue());
>
>  if (this.containsKey(key)){
>  Criterion aCriterion =
> this.getCriterion(key);
>  s.writeObject(aCriterion);
>  } else {
>  s.writeObject(new Boolean(false));
>  }
>  }
> }
>
>
>
> /** Deserialize this Object in a manner which is binary-compatible
with
> the JDK */
>
> private void readObject(ObjectInputStream s) throws IOException,
> ClassNotFoundException
> {
>   int i;
>   int iLen;
>   Object oKey, oValue, oCriterion;
>   ObjectInputStream.GetField oFields;
>   oFields = s.readFields();
>
>  this.offset = oFields.get("offset", 0);
>  this.limit = oFields.get("limit", -1);
>  ignoreCase = oFields.get("ignoreCase", false);
>  singleRecord = oFields.get("singleRecord", false);
>  cascade = oFields.get("cascade", false);
>  dbName = (String) oFields.get("dbName", "");
>  selectModifiers = (UniqueList)
> oFields.get("selectModifiers", new UniqueList());
>  selectColumns = (UniqueList)
> oFields.get("selectColumns", new UniqueList());
>  orderByColumns = (UniqueList)
> oFields.get("orderByColumns", new UniqueList());
>
>  groupByColumns =
> (UniqueList)oFields.get("groupByColumns", new UniqueList());
>
>  having = (Criteria.Criterion)oFields.get("having",
> null);
>  asColumns = (Hashtable)oFields.get("asColumns",
> null);
>  joinL = (ArrayList)oFields.get("joinL", null);
>  joinR = (ArrayList)oFields.get("joinR", null);
>  aliases = (HashMap)oFields.get("aliases", null);
>
>  useTransaction = oFields.get("useTransaction",
> false);
>  originalDbName =
> (String)oFields.get("originalDbName", "");
>
> iLen = s.readInt();
>
> for (i = 0; i < iLen; i++){
>oKey = s.readObject();
>oValue = s.readObject();
>super.put(oKey, oValue);
>
>oCriterion = s.readObject();
>if (oCriterion instanceof
> org.apache.torque.util.Criteria.Criterion){
>   Criterion criterion = (Criterion)
> oCriterion;
>   add(criterion);
>}
>  }
> }
>
>
> -Original Message-
> From: Joe Morrogh [mailto:[EMAIL PROTECTED]
> Sent: maandag 28 maart 2005 3:54
> To: torque-user@db.apache.org
> Subject: Problem with Criteria After Deserializing
>
>
> Hi,
>
> I've got a Torque 3.0 application (part of a Turbine 2.2 webapp) and I
want
> to add persistent query
> funtionality to it.  Since the Torque Criteria class already represents a

> set of query criteria, and is serializable, it seems logical to persist
> instances of this class for my purposes.  The problem I'

RE: Error while using oracle.

2005-03-28 Thread Thomas Fischer




Hi,

The null comes in from where the method is called:

public String getIDMethodSQL(Object sequenceName)
{
return ("select " + sequenceName + ".nextval from dual");
}

It seems that in CVS version, the method where it is called from is
IdGenerator.getIdAsXXX(), but I have not found any references to these
functions.
Can you put a breakpoint to the getIDMethodSQL, and send the stack trace
from that position ? I'm most interested in where the
IdGenerator.getIdAsXXX() is called from.

By the way, which Torque version are you using ?

   Thomas

Sriram Puvvada <[EMAIL PROTECTED]> schrieb am 21.03.2005 16:17:37:

> Hi all,
>
> We are using torque for almost 2 years. Our application DB is
MS
> SQL Server and now we are migrating into Oracle. In MS SQL Sever we used
all
> of our table's primary keys is Identity column so we used Sequences and
Pre
> Insert Triggers in Oracle. When we tried to insert data into tables we
are
> getting the following error
>
>
>
> java.sql.SQLException: ORA-00923: FROM keyword not found where expected
>
> at
> oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
>
> at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
>
> at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
>
> at
oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
>
> at
> oracle.jdbc.ttc7.TTC7Protocol.parseExecuteDescribe(TTC7Protocol.java:830)
>
> at
>
oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.java:2391)

>
> at
>
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java

> :2672)
>
> at
> oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:572)
>
> at com.workingdogs.village.QueryDataSet.(Unknown
Source)
>
> at
>
org.apache.torque.oid.SequenceIdGenerator.getIdAsVillageValue(SequenceIdGene

> rator.java:195)
>
> at
>
org.apache.torque.oid.SequenceIdGenerator.getIdAsBigDecimal(SequenceIdGenera

> tor.java:132)
>
> at
org.apache.torque.util.BasePeer.doInsert(BasePeer.java:702)
>
> at
>
com.profile.prosaim.om.BaseAuditTrailPeer.doInsert(BaseAuditTrailPeer.java:2

> 28)
>
> at
>
com.profile.prosaim.om.BaseAuditTrailPeer.doInsert(BaseAuditTrailPeer.java:5

> 87)
>
> at
> com.profile.prosaim.om.BaseAuditTrail.save(BaseAuditTrail.java:622)
>
> at
> com.profile.prosaim.om.BaseAuditTrail.save(BaseAuditTrail.java:584)
>
> at
> com.profile.prosaim.om.BaseAuditTrail.save(BaseAuditTrail.java:564)
>
> at
> com.profile.prosaim.web.util.RunData.performLogin(RunData.java:651)
>
> at com.profile.prosaim.web.Login.doGet(Login.java:131)
>
> at
> com.profile.prosaim.web.WebApplication.doPost(WebApplication.java:172)
>
> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
>
> at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>
> at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
>
> at
> jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
>
> at
> jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:252)
>
> at
> jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
>
> at
> jrun.servlet.http.WebService.invokeRunnable(WebService.java:168)
>
> at
>
jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451

> )
>
> at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
>
> Put on debug using torque source we found that
>
> In class DBOracle the following method was returing null for sequence
which
> was throwing the error.
>
>
>
> public String getIDMethodSQL(Object sequenceName)
>
> {
>
> return ("select " + sequenceName + ".nextval from dual");
>
> }
>
>
>
> Any help in solving this issue will be greatly appreciated
>
>
>
> Sriram..
>
>
>


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



RE: oracle 9i and torque

2005-03-28 Thread Thomas Fischer




Hi,

seems that your database connection does not work.
Are you sure you have the right SID, username and password ? Also, a
firewall might be problematic...

 Thomas

"Dressler, Erik(externe MA)" <[EMAIL PROTECTED]> schrieb am
18.03.2005 15:15:30:

>
> hello, everybody!
>
> i have a big problem! i wasted days of my life trying to get turbine,
torque
> and oracle started! i'm a little bit confused now. so i need your help!!!
>
> i'm using:
> turbine 2.3.1
> torque 3.1.1
> oracle 9i
> java 1.4
> tomcat 5.0.28
> maven 1.0.2
>
> my build.properties:
>
> #

> # P A R A M E T E R   F O R   B U I L D I N G
> #
> # $Id: build.properties,v 1.3 2004/10/31 16:11:36 henning Exp $
> #
> #

>
> project.home = c:/Diplomarbeit/portal01
>
> #
> # Application Server configuration
> #
> maven.appserver.home =  C:/Programme/Apache/Tomcat5.0/
> maven.appserver.name =  tomcat
>
> #
> # Initial ID values for the ID_TABLE
> #
> initialID = 1100
> initialIDValue = 100
> initialIDStep = 10
>
> torque.database.driver = oracle.jdbc.driver.OracleDriver
> torque.database.user = portal01
> torque.database.password = portal01
> torque.database.buildUrl = jdbc:oracle:thin:@130.3.15.173:1530:EAITEST9
> torque.database.createUrl = jdbc:oracle:thin:@130.3.15.173:1530:EAITEST9
>
> my torque-relevant entries in TurbineResources.properties:
>
> # Torque
>
> torque.database.default.driver = oracle.jdbc.driver.OracleDriver
> torque.database.default.url =
jdbc:oracle:thin:@130.3.15.173:1530:EAITEST9
> torque.database.default.username = portal01
> torque.database.default.password = portal01
>
> torque.database.adapter = oracle
> torque.database.adapter.oracle = oracle.jdbc.driver.OracleDriver
>
> my Torque.properties:
>
> #
> # application database
> #
> torque.database.default = portal01
> torque.database.portal01.adapter = oracle
> torque.dsfactory.portal01.factory =
> org.apache.torque.dsfactory.SharedPoolDataSourceFactory
> torque.dsfactory.portal01.connection.driver =
> oracle.jdbc.driver.OracleDriver
> torque.dsfactory.portal01.connection.url =
> jdbc:oracle:thin:@130.3.15.173:1530:EAITEST9
> torque.dsfactory.portal01.connection.user =   portal01
> torque.dsfactory.portal01.connection.password =   portal01
>
> torque.dsfactory.portal01.pool.maxActive = 30
> torque.dsfactory.portal01.pool.testOnBorrow = true
> torque.dsfactory.portal01.pool.validationQuery = SELECT 1
>
> my project.properties:
>
> # ---
> #
> # T O R Q U E  C O N F I G U R A T I O N
> #
> # used to generate the initial data for the security tables
> #
> # ---
>
> torque.database = oracle
> torque.project = portal01
> torque.target.package = lu.dresdner_bank.portal01.db
>
> torque.java.dir = target/src
> torque.sql.dir = target/sql
> torque.output.dir =   target/sql
> torque.schema.dir =   target/xml
> torque.contextProperties = build.properties
> torque.basePrefix = Base
> #
> # As the current Torque cannot build a peer class for
> # the ID broker table, it is necessary to exclude all
> # the generated ID tables from OM generation. So you
> # must keep the following property here until Torque
> # no longer has a name clash between the TABLE_NAME
> # column and the internal TABLE_NAME variable.
> #
> torque.schema.om.excludes =   *id-table-schema*.xml
>
> torque.addSaveMethod = true
> torque.runOnlyOnSchemaChange = true
> torque.saveException = Exception
> torque.addIntakeRetrievable = true
> torque.retrievableInterface = org.apache.turbine.om.Retrievable
>
> torque.database.createUrl =
jdbc:oracle:thin:@130.3.15.173:1530:EAITEST9
> torque.database.buildUrl = jdbc:oracle:thin:@130.3.15.173:1530:EAITEST9
> torque.database.url = jdbc:oracle:thin:@130.3.15.173:1530:EAITEST9
> torque.database.driver = oracle.jdbc.driver.OracleDriver
> torque.database.user = portal01
> torque.database.password = portal01
> torque.database.host = 130.3.15.173
>
> my error-message:
>
> 2005-03-18 15:02:37,346 [http-8080-Processor24] ERROR
> org.apache.turbine.services.velocity.TurbineVelocityService - Class
> lu.dresdner_bank.portal01.tools.ProcessTool.getProcesses threw Exception
> org.apache.torque.TorqueException:
> org.apache.commons.dbcp.SQLNestedException: Could not retrieve connection
> info from pool
>at
> org.apache.torque.TorqueInstance.getConnection(TorqueInstance.java:717)
>at org.apache.torque.Torque.getConnection(Torque.java:268)
>at org.apache.torque.util.BasePeer.doPSSelect(BasePeer.java:2082)
>at
>
lu.dresdner_bank.portal01.tools.ProcessTool.getProcesses(ProcessTool.java:49

> )
>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> 

RE: Builds fine on Windows, Fails on Linux

2005-03-28 Thread Thomas Fischer




Tom,

I do not think the operation system is a problem. I have no experience with
3.0.2, but from 3.1 on, the builds run also on linux.
Are you sure you do not have any absolute paths in your configuration ?

Perhaps it is best to start the installation from scratch on linux and copy
only the files you have modified, reviewing them as you copy them.

 Thomas

"Tom Lianza" <[EMAIL PROTECTED]> schrieb am 26.03.2005 22:39:42:

> Hi All,
>
> I have a torque project based on Torque 3.0.2.  Everything works fine
when I
> do a build on Windows.  However, when I copy all of my files down to my
> linux machine and try and run ant -f build-torque.xml I get the following

> error message:
>
> /home/tlianza/workspace/usoil/torque/build-torque.xml:122: The following
> error occurred while executing this line:
> /home/tlianza/workspace/usoil/torque/build-torque.xml:185: The following
> error occurred while executing this line:
> /home/tlianza/workspace/usoil/torque/build-torque.xml:216: Generation
> failed. For more information consult the velocity log, or invoke ant with

> the -debug flag.
>
> That error corresponds to the "templatePath" argument of the torque-sql
tag
> in my sql-template target.  Velocity.log doesn't show anything that I can

> see as useful:
>
> 2005-03-26 16:31:59,618 - Starting Jakarta Velocity v1.3
> 2005-03-26 16:31:59,618 - RuntimeInstance initializing.
> 2005-03-26 16:31:59,618 - Default Properties File:
> org/apache/velocity/runtime/defaults/velocity.properties
> 2005-03-26 16:31:59,618 - Trying to use logger class
> org.apache.velocity.runtime.log.AvalonLogSystem
> 2005-03-26 16:31:59,618 - Couldn't find class
> org.apache.velocity.runtime.log.AvalonLogSystem or necessary supporting
> classes in classpath. Exception : java.lang.NoClassDefFoundError:
> org/apache/log/format/Formatter
> 2005-03-26 16:31:59,618 - Trying to use logger class
> org.apache.velocity.runtime.log.SimpleLog4JLogSystem
> 2005-03-26 16:31:59,618 - Using logger class
> org.apache.velocity.runtime.log.SimpleLog4JLogSystem
> 2005-03-26 16:31:59,621 - Default ResourceManager initializing. (class
> org.apache.velocity.runtime.resource.ResourceManagerImpl)
> 2005-03-26 16:31:59,624 - Resource Loader Instantiated:
> org.apache.velocity.runtime.resource.loader.FileResourceLoader
> 2005-03-26 16:31:59,625 - FileResourceLoader : initialization starting.
> 2005-03-26 16:31:59,625 - FileResourceLoader : adding path
> '/home/tlianza/workspace/usoil/torque/templates'
> 2005-03-26 16:31:59,625 - FileResourceLoader : initialization complete.
> 2005-03-26 16:31:59,629 - ResourceCache : initialized. (class
> org.apache.velocity.runtime.resource.ResourceCacheImpl)
> 2005-03-26 16:31:59,629 - Default ResourceManager initialization
complete.
> 2005-03-26 16:31:59,631 - Loaded System Directive:
> org.apache.velocity.runtime.directive.Literal
> 2005-03-26 16:31:59,632 - Loaded System Directive:
> org.apache.velocity.runtime.directive.Macro
> 2005-03-26 16:31:59,633 - Loaded System Directive:
> org.apache.velocity.runtime.directive.Parse
> 2005-03-26 16:31:59,635 - Loaded System Directive:
> org.apache.velocity.runtime.directive.Include
> 2005-03-26 16:31:59,637 - Loaded System Directive:
> org.apache.velocity.runtime.directive.Foreach
> 2005-03-26 16:31:59,733 - Created: 20 parsers.
> 2005-03-26 16:31:59,733 - Velocimacro : initialization starting.
> 2005-03-26 16:31:59,733 - Velocimacro : adding VMs from VM library
template
> : VM_global_library.vm
> 2005-03-26 16:31:59,736 - ResourceManager : unable to find resource
> 'VM_global_library.vm' in any resource loader.
> 2005-03-26 16:31:59,736 - Velocimacro : error using  VM library template
> VM_global_library.vm :
> org.apache.velocity.exception.ResourceNotFoundException: Unable to find
> resource 'VM_global_library.vm'
> 2005-03-26 16:31:59,736 - Velocimacro :  VM library template macro
> registration complete.
> 2005-03-26 16:31:59,736 - Velocimacro : allowInline = true : VMs can be
> defined inline in templates
> 2005-03-26 16:31:59,736 - Velocimacro : allowInlineToOverride = false :
VMs
> defined inline may NOT replace previous VM definitions
> 2005-03-26 16:31:59,736 - Velocimacro : allowInlineLocal = false : VMs
> defined inline will be  global in scope if allowed.
> 2005-03-26 16:31:59,736 - Velocimacro : messages on  : VM system will
output
> logging messages
> 2005-03-26 16:31:59,736 - Velocimacro : autoload off  : VM system will
not
> automatically reload global library macros
> 2005-03-26 16:31:59,736 - Velocimacro : initialization complete.
> 2005-03-26 16:31:59,736 - Velocity successfully started.
> -
>
> Any ideas?  This same set of files builds fine with Windows, so I'm
thinking
> it's either something environmental (classpath environment variable?) or
> os-dependent... I just don't see what that could be.
>
> Thanks!
> Tom
>
>
>
> -
> To unsubscribe, e-mail: [EMAI

Re: Creation of beans from Torque objects supported in CVS version

2005-03-28 Thread Thomas Fischer
I just found out that in addition to install a new version of the maven 
plugin, one aslo has to install the new version of the generator:
From the root of torque cvs:
cd /src/generator
maven jar:install
  Thomas
On Mon, 28 Mar 2005, Thomas Fischer wrote:


I have committed changes into cvs which allow to create beans from torque
objects and vice versa. Related Objects are taken care of, and database
state (i.e. is it a new Object ?) is also transferred into the beans. I did
not yet use it in production environment, but I am quite confident that
there are no large bugs in there.
To learn more, checkout Torque from cvs, run "maven  xdoc"  in the project
root and read the Beans Howto.
If you use maven to generate the beans, you have to install a new version
of the maven plugin. To do this, run "maven plugin:install" from the
src/maven directory of your local copy of the Torque cvs.
Please mail success stories and questions to the users list. If you
discover a bug (and you are sure it is a bug), please open a issue in the
issue tracker (http://issues.apache.org/scarab/issues )
  Thomas
-
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]


Creation of beans from Torque objects supported in CVS version

2005-03-28 Thread Thomas Fischer




I have committed changes into cvs which allow to create beans from torque
objects and vice versa. Related Objects are taken care of, and database
state (i.e. is it a new Object ?) is also transferred into the beans. I did
not yet use it in production environment, but I am quite confident that
there are no large bugs in there.

To learn more, checkout Torque from cvs, run "maven  xdoc"  in the project
root and read the Beans Howto.

If you use maven to generate the beans, you have to install a new version
of the maven plugin. To do this, run "maven plugin:install" from the
src/maven directory of your local copy of the Torque cvs.

Please mail success stories and questions to the users list. If you
discover a bug (and you are sure it is a bug), please open a issue in the
issue tracker (http://issues.apache.org/scarab/issues )

   Thomas


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



RE: DB Connections are not being closed...

2005-03-23 Thread Thomas Fischer




Hi,

if you do not open any connection explicitly, Torque makes sure that the
connections are closed.

If you open connections explicitly, make sure that they are closed
afterwards. A secure way is doing it like this.

Connection connection = null;
try {
   connection = Torque.getConnection();
   // do whatever you want with the connection
  Torque.closeConnection(connection);
  connection = null;
}
finally {
  if (connection != null) {
try {
  Torque.closeConnection(connection);
}
catch (Exception e) {}
connection = null;
  }
}

Also, only store connections in local variables in order not to run in any
threading problems, not in class or instance variables. And never ever
store them in sessions.

   Thomas

Irineu Avanço Jr. <[EMAIL PROTECTED]> schrieb am 22.03.2005 18:30:08:

> Hi..
>
>
>
> We are facing an issue  with DB connections  using  Jetspeed 1.5  and
Torque
> 3.1.We are making stress tests
>
> with  a  portal application  impelemented under  Jetspeed and Torque
> architecture.
>
> The problem is that the connection with Jetspeed DB is not being closed
> even after the user gets disconnected.   Instead,  the connection are
closed
> only if I  shutdown  the Web server,  in this case Tomcat 5.
>
>
>
> We did some changes in  the Torque.properties file to try to make them
close
> properly and it did not work.
>
>
>
> Can anybody help us out with this issue ?
>
>
>
> Thank you.
>
>
>
>
>
> Irineu Avanço Jr.
>
>
>
>
>


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



Re: How to use doSelectJoin?

2005-03-18 Thread Thomas Fischer




Robert,

it is not only you who is confused about this behaviour.
I also would like to have a way to tell the object whether it can ask the
database for the related objects or whether it should just use its cache.
The "automatic behaviour" is especially annoying if one cares about
transaction safety, which can be destroyed by a getRelatedObjects() in the
wrong place. Probably one would have to generate a different set of methods
to do be able to control the behavior, e.g. add a boolean "you can ask the
database" to the getRelatedObjects() method. But there are already quite a
lot of methods created automatically, so I'm not sure whether increasing
the number of methods further would be a good idea. However, if lots of
people cry "let's do it" I might really do it...

Thomas

Robert Bowen <[EMAIL PROTECTED]> schrieb am 18.03.2005 13:05:54:

> I should have done more testing before posting. It
> turns out what I was most worried about was Torque
> calling the database every time I looked up the
> profiles associated with the user. But since the User
> object will be in session, it will only call the
> database the first time. After that it will be cached.
>
>
> So in the end, I really don't have any problem!
>
> Thanks for your quick and helpful responses.
>
> Bob
>
> --- Thomas Fischer <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> > Robert,
> >
> > I do not see a possibility to load all your datasets
> > using one single join
> > if you only use pregenerated classes. But if you
> > only want to get the stuff
> > from the db and do not care whether it is a single
> > sql statement or not,
> > you can use the following PSEUDOcode:
> >
> > User user = UserPeer.doSelect(userCriteria);
> > // following loads and caches the userProfiles
> > within the user
> > List userProfiles = user.getUserProfiles();
> > // now load the profiles
> > foreach (userProfile in UserProfiles) {
> >   // load and cache the associated profile
> >   userProfile.getProfile();
> > }
> > // now the user has associated all its profiles
> > // If you call user.getUserProfiles() again, the
> > user object will not ask
> > the db again,
> > // but use the cached objects instead
> >
> > If you want the call to be a single statement
> > because of transaction
> > safety, you can also wrap the above in a
> > Transaction.start() and
> > Tranaction.commit() wrapper.
> >
> > Sure this is not the most performant solution of
> > all, but it works ;-). I
> > use it every time I am in such a situation.
> >
> >   Thomas
> >
> >
> > Robert Bowen <[EMAIL PROTECTED]> schrieb am 17.03.2005
> > 19:32:48:
> >
> > > Hello, thanks for the response.
> > >
> > > Yea, "doSelectJoinXxxx()" is a protected method
> > > generated by Torque but in my particular
> > situation,
> > > this method is not being generated for the object
> > I
> > > need.
> > >
> > > There is a doSelectJoinProfiles() in the
> > > BaseUsersProfilesPeer class, which will load all
> > the
> > > info for all profiles associated with any
> > > UsersProfiles object, but there is no
> > > "doSelectJoinUsersProfiles()" method in my
> > > BaseUserPeer class, and this is what I need -- to
> > > first load all UsersProfiles associated with a
> > given
> > > user, and then load all of the Profiles themselvs
> > > (specifically what I need is the profile name).
> > >
> > > Any other takers?
> > >
> > > Bob
> > >
> > > --- Dave Newton <[EMAIL PROTECTED]> wrote:
> > > > Robert Bowen wrote:
> > > >
> > > > >So how can I do the same thing for "user",
> > which
> > > > has a
> > > > >foreign key TO "users_profiles"?
> > > > >
> > > > >
> > > > Isn't there a protected method in the base user
> > that
> > > > does the join? In
> > > > the generated javadocs for your OM it should say
> > > > something like "this
> > > > isn't exposed to keep the API reasonable" or
> > > > something like that.
> > > >
> > > > You need to expose the method in your user class
> > > > (the one for
> > > > implementing custom functionality) and you
> > should be
> > > > all set.
> > > >
> > > > Dave
> > > >
> > > >
> >
> >
> >
> -
> > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> >
> >
>
>
>
> __
> Do you Yahoo!?
> Yahoo! Small Business - Try our new resources site!
> http://smallbusiness.yahoo.com/resources/
>
> -
> 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: How to use doSelectJoin?

2005-03-17 Thread Thomas Fischer




Robert,

I do not see a possibility to load all your datasets using one single join
if you only use pregenerated classes. But if you only want to get the stuff
from the db and do not care whether it is a single sql statement or not,
you can use the following PSEUDOcode:

User user = UserPeer.doSelect(userCriteria);
// following loads and caches the userProfiles within the user
List userProfiles = user.getUserProfiles();
// now load the profiles
foreach (userProfile in UserProfiles) {
  // load and cache the associated profile
  userProfile.getProfile();
}
// now the user has associated all its profiles
// If you call user.getUserProfiles() again, the user object will not ask
the db again,
// but use the cached objects instead

If you want the call to be a single statement because of transaction
safety, you can also wrap the above in a Transaction.start() and
Tranaction.commit() wrapper.

Sure this is not the most performant solution of all, but it works ;-). I
use it every time I am in such a situation.

  Thomas


Robert Bowen <[EMAIL PROTECTED]> schrieb am 17.03.2005 19:32:48:

> Hello, thanks for the response.
>
> Yea, "doSelectJoinXxxx()" is a protected method
> generated by Torque but in my particular situation,
> this method is not being generated for the object I
> need.
>
> There is a doSelectJoinProfiles() in the
> BaseUsersProfilesPeer class, which will load all the
> info for all profiles associated with any
> UsersProfiles object, but there is no
> "doSelectJoinUsersProfiles()" method in my
> BaseUserPeer class, and this is what I need -- to
> first load all UsersProfiles associated with a given
> user, and then load all of the Profiles themselvs
> (specifically what I need is the profile name).
>
> Any other takers?
>
> Bob
>
> --- Dave Newton <[EMAIL PROTECTED]> wrote:
> > Robert Bowen wrote:
> >
> > >So how can I do the same thing for "user", which
> > has a
> > >foreign key TO "users_profiles"?
> > >
> > >
> > Isn't there a protected method in the base user that
> > does the join? In
> > the generated javadocs for your OM it should say
> > something like "this
> > isn't exposed to keep the API reasonable" or
> > something like that.
> >
> > You need to expose the method in your user class
> > (the one for
> > implementing custom functionality) and you should be
> > all set.
> >
> > Dave
> >
> >


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



RE: doDelete problem, null dbMap

2005-03-17 Thread Thomas Fischer




Jim,

Thanks for investigating this further. I wanted to make sure its not an
error in the Torque code.

No idea about the date issue. I am also getting this, but as I do not need
dates sooner than 1970, I did not investigate it further.
Keep us informed if you have any new informations about it.

   Thomas

Jim Caserta <[EMAIL PROTECTED]> schrieb am 17.03.2005 13:10:52:

> That's exactly it Thomas. I was setting the dbName
> when I did not have to, which set up a different
> dbMap. Thank you for all your help.
>
> I'm trying to do inserts now and I'm getting an error
> message that a Date field cannot be before 01/01/70. I
> have never had this happen in version 3.0.
> Still trying to work that one out inbetween other
> projects. I will have to check out the release notes
> to see if there were changes to Date fields.
>
> Thanks!
> Jim
> --- Thomas Fischer <[EMAIL PROTECTED]> wrote:
>
> >
> >
> >
> >
> >
> > Jim,
> >
> > are you sure you used setDbName() correctly ? The
> > setDbName() is for ther
> > following scenario: In the schema.xml used by the
> > generator, one can define
> > different s  which have a different
> > structure. The generated
> > classes know which  they belong to.  Then,
> > in the runtime, you
> > can assign different connection-urls to the
> > different s. But as
> > the structure of the s" may differ, this
> > means that Torque has to
> > keep a dbMap for each . So if you set the
> > dbName in criterion, it
> > uses a different dbMap. If this map does not have
> > the correct entries, the
> > doDelete fails.
> >
> > This scenario is different from the case where you
> > have different databases
> > (e.g. on different servers) with the same structure.
> > For this, you have to
> > provide different runtime properties, but you must
> > not change the name of
> > the database in the criteria.
> >
> > In general, if you just have one  element
> > in your schema.xml and
> > just one database to connect to, you need not worry
> > about the database name
> > within the runtime.
> >
> >Thomas
> >
> >
> > Jim Caserta <[EMAIL PROTECTED]> schrieb am
> > 16.03.2005 13:44:44:
> >
> > > Thomas,
> > >
> > > I did some further looking at what I changed and
> > > attempted to re-create the problem.
> > > It appears that setting the DbName with the actual
> > > HighLevel qualifier for the tables (was "default"
> > > previously) wreaked havoc with the "tables"
> > hashtable
> > > in the dbMap (line commented out below) in the
> > > criteria.
> > >
> > > I cannot explain it, but it happens consistently.
> > >
> > > criteria.add(TableNamePeer.OFFRG_N, primaryKey);
> > > //criteria.setDbName(db2Schema);
> > > TableNamePeer.doDelete(criteria, dbConn);
> > >
> > >
> > > --- Thomas Fischer <[EMAIL PROTECTED]> wrote:
> > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Jim,
> > > >
> > > > I still not understand the cause of the problem
> > and
> > > > your solution. What did
> > > > you do to make the error do away ?
> > > >
> > > > Looking at the generated code, I do not see how
> > > > accessing the static method
> > > > of one table could possibly initialize or
> > > > re-initialize the Map builder of
> > > > another table.
> > > >
> > > >Thomas
> > > >
> > > >
> > > > Jim Caserta <[EMAIL PROTECTED]> schrieb am
> > > > 15.03.2005 20:00:02:
> > > >
> > > > > Thomas,
> > > > >
> > > > > You are right. It appears that by executing
> > the
> > > > > following:
> > > > > BaseTABLENAMEPeer.executeStatement("SET
> > CURRENT
> > > > SQLID
> > > > > = '" +
> > > > > db2Schema...
> > > > > for each of the tables that would have been
> > > > deleted in
> > > > > a Cascade Delete, it somehow re-initialized
> > Tables
> > > > in
> > > > > the dbMap.
> > > > >
> > > > > Now all I have to do is get the Updates and
> > > > Inserts
> > > > > working..
> > > > > Thanks

RE: doDelete problem, null dbMap

2005-03-17 Thread Thomas Fischer





Jim,

are you sure you used setDbName() correctly ? The setDbName() is for ther
following scenario: In the schema.xml used by the generator, one can define
different s  which have a different structure. The generated
classes know which  they belong to.  Then, in the runtime, you
can assign different connection-urls to the different s. But as
the structure of the s" may differ, this means that Torque has to
keep a dbMap for each . So if you set the dbName in criterion, it
uses a different dbMap. If this map does not have the correct entries, the
doDelete fails.

This scenario is different from the case where you have different databases
(e.g. on different servers) with the same structure. For this, you have to
provide different runtime properties, but you must not change the name of
the database in the criteria.

In general, if you just have one  element in your schema.xml and
just one database to connect to, you need not worry about the database name
within the runtime.

   Thomas


Jim Caserta <[EMAIL PROTECTED]> schrieb am 16.03.2005 13:44:44:

> Thomas,
>
> I did some further looking at what I changed and
> attempted to re-create the problem.
> It appears that setting the DbName with the actual
> HighLevel qualifier for the tables (was "default"
> previously) wreaked havoc with the "tables" hashtable
> in the dbMap (line commented out below) in the
> criteria.
>
> I cannot explain it, but it happens consistently.
>
> criteria.add(TableNamePeer.OFFRG_N, primaryKey);
> //criteria.setDbName(db2Schema);
> TableNamePeer.doDelete(criteria, dbConn);
>
>
> --- Thomas Fischer <[EMAIL PROTECTED]> wrote:
>
> >
> >
> >
> >
> >
> > Jim,
> >
> > I still not understand the cause of the problem and
> > your solution. What did
> > you do to make the error do away ?
> >
> > Looking at the generated code, I do not see how
> > accessing the static method
> > of one table could possibly initialize or
> > re-initialize the Map builder of
> > another table.
> >
> >Thomas
> >
> >
> > Jim Caserta <[EMAIL PROTECTED]> schrieb am
> > 15.03.2005 20:00:02:
> >
> > > Thomas,
> > >
> > > You are right. It appears that by executing the
> > > following:
> > > BaseTABLENAMEPeer.executeStatement("SET CURRENT
> > SQLID
> > > = '" +
> > > db2Schema...
> > > for each of the tables that would have been
> > deleted in
> > > a Cascade Delete, it somehow re-initialized Tables
> > in
> > > the dbMap.
> > >
> > > Now all I have to do is get the Updates and
> > Inserts
> > > working..
> > > Thanks for all your help!
> > >
> > > Jim
> > >
> > > --- Thomas Fischer <[EMAIL PROTECTED]> wrote:
> > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Jim,
> > > >
> > > > Sorry, I should have read your mail more
> > cautiously;
> > > > I was again
> > > > mistaken...
> > > > But nonetheless, I am still confused.
> > > >
> > > > There should be code in the generated
> > xxxBasePeer
> > > > class which looks like
> > > >
> > > > public static MapBuilder
> > getMapBuilder(String
> > > > name)
> > > > {
> > > > try
> > > > {
> > > > MapBuilder mb = (MapBuilder)
> > > > mapBuilders.get(name);
> > > > // Use the 'double-check pattern'
> > for
> > > > syncing
> > > > //  caching of the MapBuilder.
> > > > if (mb == null)
> > > > {
> > > > synchronized (mapBuilders)
> > > > {
> > > > mb = (MapBuilder)
> > > > mapBuilders.get(name);
> > > > if (mb == null)
> > > > {
> > > > mb = (MapBuilder)
> > > > Class.forName(name).newInstance();
> > > > // Cache the MapBuilder
> > > > before it is built.
> > > > mapBuilders.put(name,
> > mb);
> > > > }
> > > > }
> > > >}
> > > >   
> > > >
> > > > This should cache the map builder in the dbMap.
> > The
>

RE: doDelete problem, null dbMap

2005-03-15 Thread Thomas Fischer





Jim,

I still not understand the cause of the problem and your solution. What did
you do to make the error do away ?

Looking at the generated code, I do not see how accessing the static method
of one table could possibly initialize or re-initialize the Map builder of
another table.

   Thomas


Jim Caserta <[EMAIL PROTECTED]> schrieb am 15.03.2005 20:00:02:

> Thomas,
>
> You are right. It appears that by executing the
> following:
> BaseTABLENAMEPeer.executeStatement("SET CURRENT SQLID
> = '" +
> db2Schema...
> for each of the tables that would have been deleted in
> a Cascade Delete, it somehow re-initialized Tables in
> the dbMap.
>
> Now all I have to do is get the Updates and Inserts
> working..
> Thanks for all your help!
>
> Jim
>
> --- Thomas Fischer <[EMAIL PROTECTED]> wrote:
>
> >
> >
> >
> >
> >
> > Jim,
> >
> > Sorry, I should have read your mail more cautiously;
> > I was again
> > mistaken...
> > But nonetheless, I am still confused.
> >
> > There should be code in the generated xxxBasePeer
> > class which looks like
> >
> > public static MapBuilder getMapBuilder(String
> > name)
> > {
> > try
> > {
> > MapBuilder mb = (MapBuilder)
> > mapBuilders.get(name);
> > // Use the 'double-check pattern' for
> > syncing
> > //  caching of the MapBuilder.
> > if (mb == null)
> > {
> > synchronized (mapBuilders)
> > {
> > mb = (MapBuilder)
> > mapBuilders.get(name);
> > if (mb == null)
> > {
> > mb = (MapBuilder)
> > Class.forName(name).newInstance();
> > // Cache the MapBuilder
> > before it is built.
> > mapBuilders.put(name, mb);
> > }
> > }
> >}
> >   
> >
> > This should cache the map builder in the dbMap. The
> > method is called from
> > the static initializer of the xxxBasePeer class,
> > which should be called at
> > the latest when you call xxxPeer.DoDelete(). If you
> > have the possibility to
> > debug your code, you might want to put a breakpoint
> > in there and see
> > whether and when it it called.
> >
> > There are two reasons I can think of why the Table
> > does not appear in the
> > dbMap (there might be more)
> > 1) Torque is not initialized or it is initialized
> > more than once
> > 2) For some obscure reason, the xxxBasePeer class is
> > not loaded while you
> > execute the doDelete().
> >
> > To exclude 2), you can force the classLoader to load
> > the xxxBasePeer class
> > by issuing
> >
> class.ForName("fully.qualified.name.of.xxxBasePeer");
> > before the delete. But ") is very improbable, as the
> > Java Language
> > specification explicitly states that a class is
> > loaded immediately before
> > you execute one of its static methods
> >
> > JLS 2.0 §12.4.1--
> > "A class or interface type T will be initialized
> > immediately before the
> > first occurrence of any one of the following:
> > . T is a class and an instance of T is created.
> > . T is a class and a static method declared by T is
> > invoked.
> > . A static field declared by T is assigned.
> > . A static field declared by T is used and the
> > reference to the field is
> > not a compile-time constant (§15.28). References to
> > compile-time constants
> > must be resolved at compile time to a copy of the
> > compile-time constant
> > value, so uses of such a field never cause
> > initialization."
> >
> > If you can solve this, I (and probably some more
> > people on the list) would
> > be very interested to know how this problem could
> > originate.
> >
> >   Thomas
> >
> >
> >
> >
> > [EMAIL PROTECTED] schrieb am 14.03.2005 19:49:22:
> >
> > >
> > > Tom,
> > >
> > > Yes it does. In the tables MapBulder class it has
> > the following:
> > >
> > > dbMap = Torque.getDatabaseMap("default");
> > > dbMap.addTable("PMTEM021_POLOFFR");
> > > TableMap tMap =
> > dbMap.getTable("PMTEM021_POLOFFR");
> > > tMap.setPrimaryKeyMethod("none");
> > > 

RE: doDelete problem, null dbMap

2005-03-14 Thread Thomas Fischer





Jim,

Sorry, I should have read your mail more cautiously; I was again
mistaken...
But nonetheless, I am still confused.

There should be code in the generated xxxBasePeer class which looks like

public static MapBuilder getMapBuilder(String name)
{
try
{
MapBuilder mb = (MapBuilder) mapBuilders.get(name);
// Use the 'double-check pattern' for syncing
//  caching of the MapBuilder.
if (mb == null)
{
synchronized (mapBuilders)
{
mb = (MapBuilder) mapBuilders.get(name);
if (mb == null)
{
mb = (MapBuilder)
Class.forName(name).newInstance();
// Cache the MapBuilder before it is built.
mapBuilders.put(name, mb);
}
}
   }
  

This should cache the map builder in the dbMap. The method is called from
the static initializer of the xxxBasePeer class, which should be called at
the latest when you call xxxPeer.DoDelete(). If you have the possibility to
debug your code, you might want to put a breakpoint in there and see
whether and when it it called.

There are two reasons I can think of why the Table does not appear in the
dbMap (there might be more)
1) Torque is not initialized or it is initialized more than once
2) For some obscure reason, the xxxBasePeer class is not loaded while you
execute the doDelete().

To exclude 2), you can force the classLoader to load the xxxBasePeer class
by issuing
class.ForName("fully.qualified.name.of.xxxBasePeer");
before the delete. But ") is very improbable, as the Java Language
specification explicitly states that a class is loaded immediately before
you execute one of its static methods

JLS 2.0 §12.4.1--
"A class or interface type T will be initialized immediately before the
first occurrence of any one of the following:
. T is a class and an instance of T is created.
. T is a class and a static method declared by T is invoked.
. A static field declared by T is assigned.
. A static field declared by T is used and the reference to the field is
not a compile-time constant (§15.28). References to compile-time constants
must be resolved at compile time to a copy of the compile-time constant
value, so uses of such a field never cause initialization."

If you can solve this, I (and probably some more people on the list) would
be very interested to know how this problem could originate.

  Thomas




[EMAIL PROTECTED] schrieb am 14.03.2005 19:49:22:

>
> Tom,
>
> Yes it does. In the tables MapBulder class it has the following:
>
> dbMap = Torque.getDatabaseMap("default");
> dbMap.addTable("PMTEM021_POLOFFR");
> TableMap tMap = dbMap.getTable("PMTEM021_POLOFFR");
> tMap.setPrimaryKeyMethod("none");
> tMap.addPrimaryKey("PMTEM021_POLOFFR.OFFRG_N", new String());
>
>

>

>  Jim Caserta

>

>  Whitehouse Station CCI - PM&M Systems

>

>  Office: (908) 572-4788

>

>  Mail Stop: WHB2S-15

>

>  [EMAIL PROTECTED]

>

>
>
>
>
>
>

>  Thomas Fischer

>  <[EMAIL PROTECTED]

>  u.net>
To
>"Apache Torque Users List"

>  03/14/2005 10:44  

>  AM
cc
>

>
Subject
>  Please respond to RE: doDelete problem, null dbMap

>   "Apache Torque

> Users List"

>  <[EMAIL PROTECTED]

> pache.org>

>

>

>
>
>
>
>
>
>
>
> Jim,
>
> if the db map is not null, but the column is not mapped, then I was
> mistaken about the cause of the error, and class.forName() is of no use.
>
> Can you look at the map package (${target.package}.map), locate the Map
> class for the Table, and see if it has got an entry for the column
OFFRG_N
> ?
>
>Thomas
>
>
> [EMAIL PROTECTED] schrieb am 11.03.2005 20:51:27:
>
> > Thomas,
> >
> > This is exactly (well.. almost) what I have in my code
> >
> > //Get a connection
> > dbConn = Torque.getConnection(getProperty("db2.environment"));
> > dbConn.setAutoCommit(true);
> >
> > \\db2Schema  is the High level qualifier for the table
> > String db2Schema = MixApplication.getProperty("db2schema");
> >
> > BaseTableNamePeer.executeStatement("SET CURRENT SQLID = '" + db2Schema
+
> > "'", dbConn);
> > BasePeer.executeStatement("SET CURRENT SQLID = '" + db2Schema + "'",
> dbConn
> > );
> >
> > Criteria criteria 

RE: doDelete problem, null dbMap

2005-03-14 Thread Thomas Fischer




Jim,

if the db map is not null, but the column is not mapped, then I was
mistaken about the cause of the error, and class.forName() is of no use.

Can you look at the map package (${target.package}.map), locate the Map
class for the Table, and see if it has got an entry for the column OFFRG_N
?

   Thomas


[EMAIL PROTECTED] schrieb am 11.03.2005 20:51:27:

> Thomas,
>
> This is exactly (well.. almost) what I have in my code
>
> //Get a connection
> dbConn = Torque.getConnection(getProperty("db2.environment"));
> dbConn.setAutoCommit(true);
>
> \\db2Schema  is the High level qualifier for the table
> String db2Schema = MixApplication.getProperty("db2schema");
>
> BaseTableNamePeer.executeStatement("SET CURRENT SQLID = '" + db2Schema +
> "'", dbConn);
> BasePeer.executeStatement("SET CURRENT SQLID = '" + db2Schema + "'",
dbConn
> );
>
> Criteria criteria = new Criteria();
> criteria.add(TableNamePeerPeer.OFFRG_N, primaryKey);
> TableNamePeer.doDelete(criteria, dbConn);
>
> By the way, the dbMap was not null, dbMap.getTable(tab) is null.. my
> mistake.
> ColumnMap[] columnMaps = dbMap.getTable(tab).getColumns();
>
> How are you are suggesting I should use the forName()?
>
> Thanks again!
> Jim
>
>
>
>
>
> John,
>
> My first guess would be that the Peer class is not loaded by the
> classloader before you execute the query. See
> http://issues.apache.org/scarab/issues/id/TRQS228
> In Torque 3.1.1, the problem should be resolved. Alternatively, you can
> force the classloader to load the class before you execute the statement,
> e.g. by class.forName();
>
> By the way, what is TableNamePeer.PRIMARY ? Never seen that before; I
> normally would use
> TableNamePeer.doDelete(criteria, dbConn);
>
>   Thomas
>
> [EMAIL PROTECTED] schrieb am 11.03.2005 16:35:13:
>
> > I recently moved over to version 3.1 for Java, I have the selects
working
> > fine now (Thanks). The issue is on a doDelete, the dbMap is null. The
> error
> > is occurring on this line:
> > ColumnMap[] columnMaps = dbMap.getTable(tab).getColumns(); in the
> doDelete.
> >
> > My Criteria is setup as follows:
> > Criteria criteria = new Criteria();
> > criteria.add(TableNamePeer.PRIMARY_KEY, primaryKey);
> > TableNamePeer.PRIMARY.doDelete(criteria, dbConn);
> >
> > This is the main DB2 table and there are many beneath it. Our system
will
> > automatically handle the cascading of the delete. This worked fine in
> 3.0.
> >
> > Thank you in advance!
> > Jim
>
>

>

>  Jim Caserta

>

>  Whitehouse Station CCI - PM&M Systems

>

>  Office: (908) 572-4788

>

>  Mail Stop: WHB2S-15

>

>  [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: inefficient doDelete

2005-03-14 Thread Thomas Fischer




Daniel,

surely you are right, this is probably the best solution without any
changes in Torque. On the other hand, in my opinion it it is the
responsibility of Torque to handle simple mass deletes. One should not need
a custom query for it.

This behaviour can probably be changed easily where the delete is not
cascading.

Pau, if you want this changed, can you please open a scarab issue on this ?

Thanks,

   Thomas


"Vitzethum, Daniel" <[EMAIL PROTECTED]> schrieb am 14.03.2005
15:50:29:

> Hello Paul,
>
> > How are people handling this?
>
> as already mentioned by someone else (Thomas?), I suppose you
> could/should
> delegate it to the database with a custom sql, e.g.
>
>   BasePeer.executeStatement("DELETE FROM " + FooPeer.TABLE_NAME + "
> WHERE " + FooPeer.A_COLUMN + "=1");
>
> That wouldn't load all records and use the performance of the DB for
> large amounts of data.
>
>
> HTH,
>
> Daniel
>
> -
> 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: Complexe torque crieteria

2005-03-14 Thread Thomas Fischer




Please search the mailing list archives, there are several threads about
this.
Alternatively, see the criteria howto.

   Thomas
Abou Zarr <[EMAIL PROTECTED]> schrieb am 14.03.2005 13:06:28:

> Hi, how can i transform these query to torque
> criteria?
>
> sql = "select distinct salle "
>+ "from tab1, tab2 where "
>+ "((tab1.debut >= tab2 .debut "
>+ "and tab1.debut < tab2 .fin) "
>+ " or "
>+ "(tab1.fin > tab2 .debut "
>+ "and tab1.fin <= tab2 .fin)) "
>+ "and tab2 .idsession = '" + session + "'";
>
> -
> 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: inefficient doDelete

2005-03-11 Thread Thomas Fischer




Hi Paul,

on second thought, the reason for loading the datasets will probably be
that it is the easiest method to do cascading deletes (meaning that, if any
object has a foreign key pointing to the deleted item, that object should
also be deleted to ensure referential integrity).
This could also be done using subselects, but I would guess this is a)
difficult to implement and b) I am not sure whether all databases support
subselects.
So this behaviour is not likely to be changed in forthcoming versions of
Torque.

There is also another way around the OutOfMemoryException: Do the deletes
in chunks using criteria.setLimit(). Problem there is that Torque does not
tell you how much datasets it has deleted, so you have to look by other
means whether there are still Datasets to delete.

 Thomas

Thomas Fischer <[EMAIL PROTECTED]> schrieb am 11.03.2005 17:25:27:

>
>
>
>
>
>
> "Husek, Paul" <[EMAIL PROTECTED]> schrieb am 11.03.2005 17:01:45:
>
> > I've been using Torque for almost a year now and am very happy with it.
> > Recently though I found something that confuses me.
> >
> >
> >
> > All along I've been deleting all History books like:
> >
> >
> >
> > Criteria c=new Criteria();
> >
> > c.add(BookPeer.TYPE,"HISTORY");
> >
> > BookPeer.doDelete(c)
> >
> >
> >
> > And it works fine.  But recently I tried this when there over 100,000
> > history books.   I was greeted with a java "out of memory" error.  Is
> Torque
> > trying to load all records before deleting each of them?
>
> Yes, it does. Code form BasePeer.doDelete(Criteria criteria, Connection
> con)
>
> tds.where(sqlSnippet);
> tds.fetchRecords();
> if (tds.size() > 1 && criteria.isSingleRecord())
> {
> handleMultipleRecords(tds);
> }
> for (int j = 0; j < tds.size(); j++)
> {
> Record rec = tds.getRecord(j);
> rec.markToBeDeleted();
> rec.save();
> }
>
> > Why would it?
>
> I am not sure about this. It seems than in its early days, Torque has
> relied a lot on the village library and this is the way village handles
> deletes. Not a convincing explanation,though. Perhaps some old Torque
guru
> can think of another reason...
>
> > Is there a work around?
> >
>
> I can think of two things: either patch Torque or create the SQL yourself
> and use executeStatement(String).
> I will ask on the dev list if anybody can think of a reason why the
records
> are loaded before they are deleted. If nobody has a reason for it,
chances
> are good that it will be changed.
>
>Thomas
>
>
> -
> 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: inefficient doDelete

2005-03-11 Thread Thomas Fischer






"Husek, Paul" <[EMAIL PROTECTED]> schrieb am 11.03.2005 17:01:45:

> I've been using Torque for almost a year now and am very happy with it.
> Recently though I found something that confuses me.
>
>
>
> All along I've been deleting all History books like:
>
>
>
> Criteria c=new Criteria();
>
> c.add(BookPeer.TYPE,"HISTORY");
>
> BookPeer.doDelete(c)
>
>
>
> And it works fine.  But recently I tried this when there over 100,000
> history books.   I was greeted with a java "out of memory" error.  Is
Torque
> trying to load all records before deleting each of them?

Yes, it does. Code form BasePeer.doDelete(Criteria criteria, Connection
con)

tds.where(sqlSnippet);
tds.fetchRecords();
if (tds.size() > 1 && criteria.isSingleRecord())
{
handleMultipleRecords(tds);
}
for (int j = 0; j < tds.size(); j++)
{
Record rec = tds.getRecord(j);
rec.markToBeDeleted();
rec.save();
}

> Why would it?

I am not sure about this. It seems than in its early days, Torque has
relied a lot on the village library and this is the way village handles
deletes. Not a convincing explanation,though. Perhaps some old Torque guru
can think of another reason...

> Is there a work around?
>

I can think of two things: either patch Torque or create the SQL yourself
and use executeStatement(String).
I will ask on the dev list if anybody can think of a reason why the records
are loaded before they are deleted. If nobody has a reason for it, chances
are good that it will be changed.

   Thomas


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



RE: doDelete problem, null dbMap

2005-03-11 Thread Thomas Fischer




John,

My first guess would be that the Peer class is not loaded by the
classloader before you execute the query. See
http://issues.apache.org/scarab/issues/id/TRQS228
In Torque 3.1.1, the problem should be resolved. Alternatively, you can
force the classloader to load the class before you execute the statement,
e.g. by class.forName();

By the way, what is TableNamePeer.PRIMARY ? Never seen that before; I
normally would use
TableNamePeer.doDelete(criteria, dbConn);

  Thomas

[EMAIL PROTECTED] schrieb am 11.03.2005 16:35:13:

> I recently moved over to version 3.1 for Java, I have the selects working
> fine now (Thanks). The issue is on a doDelete, the dbMap is null. The
error
> is occurring on this line:
> ColumnMap[] columnMaps = dbMap.getTable(tab).getColumns(); in the
doDelete.
>
> My Criteria is setup as follows:
> Criteria criteria = new Criteria();
> criteria.add(TableNamePeer.PRIMARY_KEY, primaryKey);
> TableNamePeer.PRIMARY.doDelete(criteria, dbConn);
>
> This is the main DB2 table and there are many beneath it. Our system will
> automatically handle the cascading of the delete. This worked fine in
3.0.
>
> Thank you in advance!
> Jim
>

>

>  Jim Caserta

>

>  Whitehouse Station CCI - PM&M Systems

>

>  Office: (908) 572-4788

>

>  Mail Stop: WHB2S-15

>

>  [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: Security service

2005-03-10 Thread Thomas Fischer
Hi,
never heard of a Torque security service. I guess both is the same and 
it is implemented in Turbine, but Turbine uses Torque as a persistence layer.
This is just a wild guess, I do not use Turbine. If I am wrong, please 
tell us.

   Thomas
On Thu, 10 Mar 2005, Kintzel Levente wrote:

 Hi!
I read some things about the The turbine security service and the torque 
security service. I want to implement the security for my application. Which 
should I use. Can somebody give me some comparation between the two solution? 
Thank You!

 Best regards!
  Levente Kintzel
-
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: problems with ordering

2005-03-09 Thread Thomas Fischer
Hi,
your code looks ok. There is something similar in the Runtimetest,
public void testCriteriaOrderBy()
{
List books = null;
try
{
Criteria criteria = new Criteria();
criteria.addAscendingOrderByColumn(BookPeer.TITLE);
criteria.addAscendingOrderByColumn(BookPeer.ISBN);
books = BookPeer.doSelect(criteria);
}
catch (Exception e)
{
e.printStackTrace();
fail("Exception caught : "
 + e.getClass().getName()
 + " : " + e.getMessage());
}
which runs without problems.
Can you please send in the stacktrace of the NullPointerException, and 
state which Torque version you are using ?

  Thomas
Original Message:
I'm having trouble with ordering columns.  I'm not sure why, I've tried
debugging, but I always seems to get a null pointer exception, yet I can't
figure out what's null...maybe it's because I don't have the Torque source
in the debugger, so I lose my abililty to step through and really see 
what's
happening once I leave my generated classes.  But normally I'm getting a
list back, it's just not sorted.  So I installed p6spy to check the SQL 
and
see what was really going on.  So I made this simple little tester class 
to
see what's up and I get an exception when I try to order.  I have a DB
that's a fake doctor's office say, and it holds records of patients.  Any
idea why the code below wouldn't work, and any suggestions on how to add
ordering?  According to the Criteria tutorial, my code should work
perfectly.  All they have is
"criteria.addAscendingOrderByColumn(RolePeer.NAME);" and I do something 
very
similar.  The problem is obviously with the ordering method call.  If I
comment out that line, the code works and my list prints out...it's just 
not
sorted which is what I want to do.  Thanks!  -Brandon


public class Tester
{
 public static void main(String[] args)
 {
 try
 {
Torque.init("torque.properties");
		 		 		 Criteria c = new 
Criteria();

c.addAscendingOrderByColumn(PatientPeer.LAST_NAME);
		 		 		 List li = 
PatientPeer.doSelect(c);
		 		 		 Iterator i = 
(Iterator)li.iterator();

		 		 		 System.out.println("list 
1");
		 		 		 while (i.hasNext())
		 		 		 {
		 		 		 		 Patient p 
= (Patient)i.next();

System.out.println(p.toString());
 }
 }
 catch (Exception e)
 {e.printStackTrace();}
 }
}
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Can't delete row, either no delete or get "You must specify KeyDef..." exception.

2005-03-09 Thread Thomas Fischer
Hi,
You use the foreign keys also as primary key. In my experience, using 
something which has another meaning as a primary key is not a good idea. 
Can you try to add another column, e.g. user_role_id, as a primary key,
remove the primaryKey attribute from the other columns and try it again ?
Just removing the primaryKey attribute is also not a good idea, as Torque 
relies on having a primary key.

Just a comment on your secondary problem (building the query by hand). 
Looking at the source code, executeStatement is plain jdbc, just using 
Torque's connection pool to execute your query. So I am very amazed that 
this does not work. Did you look at the return value of executeStatement ?
It should give you the number of affected rows. If it is > 0 but you still 
see the row you just deleted, then maybe it is a transaction problem (not 
enough commits). Perhaps(if you use several databases at once), the 
command might hit the wrong database

 Thomas
On Tue, 8 Mar 2005, Dave Newton wrote:
Hola,
I'm at my wit's end.
I'm trying to delete a record from a table that has three foreign keys 
(schema fragment attached) and it seems no matter how I try to do it I either 
get the "You must specify KeyDef attributes for this TableDataSet in order to 
delete a Record" exception. It's a MySQL db, using Torque 3.1.

Fragment:

  
  
  
  

  
  

  
  

  


Whether I have the 'primaryKey' attributes in there or not it doesn't work 
using doDelete with Criteria or a matching object.

So I build the SQL myself and do an executeStatement, which fails silently, 
deleting nothing. I cut and paste the query into a MySQL query browser and it 
works fine, naturally.

Where am I going wrong? I searched the archives and found this question but 
no answer, including the following not-so-helpful wiki entry: 
http://wiki.apache.org/db-torque/TorqueProjectPages/FAQ down at the bottom.

Hep me! Hep me! I've been using torque for years (no, really!) and never had 
this issue before whether by accident or design.

Thanks,
Dave

-
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: Libraries to go with 3.1.1.

2005-03-07 Thread Thomas Fischer
Hi,
a) the libraries can be found in the lib directory of torque-3.1.1.tar.gz. 
They are named such that you should be able to extract the version from 
it.
b) I am not sure whether library conflicts are the cause of the problem.
Did you make sure that initializing Torque is the first thing you do in 
your project ? Also, there were some issues in the past with using Peer 
classes which are not loaded by the classloader. See TRQS228 in the issue 
tracker.
c)looking at the project.xml in the TORQUE_3_1_BRANCH in cvs, I get


  

  avalon-framework
  avalon-framework
  4.1.4
  http://avalon.apache.org/


  commons-beanutils
  commons-beanutils
  1.6.1
  http://jakarta.apache.org/commons/beanutils/


  commons-collections
  commons-collections
  3.0
  http://jakarta.apache.org/commons/collections/


  commons-configuration
  commons-configuration
  1.0
  http://jakarta.apache.org/commons/configuration/


  commons-dbcp
  commons-dbcp
  1.2.1
  http://jakarta.apache.org/commons/dbcp/


  commons-lang
  commons-lang
  2.0
  http://jakarta.apache.org/commons/lang/


  commons-logging
  commons-logging
  1.0.4
  http://jakarta.apache.org/commons/logging/


  commons-pool
  commons-pool
  1.2
  http://jakarta.apache.org/commons/pool/


  jcs
  jcs
  20030822.182132
  http://jakarta.apache.org/turbine/jcs/


  jdbc
  jdbc
  2.0
  http://java.sun.com/products/jdbc/download.html#spec


  jndi
  jndi
  1.2.1
  http://java.sun.com/products/jndi/


  log4j
  log4j
  1.2.8
  http://logging.apache.org/log4j/


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


  village
  village
  2.0-dev-20030825
  http://share.whichever.com/index.php?SCREEN=village


  xercesImpl
  xerces
  2.4.0
  http://xml.apache.org/xerces2-j/


  xml-apis
  xml-apis
  1.0.b2
  http://xml.apache.org/commons/


  junit
  junit
  3.8.1
  http://www.junit.org

  
...
  Hope that helps,
Thomas
Original message:
I have just migrated to 3.1.1 and I get strange problems: sometimes it
works, and somtimes it throws the following exception:
ERROR org.apache.torque.util.BasePeer - BasePeer.MapBuilder failed
trying to instantiate: ch.cern.jps.db.map.LogPieceM
apBuilder
org.apache.torque.TorqueException: Torque was not initialized properly.
...
I suspect there's a library conflict and it works or not depending on
which library gets loaded first.
I was looking for the correct libraries, but Torque web page points to
an invalid page:
http://jakarta.apache.org/builds/jakarta-turbine/torque/release/3.1.1/.
All you can download from torque webpage is torque-3.1.1.jar itself; no
other jars are available or listed.
Can you please tell me what libraries (and which versions) go with
torque 3.1.1?
Thanks,
Michal.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE : Problem with setDistinct()

2005-03-02 Thread Thomas Fischer




Hi Frederic,

I am 99% sure that the distinct in the statement is not for a single column
in a table, but for the whole bunch of columns where you select from.
Therefore your criteria might not do what you want.

You can also compare the error messages in the  console to the torque error
message. If they are different, chances are that the statement without
select columns is not the statement that is actually executed by Torque. I
supoose you got the statement from Torque's debug.log, in which case I
would suspect that the debug.log statement is incorrect.

Be careful that, if you specify the columns by hand, strange results might
appear if you do not specify all columns of the Salaries Table (no idea how
the other Fields of the salaries object are filled)

Thomas

"KERNEUZET FREDERIC" <[EMAIL PROTECTED]> schrieb am 02.03.2005
15:07:19:

> Hi Thomas, and thanks for your answer.
>
> First, in my console, the following statement is succesful :
> SELECT
> DISTINCT (SALARIE.CD) FROM TURBINE_ROLE, SALARIE,
> TURBINE_USER_GROUP_ROLE WHERE
> TURBINE_ROLE.ROLE_NAME NOT IN ('Correspondant') AND SALARIE.
> USER_ID=TURBINE_USER_GROUP_ROLE.USER_ID AND TURBINE_ROLE.
> ROLE_ID=TURBINE_USER_GROUP_ROLE.ROLE_ID
>
> Of course, the same statement without any column specified is not
> recognized by the SQL parser.
>
> So, for me, the real problem is why no column name appear ?
>
> I succesfully used almost the same thing in another place :
> ===
> criteria.addJoin(EntitePeer.GROUP_ID, TurbineUserGroupRolePeer.GROUP_ID);
> criteria.add(TurbineUserGroupRolePeer.USER_ID,
((OpriskUser)user).getId());
> criteria.addAscendingOrderByColumn(EntitePeer.CD);
>
> criteria.addJoin(TurbineRolePeer.ROLE_ID,
TurbineUserGroupRolePeer.ROLE_ID);
>
> if(data.getParameters().getString("incident","").equals("true"))
> {
> log.info("Login de type incident");
> data.getParameters().setString("ORIGINE","GTO");
> criteria.add(TurbineRolePeer.ROLE_NAME,roleIncident);
> }
> else
> {
> log.info("Login de type classique");
> criteria.addNotIn(TurbineRolePeer.ROLE_NAME,roleExcluList);
> }
>
> criteria.setDistinct();
>
> ===
> Here in the SQL request generated, the Distinct() method is applied
> to a particular column ...
>
> I don't manage to find the difference between my two source code.
>
>
> I'll try adding each column manually to see if it's better.
>
>
> Frederic.
>
>
> -Message d'origine-
> De : Thomas Fischer [mailto:[EMAIL PROTECTED]
> Envoyé : mercredi 2 mars 2005 14:44
> À : Apache Torque Users List
> Objet : RE : Problem with setDistinct()
>
>
>
>
>
> Hi Frederic,
>
> It is not the primary keys of the table, it is all columns of the table
> that are compared by a DISTINCT. So if any column is a text, ntext or
> image, you have a problem.
>
> Just to make sure it is not a JDBC problem: did you try to execute the
SQL
> statement in a console ? If yes, did it give the same message ?
>
> To find the reason why no column names appear (which could be the reason
> for the problem if the Salarie table does not contain text, ntext or
> image), which Torque version are you using ? You could also try to add
> select fields "by hand" and see what happens.
>
>   Thomas
>
>
> "KERNEUZET FREDERIC" <[EMAIL PROTECTED]> schrieb am
02.03.2005
> 12:57:06:
>
> > Primary keys of concerned tables are not text, ntext or image as the
> > Exception message says...
> >
> > It's just INTEGERS !
> >
> > I've avoided the problem with a really bad solution in order to give
> > me more time to find a good one : deleting doubled item in my result
list
> ...
> >
> >
> > Frederic.
> >
> >
> > -Message d'origine-
> > De : Thomas Fischer [mailto:[EMAIL PROTECTED]
> > Envoyé : mercredi 2 mars 2005 11:50
> > À : Apache Torque Users List
> > Objet : RE: Problem with setDistinct()
> >
> >
> >
> >
> >
> > Hi,
> >
> > its just as it says: some datasets do not support DISTINCT with some
> > datatypes. No problem of Torque, but of the database.
> > I got no clean solution, only if your content is short enough then you
> can
> > use VARCHAR instead of whatever datatype you use and it should work
then.
> >
> >   Thomas
> >
> > "KERNEUZET FREDERIC" <[EMAIL PROTECTED]> schrieb am
> 01.03.2005
> > 14:17:48:
> &g

RE : Problem with setDistinct()

2005-03-02 Thread Thomas Fischer




Hi Frederic,

It is not the primary keys of the table, it is all columns of the table
that are compared by a DISTINCT. So if any column is a text, ntext or
image, you have a problem.

Just to make sure it is not a JDBC problem: did you try to execute the SQL
statement in a console ? If yes, did it give the same message ?

To find the reason why no column names appear (which could be the reason
for the problem if the Salarie table does not contain text, ntext or
image), which Torque version are you using ? You could also try to add
select fields "by hand" and see what happens.

  Thomas


"KERNEUZET FREDERIC" <[EMAIL PROTECTED]> schrieb am 02.03.2005
12:57:06:

> Primary keys of concerned tables are not text, ntext or image as the
> Exception message says...
>
> It's just INTEGERS !
>
> I've avoided the problem with a really bad solution in order to give
> me more time to find a good one : deleting doubled item in my result list
...
>
>
> Frederic.
>
>
> -Message d'origine-
> De : Thomas Fischer [mailto:[EMAIL PROTECTED]
> Envoyé : mercredi 2 mars 2005 11:50
> À : Apache Torque Users List
> Objet : RE: Problem with setDistinct()
>
>
>
>
>
> Hi,
>
> its just as it says: some datasets do not support DISTINCT with some
> datatypes. No problem of Torque, but of the database.
> I got no clean solution, only if your content is short enough then you
can
> use VARCHAR instead of whatever datatype you use and it should work then.
>
>   Thomas
>
> "KERNEUZET FREDERIC" <[EMAIL PROTECTED]> schrieb am
01.03.2005
> 14:17:48:
>
> > Hi everyone,
> >
> > I've got a problem with something quite "easy", and besides, already
> > used in another place in my application ...
> >
> > The source code is :
> > 
> > ArrayList listRole = new ArrayList();
> > listRole.add("Correspondant");
> >
> > criteria.addJoin( SalariePeer.USER_ID, TurbineUserGroupRolePeer.USER_ID
> );
> > criteria.addJoin(TurbineRolePeer.ROLE_ID, TurbineUserGroupRolePeer.
> > ROLE_ID);
> > criteria.addNotIn(TurbineRolePeer.ROLE_NAME,listRole);
> >
> > criteria.setDistinct();
> >
> > List lstSalarie = SalariePeer.doSelect(criteria);
> > 
> >
> > It gives me an sql request without any column selected :
> > SELECT DISTINCT  FROM TURBINE_ROLE, SALARIE, TURBINE_USER_GROUP_ROLE
> > WHERE TURBINE_ROLE.ROLE_NAME NOT IN ('Correspondant') AND SALARIE.
> > USER_ID=TURBINE_USER_GROUP_ROLE.USER_ID AND TURBINE_ROLE.
> > ROLE_ID=TURBINE_USER_GROUP_ROLE.ROLE_ID
> >
> > And an java.sql.Exception in thrown :
> > java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]
> > [SQLServer]Data type like text, ntext or image cannot be selected
> asDISTINCT.
> >
> > (error message translated from french)
> >
> > As someone got an idea ?
> >
> >
> > Thanks !
> > ==
> > Frédéric Kerneuzet
> > ==
> >
>
>
> -
> 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]



<    1   2   3   4   5   6   >