Transaction and entity

Posts   
 
    
matlaf
User
Posts: 95
Joined: 25-Jan-2005
# Posted on: 16-Feb-2006 17:16:35   

Hi,

I saw in the adapter code that is retain reference to all object who participating in the active transaction.

My code insert more that 2000 entity and the GC cannot collect entity memory until the adapter commit or rollback the transaction.

I cannot eliminate the transaction.

How can I solve this issue or how can workaround this issue?

Thanks,

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 16-Feb-2006 17:28:37   

The entities participating in the transaction are tracked, so if the transaction has to rollback, the entities are rolled back internally. This is a given, if you don't want that, don't start a transaction. As soon as the transaction is committed or rolledback the list is cleared and memory can be reclaimed.

Frans Bouma | Lead developer LLBLGen Pro
matlaf
User
Posts: 95
Joined: 25-Jan-2005
# Posted on: 16-Feb-2006 17:34:58   

Why the entities is tracked and rolled back internally if I don't use context?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 16-Feb-2006 18:23:01   

matlaf wrote:

Why the entities is tracked and rolled back internally if I don't use context?

If your entity has an identity PK, and it's inserted succesfully but the transaction is aborted later on, you don't want that PK field to have a value, so it's rolled back.

Frans Bouma | Lead developer LLBLGen Pro
matlaf
User
Posts: 95
Joined: 25-Jan-2005
# Posted on: 16-Feb-2006 19:19:50   

Thanks I understand nowsimple_smile

matlaf
User
Posts: 95
Joined: 25-Jan-2005
# Posted on: 17-Feb-2006 02:14:58   

We have to do batch insert (like file import, data conversion),

Can you think about a solution, for the next version, where the DataAccessAdapter don't have reference to entities when this entities are saved in transaction? Like two mode, normal and batch.

It's very important to us.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 17-Feb-2006 09:31:27   

I wont add that. If you want that, you can simply not start the transaction. I don't see why having 2000 entities in memory for a short time (which are there anyway, it's not as if the GC will DIRECTLY clean them up, it's more like every 15 minutes or so) is such a big problem: you can't avoid having the 2000 entities in memory during the transaction, even if the tracking is disabled.

Frans Bouma | Lead developer LLBLGen Pro
matlaf
User
Posts: 95
Joined: 25-Jan-2005
# Posted on: 17-Feb-2006 14:57:59   

Ok I understand.

If you think that is not an important issue I can do nothing for it, but I just like to have choice to do what I want (enable tracking or disable tracking).

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39749
Joined: 17-Aug-2003
# Posted on: 17-Feb-2006 17:52:42   

matlaf wrote:

Ok I understand.

If you think that is not an important issue I can do nothing for it, but I just like to have choice to do what I want (enable tracking or disable tracking).

I understand, but it would leave the entities in an unknown state if the transaction rolls back (or commits for that matter). Sorry.

Frans Bouma | Lead developer LLBLGen Pro