Oshyshki,
Your call to Service.say is outside the scope of the Lift HTTP request, so
it's not wrapped with the transaction management stuff. You could insert:
DB.use(DefaultConnectionIdentifier) {
ignore =>
On Thu, Nov 12, 2009 at 5:16 PM, oshyshko <[email protected]> wrote:
>
> Hello David,
>
> I have added some DB stuff + added "S.addAround(DB.buildLoanWrapper)"
> But the code produces separate transactions.
>
> For example, this code:
> =========================================
> class Service {
> def say(message: String) {
> println(message)
>
> (0 to 5).foreach( i => User.findAll )
> }
> }
> =========================================
>
>
> Produces this SQL:
> =========================================
> 091113 2:59:24 6 Query SET autocommit=0
> 6 Query SET autocommit=0
> 6 Query commit
> 6 Query SET autocommit=0
> 6 Query SET autocommit=0
> 6 Query commit
> 6 Query SET autocommit=0
> 6 Query SET autocommit=0
> 6 Query SELECT user_t.id FROM user_t
> 6 Query commit
> 6 Query SET autocommit=0
> 6 Query SET autocommit=0
> 6 Query SELECT user_t.id FROM user_t
> 6 Query commit
> 6 Query SET autocommit=0
> 6 Query SET autocommit=0
> 6 Query SELECT user_t.id FROM user_t
> 6 Query commit
> 6 Query SET autocommit=0
> 6 Query SET autocommit=0
> 6 Query SELECT user_t.id FROM user_t
> 6 Query commit
> 6 Query SET autocommit=0
> 6 Query SET autocommit=0
> 6 Query SELECT user_t.id FROM user_t
> 6 Query commit
> 6 Query SET autocommit=0
> 6 Query SET autocommit=0
> 6 Query SELECT user_t.id FROM user_t
> 6 Query commit
> =========================================
>
> Basically it behaves like when LiftFilter url mapping was commented in
> "web.xml".
>
> I have updated http://github.com/oshyshko/lift_vs_blazeds
>
> To reproduce it:
>
> 1. mysql -> create database demo;
>
> 2. Enable MySQL query logging by editing "my.ini" + restart MySQL
> daemon:
> [mysqld]
> log=mysql-log.log
>
> 3. Open separate console to watch what's going on
> $ tail -f mysql-log.log
>
> 4. mvn jetty:run-exploded
>
> 5. Open http://localhost:8080/ + click "Say it"
>
> 6. Observe 7 transactions instead of 1 in the log
> should =>
> 6. Observe all queries inside 1 transaction in the log
>
> On Nov 13, 2:29 am, David Pollak <[email protected]>
> wrote:
> > the issue is the new debugging help screen in dev mode got in the way of
> the
> > passing not found... so...
> >
>
> >
>
--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---