Hello!

1. Session should not be used directly to update an object (unless
some special circumstances, e.g, you are updating multiple entries
with one query, but it is tricky). Probably you should use something
like this:

try{
    Dbo::Transaction transaction(session);
    Dbo::ptr<MailAccount> mail_account = session.load<MailAccount>(id);
    mail_account.modify()->username = uname;
    transaction.commit();
}catch(Dbo::Exception &a) {

2. It seems not to be needed to reset WApplication on database error.
rereadAll() in catch should be done under transaction and also under
try (I am not sure, that internal try is needed, correct me, if it is
not truth).

try {
Dbo::Transaction transaction(session);
session.rereadAll();
transaction.commit();
} catch (...) { }
return;
}

You can move this code to
http://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WApplication.html#a4a6f167bea94aefa8ba24f914c2fbee5
not to copy it each time.

3. About "A collection for '...' is already in use. Reentrant
statement use is not yet implemented."
This exception seems to be thrown, if there are two the same
SqlStatement's. Code you used (session.execute) may cause this. But it
looks unrelated with other problems, mentioned here.

On Wed, Feb 29, 2012 at 04:16, Denis Talakevich
<denis.talakev...@onat.edu.ua> wrote:
> when using construction:
>
> try{
>     Dbo::Transaction transaction(session);
>     session.execute("update public.mail_accounts set username=
> ?").bind(uname).where("id= ?").bind(id);
>     transaction.commit();
> }catch(Dbo::Exception &a) { msg(1,"error"); session.rereadAll();  return; }
>
> after exception was catched, next sql commands return error like :
>
> A collection for '...' is already in use. Reentrant statement use is
>
> not yet implemented.
>
>
> and there is no way to fix it without reset WApplication session
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> witty-interest mailing list
> witty-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to