You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Kazuhiko Fukatsu <k....@cec-ltd.co.jp> on 2003/04/22 08:27:40 UTC

OrderBy NullPointerException

I experienced a mysterious behaviour with torque-gen-3.1-alpha1
When use OrderBy. Why?


     [junit] java.lang.NullPointerException
     [junit]     at org.apache.torque.util.BasePeer.createQuery(BasePeer.java:124
0)
     [junit]     at org.apache.torque.util.BasePeer.createQueryString(BasePeer.ja
va:916)
     [junit]     at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1332)
     [junit]     at jp.co.shin_chuutou.exam.torque.BaseTPassPeer.doSelectVillageR
ecords(BaseTPassPeer.java:400)
     [junit]     at jp.co.shin_chuutou.exam.torque.BaseTPassPeer.doSelectVillageR
ecords(BaseTPassPeer.java:367)
     [junit]     at jp.co.shin_chuutou.exam.torque.BaseTPassPeer.doSelect(BaseTPa
ssPeer.java:336)
     [junit]     at test.ExamTestCase.testSimple(ExamTestCase.java:45)
     [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)

Test Program

            crit = new Criteria();
            crit.addAscendingOrderByColumn(TPassPeer.PASSWD);
            list = TPassPeer.doSelect(crit); 


Re: OrderBy NullPointerException

Posted by Kazuhiko Fukatsu <k....@cec-ltd.co.jp>.
At 18:40 03/04/22 +0900, you wrote:
>Hello.
>
>
>Check your project-schema.xml
>You have to set the  "name" attribute for <database> element.
>like the following..
>
><database name="yourdbname">

Good. I solved the problem. Thanks a lot.



Re: OrderBy NullPointerException

Posted by Koichi Nakagawa <na...@arksystems.co.jp>.
Hello.


Check your project-schema.xml
You have to set the  "name" attribute for <database> element.
like the following..

<database name="yourdbname"> 



Tak Fujimoto
>hello,
>
>I had the same problem with torque-3.0.
>I believe the column 'PASSWD' is varchar.
>I think addAscendingOrderByColumn() only works for Integer key.
>I couldn't solve the problem so I gave up.
>
>Hope you'll find a workaround.
>
>> I experienced a mysterious behaviour with torque-gen-3.1-alpha1
>> When use OrderBy. Why?
>------
>>      [junit] java.lang.NullPointerException
>------
>> Test Program
>> 
>>             crit = new Criteria();
>>             crit.addAscendingOrderByColumn(TPassPeer.PASSWD);
>>             list = TPassPeer.doSelect(crit); 
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>For additional commands, e-mail: torque-user-help@db.apache.org
>
>

Re: OrderBy NullPointerException

Posted by Eric Emminger <er...@ericemminger.com>.
Tak

Tak Fujimoto wrote:
> hello,
> 
> I had the same problem with torque-3.0.
> I believe the column 'PASSWD' is varchar.
> I think addAscendingOrderByColumn() only works for Integer key.

addAscendingOrderByColumn() should work for a varchar column. It works 
for me.

> I couldn't solve the problem so I gave up.

If you're still having this problem, let us help you. :)

Eric


Re: Map objects to different databases

Posted by Frederic Gedin <fr...@Jaluna.COM>.
Malte Stien wrote:

>Hi,
>
>Thank you for that. I will try this. In which file do I have to set the 
>following lines? Is that for the runtime in Torque.properties or for the code 
>generation in build.properties?
>
As this is something needed only for build, you should have these lines 
in your "build.properties" file.
One more comment: when building your databases, beware that each of them 
do have its own ID_TABLE table.

>
>  
>
>>torque.schema.sql.excludes  = <the database you will build manually>
>>torque.schema.create-db.excludes = id-table-schema.xml, <the database
>>you will build manually>
>>torque.schema.init-sql.excludes = <the database you will build manually>
>>    
>>
>
>Some questions remain:
>1. How do I deal with the two different databases during runtime?
>2. How do I initilize Torque to make it use both databases?
>3. And how do I specify which classes map to which database if I generate one 
>database manually?
>
Regarding the runtime usage of your two databases, your 
torque.properties file seems to be OK.

>
>Thank you very much for further advice.
>
You're welcome

Please let me know if you succeeded building your two databases 
automatically.

Frederic




Re: Map objects to different databases

Posted by Malte Stien <ma...@stien.de>.
Hi,

Thank you for that. I will try this. In which file do I have to set the 
following lines? Is that for the runtime in Torque.properties or for the code 
generation in build.properties?

> torque.schema.sql.excludes  = <the database you will build manually>
> torque.schema.create-db.excludes = id-table-schema.xml, <the database
> you will build manually>
> torque.schema.init-sql.excludes = <the database you will build manually>

Some questions remain:
1. How do I deal with the two different databases during runtime?
2. How do I initilize Torque to make it use both databases?
3. And how do I specify which classes map to which database if I generate one 
database manually?

Thank you very much for further advice.
Malte.

On Friday 25 April 2003 16:30, Frederic Gedin wrote:
> Hi Malte
>
> Malte Stien wrote:
> >>Reading your Torque.properties extract, I do not see the cause of your
> >>problem: it looks like mine except that I use MySQL instead of postgres.
> >
> >Do you use two databases during runtime as well?
>
> Yes I do. But I ask Torque to generate only one, the other coming from
> an other application.
>
> >>  - are you sure you do not have java class names which conflict between
> >>the project and the master databases?
> >>  - are you sure that no error or exception message has been generated
> >>at build time?
> >
> >I do not have any compilation errors. My problem is not, that I cannot
> > compile the code or that Torque does not generate the Java code
> > correctly. The problem is just, that Torque does not generate
> > initialization code (i.e. the sql script) to setup two databases. So, it
> > will not use two databases during runtime as well. I just want to
> > convince Torque, that some of the tables are in the project database and
> > others are in the project master database. Torque has to consider that
> > for the database generation as well as for the database runtime usage.
> > But at the moment the first step already fails.
>
> Now I understand your problem.  I have to tell that I faced the same
> problem: Torques refuses to build two separate databases.  I did not
> investigate further because, I my case, I just really need to build one.
>
> I am sorry not being able to really help you on this.  The only advice I
> could give is to give up trying to build your two databases using Torque
> for now and continue your application development: regarding the om
> generation and the runtime, it should work fine.
> To do this you will need to update the following Torque configuration
> parameters:
> torque.schema.sql.excludes  = <the database you will build manually>
> torque.schema.create-db.excludes = id-table-schema.xml, <the database
> you will build manually>
> torque.schema.init-sql.excludes = <the database you will build manually>
>
> Another idea I just have (but I did not test it): go to your
> build-torque.xml file, and update the sql target to require for building
> the second database
> <antcall target="sql-classpath-dbmaster"/>
> <antcall target="sql-classpath-dbproj"/>
> ......
>
> And of course build the target sql-classpath-dbmaster and
> sql-classpath-dbproj according to the model sql-classpath
>
>
> Regards
>
> Frederic
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org


Re: Map objects to different databases

Posted by Frederic Gedin <fr...@Jaluna.COM>.
Hi Malte

Malte Stien wrote:

>>Reading your Torque.properties extract, I do not see the cause of your
>>problem: it looks like mine except that I use MySQL instead of postgres.
>>    
>>
>Do you use two databases during runtime as well?
>
Yes I do. But I ask Torque to generate only one, the other coming from 
an other application.

>>  - are you sure you do not have java class names which conflict between
>>the project and the master databases?
>>  - are you sure that no error or exception message has been generated
>>at build time?
>>    
>>
>I do not have any compilation errors. My problem is not, that I cannot compile 
>the code or that Torque does not generate the Java code correctly. The 
>problem is just, that Torque does not generate initialization code (i.e. the 
>sql script) to setup two databases. So, it will not use two databases during 
>runtime as well. I just want to convince Torque, that some of the tables are 
>in the project database and others are in the project master database. Torque 
>has to consider that for the database generation as well as for the database 
>runtime usage. But at the moment the first step already fails.
>  
>
Now I understand your problem.  I have to tell that I faced the same 
problem: Torques refuses to build two separate databases.  I did not 
investigate further because, I my case, I just really need to build one.

I am sorry not being able to really help you on this.  The only advice I 
could give is to give up trying to build your two databases using Torque 
for now and continue your application development: regarding the om 
generation and the runtime, it should work fine.
To do this you will need to update the following Torque configuration 
parameters:
torque.schema.sql.excludes  = <the database you will build manually>
torque.schema.create-db.excludes = id-table-schema.xml, <the database 
you will build manually>
torque.schema.init-sql.excludes = <the database you will build manually>

Another idea I just have (but I did not test it): go to your 
build-torque.xml file, and update the sql target to require for building 
the second database
<antcall target="sql-classpath-dbmaster"/>  
<antcall target="sql-classpath-dbproj"/>  
......

And of course build the target sql-classpath-dbmaster and 
sql-classpath-dbproj according to the model sql-classpath


Regards

Frederic



Re: Map objects to different databases

Posted by Malte Stien <ma...@stien.de>.
On Thursday 24 April 2003 19:27, Frederic Gedin wrote:
> I am still not sure to understand if your problem comes from the
> database generation or from the database runtime usage.  Assuming, it is
> a runtime usage problem, Torque reads database information (i.e.
> location , driver, user password) at the initialization time.  If you
> want to change database information without having to restart your
> application, maybe should you consider using OJB instead of Torque.  If
> you still want to use Torque, may should you call  Torque.init to reread
> the configuration but I am not sure that this will work if Torque has
> already been initialized.
In order to make it work, I certainly have to generated a database AND use it 
during runtime.

> Reading your Torque.properties extract, I do not see the cause of your
> problem: it looks like mine except that I use MySQL instead of postgres.
Do you use two databases during runtime as well?

> Some ideas on what you could check:
>   - are you using Torque 3.0?
Yes, I do.

>   - are you sure you do not have java class names which conflict between
> the project and the master databases?
>   - are you sure that no error or exception message has been generated
> at build time?
I do not have any compilation errors. My problem is not, that I cannot compile 
the code or that Torque does not generate the Java code correctly. The 
problem is just, that Torque does not generate initialization code (i.e. the 
sql script) to setup two databases. So, it will not use two databases during 
runtime as well. I just want to convince Torque, that some of the tables are 
in the project database and others are in the project master database. Torque 
has to consider that for the database generation as well as for the database 
runtime usage. But at the moment the first step already fails.

Best regards,
Malte.


>
> Regards
>
> Frederic
>
> >On Thursday 24 April 2003 16:50, Frederic Gedin wrote:
> >>Hi
> >>
> >>Is your problem related to the generation of the databases or to the
> >>runtime use?
> >>
> >>I never succeeded to generate two databases. Actually, I did not really
> >>try very much as my second database comes with an other application.
> >> However, using two databases at runtime works fine for me.
> >>
> >>Could you be more specific regarding your problem?
> >>
> >>Regards
> >>
> >>Frederic
> >>
> >>Malte Stien wrote:
> >>>Hello,
> >>>
> >>>I am new to torque. I set it up and went through the tutorial. It seems
> >>> to work so far. I need it for a particular project. So I have two
> >>> questions:
> >>>
> >>>1. How do I map different objects to tables in different databases. I
> >>>thought, that I can just configure two databases in Torque.properties...
> >>>
> >>>torque.database.proj.adapter=postgresql
> >>>torque.dsfactory.proj.factory=org.apache.torque.dsfactory.TorqueDataSour
> >>>ce Factory torque.dsfactory.proj.pool.defaultMaxConnections=10
> >>>torque.dsfactory.proj.pool.maxExpiryTime=3600
> >>>torque.dsfactory.proj.pool.connectionWaitTimeout=10
> >>>torque.dsfactory.proj.connection.driver = org.postgresql.Driver
> >>>torque.dsfactory.proj.connection.url =
> >>>jdbc:postgresql://localhost:5432/proj
> >>>torque.dsfactory.proj.connection.user = postgres
> >>>torque.dsfactory.proj.connection.password =
> >>>
> >>>torque.dsfactory.projmaster.factory=org.apache.torque.dsfactory.TorqueDa
> >>>ta SourceFactory
> >>> torque.dsfactory.projmaster.pool.defaultMaxConnections=10
> >>> torque.dsfactory.projmaster.pool.maxExpiryTime=3600
> >>>torque.dsfactory.projmaster.pool.connectionWaitTimeout=10
> >>>torque.dsfactory.projmaster.connection.driver = org.postgresql.Driver
> >>>torque.dsfactory.projmaster.connection.url =
> >>>jdbc:postgresql://localhost:5432/projmaster
> >>>torque.dsfactory.projmaster.connection.user = postgres
> >>>torque.dsfactory.projmaster.connection.password =
> >>>
> >>>... and then use the names "proj" and "projmaster" in my schema file.
> >>>
> >>><database name="projmaster"...>
> >>> ...
> >>></database>
> >>><database name="proj"...>
> >>> ...
> >>></database>
> >>>
> >>>But that does not seem to work. All my objects end up in projmaster no
> >>>matter what database name I use in the schema. I cannot find really much
> >>>in the documentation about that. Do the names used in the schema and the
> >>>name used in the Torque.properties have to match or are they completely
> >>>different things?
> >>>
> >>>2. How do I configure these two databases without using the
> >>>Torque.properties file? I need the user to specify the database details.
> >>>So I cannot use a static file. I cannot find really much in the
> >>>documentation about that either.
> >>>
> >>>I would be really grateful for further help. Is there a book or a piece
> >>> of good documentation apart from the javadocs? It seems not really to
> >>> be documented in a verbose way.
> >>>
> >>>Thank you.
> >>>Malte.


Re: Map objects to different databases

Posted by Frederic Gedin <fr...@Jaluna.COM>.
Hi Malte

Malte Stien wrote:

>Hi
>
>thank you for your answer. My problem is as follows: I am working on an 
>application where the user can enter and retrieve information that is to be 
>stored in a database that is specific to the particular project the user is 
>working on. (I use the word database here in the sense of a set of tables 
>rather than a RDBMS.) Each project n has a particular project database n the 
>information for this particular project is stored in. In addition - while the 
>user is working on a particular project - information is needed that is 
>common to all projects. This information is to be stored in the project 
>master database.
>
>Hence, during runtime I need access to one of the project databases and the 
>project master database. Thus, some classes are to be mapped to tables in the 
>project master database while others are to be mapped to a particular project 
>database. The project databases are all subject to the same schema. This 
>schema is different from the schema for the project master database. All 
>databases are held on a Postgresql database server. The project databases are 
>always kept on the same database server as the project master database.
>
>The user shall be able specify the project he/she wishes to work on and the 
>system opens the corresponding project database and - fully independent of 
>the project selected - the project master database. So somehow, I have to 
>convince Torque not to use the Torque.properties file but to be able to 
>specify the database during runtime.
>
>I hope, that explains my problem a bit better. Any help is highly appreciated.
>Thank you. Malte.
>
I am still not sure to understand if your problem comes from the 
database generation or from the database runtime usage.  Assuming, it is 
a runtime usage problem, Torque reads database information (i.e. 
location , driver, user password) at the initialization time.  If you 
want to change database information without having to restart your 
application, maybe should you consider using OJB instead of Torque.  If 
you still want to use Torque, may should you call  Torque.init to reread 
the configuration but I am not sure that this will work if Torque has 
already been initialized.

Reading your Torque.properties extract, I do not see the cause of your 
problem: it looks like mine except that I use MySQL instead of postgres.

Some ideas on what you could check:
  - are you using Torque 3.0?
  - are you sure you do not have java class names which conflict between 
the project and the master databases?
  - are you sure that no error or exception message has been generated 
at build time?

Regards

Frederic

>
>
>On Thursday 24 April 2003 16:50, Frederic Gedin wrote:
>  
>
>>Hi
>>
>>Is your problem related to the generation of the databases or to the
>>runtime use?
>>
>>I never succeeded to generate two databases. Actually, I did not really
>>try very much as my second database comes with an other application.
>> However, using two databases at runtime works fine for me.
>>
>>Could you be more specific regarding your problem?
>>
>>Regards
>>
>>Frederic
>>
>>Malte Stien wrote:
>>    
>>
>>>Hello,
>>>
>>>I am new to torque. I set it up and went through the tutorial. It seems to
>>>work so far. I need it for a particular project. So I have two questions:
>>>
>>>1. How do I map different objects to tables in different databases. I
>>>thought, that I can just configure two databases in Torque.properties...
>>>
>>>torque.database.proj.adapter=postgresql
>>>torque.dsfactory.proj.factory=org.apache.torque.dsfactory.TorqueDataSource
>>>Factory torque.dsfactory.proj.pool.defaultMaxConnections=10
>>>torque.dsfactory.proj.pool.maxExpiryTime=3600
>>>torque.dsfactory.proj.pool.connectionWaitTimeout=10
>>>torque.dsfactory.proj.connection.driver = org.postgresql.Driver
>>>torque.dsfactory.proj.connection.url =
>>>jdbc:postgresql://localhost:5432/proj
>>>torque.dsfactory.proj.connection.user = postgres
>>>torque.dsfactory.proj.connection.password =
>>>
>>>torque.dsfactory.projmaster.factory=org.apache.torque.dsfactory.TorqueData
>>>SourceFactory torque.dsfactory.projmaster.pool.defaultMaxConnections=10
>>>torque.dsfactory.projmaster.pool.maxExpiryTime=3600
>>>torque.dsfactory.projmaster.pool.connectionWaitTimeout=10
>>>torque.dsfactory.projmaster.connection.driver = org.postgresql.Driver
>>>torque.dsfactory.projmaster.connection.url =
>>>jdbc:postgresql://localhost:5432/projmaster
>>>torque.dsfactory.projmaster.connection.user = postgres
>>>torque.dsfactory.projmaster.connection.password =
>>>
>>>... and then use the names "proj" and "projmaster" in my schema file.
>>>
>>><database name="projmaster"...>
>>> ...
>>></database>
>>><database name="proj"...>
>>> ...
>>></database>
>>>
>>>But that does not seem to work. All my objects end up in projmaster no
>>>matter what database name I use in the schema. I cannot find really much
>>>in the documentation about that. Do the names used in the schema and the
>>>name used in the Torque.properties have to match or are they completely
>>>different things?
>>>
>>>2. How do I configure these two databases without using the
>>>Torque.properties file? I need the user to specify the database details.
>>>So I cannot use a static file. I cannot find really much in the
>>>documentation about that either.
>>>
>>>I would be really grateful for further help. Is there a book or a piece of
>>>good documentation apart from the javadocs? It seems not really to be
>>>documented in a verbose way.
>>>
>>>Thank you.
>>>Malte.
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>>>For additional commands, e-mail: torque-user-help@db.apache.org
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>>For additional commands, e-mail: torque-user-help@db.apache.org
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>For additional commands, e-mail: torque-user-help@db.apache.org
>
>
>  
>



Re: Map objects to different databases

Posted by Malte Stien <ma...@cs.anu.edu.au>.
Hi

thank you for your answer. My problem is as follows: I am working on an 
application where the user can enter and retrieve information that is to be 
stored in a database that is specific to the particular project the user is 
working on. (I use the word database here in the sense of a set of tables 
rather than a RDBMS.) Each project n has a particular project database n the 
information for this particular project is stored in. In addition - while the 
user is working on a particular project - information is needed that is 
common to all projects. This information is to be stored in the project 
master database.

Hence, during runtime I need access to one of the project databases and the 
project master database. Thus, some classes are to be mapped to tables in the 
project master database while others are to be mapped to a particular project 
database. The project databases are all subject to the same schema. This 
schema is different from the schema for the project master database. All 
databases are held on a Postgresql database server. The project databases are 
always kept on the same database server as the project master database.

The user shall be able specify the project he/she wishes to work on and the 
system opens the corresponding project database and - fully independent of 
the project selected - the project master database. So somehow, I have to 
convince Torque not to use the Torque.properties file but to be able to 
specify the database during runtime.

I hope, that explains my problem a bit better. Any help is highly appreciated.
Thank you. Malte.


On Thursday 24 April 2003 16:50, Frederic Gedin wrote:
> Hi
>
> Is your problem related to the generation of the databases or to the
> runtime use?
>
> I never succeeded to generate two databases. Actually, I did not really
> try very much as my second database comes with an other application.
>  However, using two databases at runtime works fine for me.
>
> Could you be more specific regarding your problem?
>
> Regards
>
> Frederic
>
> Malte Stien wrote:
> >Hello,
> >
> >I am new to torque. I set it up and went through the tutorial. It seems to
> >work so far. I need it for a particular project. So I have two questions:
> >
> >1. How do I map different objects to tables in different databases. I
> > thought, that I can just configure two databases in Torque.properties...
> >
> >torque.database.proj.adapter=postgresql
> >torque.dsfactory.proj.factory=org.apache.torque.dsfactory.TorqueDataSource
> >Factory torque.dsfactory.proj.pool.defaultMaxConnections=10
> >torque.dsfactory.proj.pool.maxExpiryTime=3600
> >torque.dsfactory.proj.pool.connectionWaitTimeout=10
> >torque.dsfactory.proj.connection.driver = org.postgresql.Driver
> >torque.dsfactory.proj.connection.url =
> > jdbc:postgresql://localhost:5432/proj
> > torque.dsfactory.proj.connection.user = postgres
> >torque.dsfactory.proj.connection.password =
> >
> >torque.dsfactory.projmaster.factory=org.apache.torque.dsfactory.TorqueData
> >SourceFactory torque.dsfactory.projmaster.pool.defaultMaxConnections=10
> >torque.dsfactory.projmaster.pool.maxExpiryTime=3600
> >torque.dsfactory.projmaster.pool.connectionWaitTimeout=10
> >torque.dsfactory.projmaster.connection.driver = org.postgresql.Driver
> >torque.dsfactory.projmaster.connection.url =
> >jdbc:postgresql://localhost:5432/projmaster
> >torque.dsfactory.projmaster.connection.user = postgres
> >torque.dsfactory.projmaster.connection.password =
> >
> >... and then use the names "proj" and "projmaster" in my schema file.
> >
> ><database name="projmaster"...>
> >  ...
> ></database>
> ><database name="proj"...>
> >  ...
> ></database>
> >
> >But that does not seem to work. All my objects end up in projmaster no
> > matter what database name I use in the schema. I cannot find really much
> > in the documentation about that. Do the names used in the schema and the
> > name used in the Torque.properties have to match or are they completely
> > different things?
> >
> >2. How do I configure these two databases without using the
> > Torque.properties file? I need the user to specify the database details.
> > So I cannot use a static file. I cannot find really much in the
> > documentation about that either.
> >
> >I would be really grateful for further help. Is there a book or a piece of
> >good documentation apart from the javadocs? It seems not really to be
> >documented in a verbose way.
> >
> >Thank you.
> >Malte.
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> >For additional commands, e-mail: torque-user-help@db.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org


Re: Map objects to different databases

Posted by Frederic Gedin <fr...@Jaluna.COM>.
Hi

Is your problem related to the generation of the databases or to the 
runtime use?

I never succeeded to generate two databases. Actually, I did not really 
try very much as my second database comes with an other application. 
 However, using two databases at runtime works fine for me.

Could you be more specific regarding your problem?

Regards

Frederic


Malte Stien wrote:

>Hello,
>
>I am new to torque. I set it up and went through the tutorial. It seems to 
>work so far. I need it for a particular project. So I have two questions:
>
>1. How do I map different objects to tables in different databases. I thought, 
>that I can just configure two databases in Torque.properties...
>
>torque.database.proj.adapter=postgresql
>torque.dsfactory.proj.factory=org.apache.torque.dsfactory.TorqueDataSourceFactory
>torque.dsfactory.proj.pool.defaultMaxConnections=10
>torque.dsfactory.proj.pool.maxExpiryTime=3600
>torque.dsfactory.proj.pool.connectionWaitTimeout=10
>torque.dsfactory.proj.connection.driver = org.postgresql.Driver
>torque.dsfactory.proj.connection.url = jdbc:postgresql://localhost:5432/proj
>torque.dsfactory.proj.connection.user = postgres
>torque.dsfactory.proj.connection.password =
>
>torque.dsfactory.projmaster.factory=org.apache.torque.dsfactory.TorqueDataSourceFactory
>torque.dsfactory.projmaster.pool.defaultMaxConnections=10
>torque.dsfactory.projmaster.pool.maxExpiryTime=3600
>torque.dsfactory.projmaster.pool.connectionWaitTimeout=10
>torque.dsfactory.projmaster.connection.driver = org.postgresql.Driver
>torque.dsfactory.projmaster.connection.url = 
>jdbc:postgresql://localhost:5432/projmaster
>torque.dsfactory.projmaster.connection.user = postgres
>torque.dsfactory.projmaster.connection.password =
>
>... and then use the names "proj" and "projmaster" in my schema file.
>
><database name="projmaster"...>
>  ...
></database>
><database name="proj"...>
>  ...
></database>
>
>But that does not seem to work. All my objects end up in projmaster no matter 
>what database name I use in the schema. I cannot find really much in the 
>documentation about that. Do the names used in the schema and the name used 
>in the Torque.properties have to match or are they completely different 
>things?
>
>2. How do I configure these two databases without using the Torque.properties 
>file? I need the user to specify the database details. So I cannot use a 
>static file. I cannot find really much in the documentation about that 
>either.
>
>I would be really grateful for further help. Is there a book or a piece of 
>good documentation apart from the javadocs? It seems not really to be 
>documented in a verbose way.
>
>Thank you.
>Malte.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>For additional commands, e-mail: torque-user-help@db.apache.org
>
>
>  
>



Map objects to different databases

Posted by Malte Stien <ma...@cs.anu.edu.au>.
Hello,

I am new to torque. I set it up and went through the tutorial. It seems to 
work so far. I need it for a particular project. So I have two questions:

1. How do I map different objects to tables in different databases. I thought, 
that I can just configure two databases in Torque.properties...

torque.database.proj.adapter=postgresql
torque.dsfactory.proj.factory=org.apache.torque.dsfactory.TorqueDataSourceFactory
torque.dsfactory.proj.pool.defaultMaxConnections=10
torque.dsfactory.proj.pool.maxExpiryTime=3600
torque.dsfactory.proj.pool.connectionWaitTimeout=10
torque.dsfactory.proj.connection.driver = org.postgresql.Driver
torque.dsfactory.proj.connection.url = jdbc:postgresql://localhost:5432/proj
torque.dsfactory.proj.connection.user = postgres
torque.dsfactory.proj.connection.password =

torque.dsfactory.projmaster.factory=org.apache.torque.dsfactory.TorqueDataSourceFactory
torque.dsfactory.projmaster.pool.defaultMaxConnections=10
torque.dsfactory.projmaster.pool.maxExpiryTime=3600
torque.dsfactory.projmaster.pool.connectionWaitTimeout=10
torque.dsfactory.projmaster.connection.driver = org.postgresql.Driver
torque.dsfactory.projmaster.connection.url = 
jdbc:postgresql://localhost:5432/projmaster
torque.dsfactory.projmaster.connection.user = postgres
torque.dsfactory.projmaster.connection.password =

... and then use the names "proj" and "projmaster" in my schema file.

<database name="projmaster"...>
  ...
</database>
<database name="proj"...>
  ...
</database>

But that does not seem to work. All my objects end up in projmaster no matter 
what database name I use in the schema. I cannot find really much in the 
documentation about that. Do the names used in the schema and the name used 
in the Torque.properties have to match or are they completely different 
things?

2. How do I configure these two databases without using the Torque.properties 
file? I need the user to specify the database details. So I cannot use a 
static file. I cannot find really much in the documentation about that 
either.

I would be really grateful for further help. Is there a book or a piece of 
good documentation apart from the javadocs? It seems not really to be 
documented in a verbose way.

Thank you.
Malte.


Re: OrderBy NullPointerException

Posted by Tak Fujimoto <t-...@beingcorp.co.jp>.
hello,

I had the same problem with torque-3.0.
I believe the column 'PASSWD' is varchar.
I think addAscendingOrderByColumn() only works for Integer key.
I couldn't solve the problem so I gave up.

Hope you'll find a workaround.

> I experienced a mysterious behaviour with torque-gen-3.1-alpha1
> When use OrderBy. Why?
------
>      [junit] java.lang.NullPointerException
------
> Test Program
> 
>             crit = new Criteria();
>             crit.addAscendingOrderByColumn(TPassPeer.PASSWD);
>             list = TPassPeer.doSelect(crit);