cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pirola Davide" <>
Subject RE: Deleting old data
Date Wed, 28 Jun 2006 09:54:07 GMT
Hi Andrus,
Thanks for your response.
As usaul, you have reason... is my fault :-D
There is an exception in my code, that was not logged .. so i haven't noticed it.
Now all works well.

-----Original Message-----
From: Andrus Adamchik []
Sent: mercoledì 28 giugno 2006 11.37
Cc: Pirola Davide
Subject: Re: Deleting old data

The way you described it is the right way: context.deleteObject(..);  
context.commitChanges(). So I guess you'll need to check the code to  
see why nothing gets deleted. Maybe nothing gets selected in the  
first place? Does select query prints a result count that is greater  
than zero?


P.S. Looks like your email address is not subscribed to the list, so  
you will not receive replies not cc'd to you directly.

On Jun 27, 2006, at 10:43 AM, Pirola Davide wrote:

> Hi all,
> i have a problem with the "DELETE" operation.
> I have "TimerTask" that every 5 minutes load data from an Oracle  
> Database and insert them into HsqlDb (locale to the application).
> So every 5 minutes my table on HSQLDB receive some "INSERT" commands.
> I do this with this peace of code:
> for (....all my objects)
> {
> 	datacontext.registerNewObject(myobject)
> 	datacontext.commitChanges()
> }
> But, first of all, i need to "DELETE" data that are older than 60  
> minutes.
> So i try to delete these data in this way:
> 1) i execute a SELECT query on the table (HSQLDB)getting all record  
> that are older than 60 minutes.
> 2) for every object retrived, i execute "datacontext.delete(myobject)"
> 3) at the end i call "datacontext.commitChanges()".
> I expect to see some "DELETE" query over my HSQLDB... but nothing  
> appen :-S
> So no data are deleted... and my database grow :(
> There is another way for doing this task... execute directly the  
> delete query:
> this way.. the data in the table are deleted, but cayenne  
> takes in the Heap (Old Gen) the reference of the old objects... so  
> the garbage collector can't remove them from memory.(memory leak)
> So question is... which is the right way to delete data in a table  
> using cayenne?
> Thanks,
> Davide

View raw message