db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Monroe" <Greg.Mon...@DukeCE.com>
Subject RE: Cache problem after delete
Date Thu, 16 Nov 2006 19:38:31 GMT
First, I'd suggest upgrading to the latest version of
Torque (3.2 / 3.3 coming soon!) from 3.0.  There have
been a lot of things fixed, etc.

Next, Torque does not have a delayed delete mechanism.
When you make the delete call, it does a JDBC delete
call to the DB right then.  Note that currently loaded 
OM objects are not effect/updated by this. (Other than
the one used to make the delete gets it's isNew() status
updated).

FWIW, it's much safer to delete stuff by using criteria
than objects.  If the object does not have a primary key
to identify it, then the delete statement becomes a
based on a concatenation of all the properties.  Things
like default values can cause the object not to be found
and deleted. Hmm, any one remember if 3.0 cared about PKs...
I seem to remember it was added later.

Anyway, if your table has primary Keys, try using:

ClassNamePeer.doDelete(deleteObject.getPrimaryKey());

If not, construct an identifying criteria and use this.

Hmm, another thought, based on your Torque can't find it
and JDBC can, is that your Torque.properties setting might 
be pointing to a different location than JDBC.  E.g., 
development DB for Torque vs JDBC using production DB?

Good luck.


> -----Original Message-----
> From: Ivan Ivankovic [mailto:ivan.ivankovic@pamet.co.yu] 
> Sent: Thursday, November 16, 2006 12:42 PM
> To: torque-user@db.apache.org
> Subject: Cache problem after delete
> 
> Hi, 
> 
>  
> 
> I worked with Torque only for past 2 weeks, and I found it 
> very useful. 
> 
>  
> 
> I use Torque 3.0 with Postgres and have following problem:
> 
> After deleting some concrete object with usual 
> ClassNamePeer.doDelete(objectToDelete), I can still see it in 
> database when querying for that objects information with plain JDBC. 
> 
>  
> 
> When I use any of Torque query methods, via Criteria or 
> retrieveByPK(key), object seems to be erased, but some parts 
> of application I am working on use JDBC so I can't rewrite 
> all code to use Torque BasePeer.executeQuery(queryString). 
> Database data for this object can also be seen from Squirrel 
> JDBC browser which of course uses plain JDBC. 
> 
>  
> 
> I suppose that Torque has some delayed deletion mechanism and 
> I need some way to make him do the actual deletion completely 
> from database. Is there some kind of "flush" to achieve this? 
> 
>  
> 
> Regards,
> 
> Ivanko
> 
> 

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



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


Mime
View raw message