db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From CP Lim <cp_...@redsheriff.com>
Subject Re: Attn: PostgreSQL users
Date Thu, 06 Feb 2003 22:30:03 GMT
Hi Scott,

Been using postgreSQL and Torque (v3.0) for a while now and was reading 
through your FAQ and looking at the section on using "native" 
(sequences) jogged my memory on my Torque.properties file.

My Torque settings are is as follows:

-------------------------------------
torque.database.default=drop4
torque.database.default.adapter=postgresql #its using 'default' as name
-------------------------------------

which has a different _property name_ from the default setting supplied 
by the newapp application:

-------------------------------------
torque.database.default=newapp
torque.database.newapp.adapter=postgresql # using 'newapp' as name
-------------------------------------

If I changed my settings to mirror that of newapp's, ie.

-------------------------------------
torque.database.default=drop4
torque.database.drop4.adapter=postgresql
-------------------------------------

I can no longer insert into the table and the following exception is thrown
-------------------------------------
Caused by: org.apache.torque.TorqueException: IdGenerator for table 
'rs_user' is null
	at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:690)
	at 
com.redsheriff.core.torque.BaseRsUserPeer.doInsert(BaseRsUserPeer.java:267)
	at 
com.redsheriff.core.torque.BaseRsUserPeer.doInsert(BaseRsUserPeer.java:652)
	at com.redsheriff.core.torque.BaseRsUser.save(BaseRsUser.java:1039)
	at com.redsheriff.admeasure.core.AMUserMgr.save(AMUserMgr.java:371)
-------------------------------------

I've debugged through the Torque v3.0 source and it looks like in the 
BasePeer.doInsert(Criteria, Connection) method,  the IdGenerator object 
returned (line 674) is null.  Examining this further it turns out that 
the DatabaseMap object does in fact contain a reference to the native 
IdGenerator, but is mapped to the name 'drop4'.  So when its configured 
as above (I think) its using 'default' as the key so null (IdGenerator) 
is returned.

My question is: Is this a bug or have I misunderstood the 
Torque.properties configuration file?

(Sorry about the long winded email, but had to illustrate what I was 
experiencing).

cheers,
CP


Scott Eade wrote:
> I am toying with the idea of switching from MySQL to PostgreSQL and so I am
> looking through all of the problems people seem to be having.  I have
> summarised my findings so far on the wiki:
> 
> http://nagoya.apache.org/wiki/apachewiki.cgi?TorqueProjectPages/PostgreSQLFA
> Q
> 
> If the existing PostgreSQL users can add to this page it would he helpful
> not only to me, but also to everyone else that is either currently using or
> considering using PostgreSQL.
> 
> I will commit the four noted issues, as long as I can get confirmation that
> they are necessary (and after I am able to access the new db-torque cvs
> module).
> 
> If we can flesh the other points out we should be able to integrate the
> result back into the postgresql-howto.
> 
> Note that as things currently stand I don't think I am going to have the
> time necessary to actually switch to PostgreSQL, but most of the highlighted
> issues seem fairly close to resolution so we may as well attack them.
> 
> Cheers,
> 
> Scott


-- 
R E D S H E R I F F
C.P. Lim - Software Engineer
Level 1, 10 Queens Road    +61 3 9864 0733 tel
Melbourne VIC              +61 3 9864 0778 fax
Australia                  +61 413 781 846 mob

This message and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they are 
addressed. If you are not the intended recipient, you are hereby 
notified that any use or dissemination of this communication is strictly 
prohibited. If you have received this message in error please notify us 
immediately by return email or telephone +61 (3) 9659 0432, then delete 
this message. Any views expressed in this message are those of the 
individual sender and many not necessarily reflect the views of Red 
Sheriff.


Mime
View raw message