Quantcast

grails gorm not flushing

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

grails gorm not flushing

Michael Kimsal-2
sent a few hours ago from a different account and it didn't take.
apologies if this ends up being a dupe.

----------------------------------------------------------------
Having a devil of a time with GORM updates not flushing to the DB

Info: Grails 1.3.5 and MySQL 5.1

In a controller, I've got

   def dummyaction =
   {
     def t = Event.get(1128710);
     t.comment = System.currentTimeMillis();
     t.save(flush:true)
     render(t.version)
   }

When I'm hitting this, repeatedly, I see the version going up, but

select * from event where id=1128710;

continues to show the 'version 0' version of data.

tried grails.gorm.autoflush=true in Config.groovy - no luck.

Any pointers/help?
==========================
Michael Kimsal
http://www.groovymag.com
for groovy and grails developers
919-827-4724


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: grails gorm not flushing

xmly
try t.validate to check some errors or check  save  success or not ?


On Thu, Feb 10, 2011 at 1:33 PM, Michael Kimsal <[hidden email]> wrote:
sent a few hours ago from a different account and it didn't take.
apologies if this ends up being a dupe.

----------------------------------------------------------------
Having a devil of a time with GORM updates not flushing to the DB

Info: Grails 1.3.5 and MySQL 5.1

In a controller, I've got

  def dummyaction =
  {
    def t = Event.get(1128710);
    t.comment = System.currentTimeMillis();
    t.save(flush:true)
    render(t.version)
  }

When I'm hitting this, repeatedly, I see the version going up, but

select * from event where id=1128710;

continues to show the 'version 0' version of data.

tried grails.gorm.autoflush=true in Config.groovy - no luck.

Any pointers/help?
==========================
Michael Kimsal
http://www.groovymag.com
for groovy and grails developers
919-827-4724


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: grails gorm not flushing

Michael Kimsal-2
Should have mentioned that before - there's no errors.

 def dummyaction =
  {
    def t = Event.get(1128710);
    t.comment = System.currentTimeMillis();
    t.validate()
    render(t.errors)
    render("<BR>")
    t.save(flush:true)
    render(t.version)
  }

hitting that dummyaction I'll get

org.springframework.validation.BeanPropertyBindingResult: 0 errors
27

then

org.springframework.validation.BeanPropertyBindingResult: 0 errors
28

and so on.

The values are getting saved in memory (hibernate cache?) or perhaps it's in an 
overarching all-encompassing transaction which I didn't ask for and don't want.
In any case, the data is working, sort of, but I can't guarantee anything (or 
do any outside verification) because it's not persisting.  Why doesn't flush:true 
actually flush?

What else should I be looking for?



On Feb 10, 2011, at 1:37 PM, Gavin Yue wrote:

try t.validate to check some errors or check  save  success or not ?


On Thu, Feb 10, 2011 at 1:33 PM, Michael Kimsal <[hidden email]> wrote:
sent a few hours ago from a different account and it didn't take.
apologies if this ends up being a dupe.

----------------------------------------------------------------
Having a devil of a time with GORM updates not flushing to the DB

Info: Grails 1.3.5 and MySQL 5.1

In a controller, I've got

  def dummyaction =
  {
    def t = Event.get(1128710);
    t.comment = System.currentTimeMillis();
    t.save(flush:true)
    render(t.version)
  }

When I'm hitting this, repeatedly, I see the version going up, but

select * from event where id=1128710;

continues to show the 'version 0' version of data.

tried grails.gorm.autoflush=true in Config.groovy - no luck.

Any pointers/help?
==========================
Michael Kimsal
http://www.groovymag.com
for groovy and grails developers
919-827-4724


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




==========================
for groovy and grails developers
919-827-4724

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: grails gorm not flushing

Michael Kimsal-2
There's a transaction that is getting started when I hit that dummyaction in the controller, 
and it's not letting go.  I'm seeing this in the mysql client via "show engine innodb status".

If I try to update the same record manually (from mysql client) after hitting the 
dummyaction in the controller, it hangs, because there's a row lock on that particular 
record.

Obviously I'm missing something big.  I've no idea where in my code a transaction would be 
started (or even what that code would look like) - I tend to do plain-vanilla grails stuff, and this 
is baffling me.

I updated the connector jar to the latest, just on the off chance there was an issue there.


On Feb 10, 2011, at 1:43 PM, Michael Kimsal wrote:

Should have mentioned that before - there's no errors.

 def dummyaction =
  {
    def t = Event.get(1128710);
    t.comment = System.currentTimeMillis();
    t.validate()
    render(t.errors)
    render("<BR>")
    t.save(flush:true)
    render(t.version)
  }

hitting that dummyaction I'll get

org.springframework.validation.BeanPropertyBindingResult: 0 errors
27

then

org.springframework.validation.BeanPropertyBindingResult: 0 errors
28

and so on.

The values are getting saved in memory (hibernate cache?) or perhaps it's in an 
overarching all-encompassing transaction which I didn't ask for and don't want.
In any case, the data is working, sort of, but I can't guarantee anything (or 
do any outside verification) because it's not persisting.  Why doesn't flush:true 
actually flush?

What else should I be looking for?



On Feb 10, 2011, at 1:37 PM, Gavin Yue wrote:

try t.validate to check some errors or check  save  success or not ?


On Thu, Feb 10, 2011 at 1:33 PM, Michael Kimsal <[hidden email]> wrote:
sent a few hours ago from a different account and it didn't take.
apologies if this ends up being a dupe.

----------------------------------------------------------------
Having a devil of a time with GORM updates not flushing to the DB

Info: Grails 1.3.5 and MySQL 5.1

In a controller, I've got

  def dummyaction =
  {
    def t = Event.get(1128710);
    t.comment = System.currentTimeMillis();
    t.save(flush:true)
    render(t.version)
  }

When I'm hitting this, repeatedly, I see the version going up, but

select * from event where id=1128710;

continues to show the 'version 0' version of data.

tried grails.gorm.autoflush=true in Config.groovy - no luck.

Any pointers/help?
==========================
Michael Kimsal
http://www.groovymag.com
for groovy and grails developers
919-827-4724


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




==========================
for groovy and grails developers
919-827-4724


==========================
for groovy and grails developers
919-827-4724

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: grails gorm not flushing

xmly
tried your code. Did not get the same error....
Could you try it on a fresh project?

On Thu, Feb 10, 2011 at 2:12 PM, Michael Kimsal <[hidden email]> wrote:
There's a transaction that is getting started when I hit that dummyaction in the controller, 
and it's not letting go.  I'm seeing this in the mysql client via "show engine innodb status".

If I try to update the same record manually (from mysql client) after hitting the 
dummyaction in the controller, it hangs, because there's a row lock on that particular 
record.

Obviously I'm missing something big.  I've no idea where in my code a transaction would be 
started (or even what that code would look like) - I tend to do plain-vanilla grails stuff, and this 
is baffling me.

I updated the connector jar to the latest, just on the off chance there was an issue there.


On Feb 10, 2011, at 1:43 PM, Michael Kimsal wrote:

Should have mentioned that before - there's no errors.

 def dummyaction =
  {
    def t = Event.get(1128710);
    t.comment = System.currentTimeMillis();
    t.validate()
    render(t.errors)
    render("<BR>")
    t.save(flush:true)
    render(t.version)
  }

hitting that dummyaction I'll get

org.springframework.validation.BeanPropertyBindingResult: 0 errors
27

then

org.springframework.validation.BeanPropertyBindingResult: 0 errors
28

and so on.

The values are getting saved in memory (hibernate cache?) or perhaps it's in an 
overarching all-encompassing transaction which I didn't ask for and don't want.
In any case, the data is working, sort of, but I can't guarantee anything (or 
do any outside verification) because it's not persisting.  Why doesn't flush:true 
actually flush?

What else should I be looking for?



On Feb 10, 2011, at 1:37 PM, Gavin Yue wrote:

try t.validate to check some errors or check  save  success or not ?


On Thu, Feb 10, 2011 at 1:33 PM, Michael Kimsal <[hidden email]> wrote:
sent a few hours ago from a different account and it didn't take.
apologies if this ends up being a dupe.

----------------------------------------------------------------
Having a devil of a time with GORM updates not flushing to the DB

Info: Grails 1.3.5 and MySQL 5.1

In a controller, I've got

  def dummyaction =
  {
    def t = Event.get(1128710);
    t.comment = System.currentTimeMillis();
    t.save(flush:true)
    render(t.version)
  }

When I'm hitting this, repeatedly, I see the version going up, but

select * from event where id=1128710;

continues to show the 'version 0' version of data.

tried grails.gorm.autoflush=true in Config.groovy - no luck.

Any pointers/help?
==========================
Michael Kimsal
http://www.groovymag.com
for groovy and grails developers
919-827-4724


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




==========================
for groovy and grails developers
919-827-4724


==========================
for groovy and grails developers
919-827-4724


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: grails gorm not flushing

Michael Kimsal-2
I just did.  It's not exhibiting the behaviour there, so it's something in my code, 
but I've no idea what I should look for.

FWIW, the current app, when started fresh, does not show any transactions 
via show engine innodb status.  However, when *all* I do is run that one action, 
it gets hung.  I will keep looking.

Any other pointers to look for from anyone are appreciated.

Thanks.

On Feb 10, 2011, at 2:28 PM, Gavin Yue wrote:

tried your code. Did not get the same error....
Could you try it on a fresh project?

On Thu, Feb 10, 2011 at 2:12 PM, Michael Kimsal <[hidden email]> wrote:
There's a transaction that is getting started when I hit that dummyaction in the controller, 
and it's not letting go.  I'm seeing this in the mysql client via "show engine innodb status".

If I try to update the same record manually (from mysql client) after hitting the 
dummyaction in the controller, it hangs, because there's a row lock on that particular 
record.

Obviously I'm missing something big.  I've no idea where in my code a transaction would be 
started (or even what that code would look like) - I tend to do plain-vanilla grails stuff, and this 
is baffling me.

I updated the connector jar to the latest, just on the off chance there was an issue there.


On Feb 10, 2011, at 1:43 PM, Michael Kimsal wrote:

Should have mentioned that before - there's no errors.

 def dummyaction =
  {
    def t = Event.get(1128710);
    t.comment = System.currentTimeMillis();
    t.validate()
    render(t.errors)
    render("<BR>")
    t.save(flush:true)
    render(t.version)
  }

hitting that dummyaction I'll get

org.springframework.validation.BeanPropertyBindingResult: 0 errors
27

then

org.springframework.validation.BeanPropertyBindingResult: 0 errors
28

and so on.

The values are getting saved in memory (hibernate cache?) or perhaps it's in an 
overarching all-encompassing transaction which I didn't ask for and don't want.
In any case, the data is working, sort of, but I can't guarantee anything (or 
do any outside verification) because it's not persisting.  Why doesn't flush:true 
actually flush?

What else should I be looking for?



On Feb 10, 2011, at 1:37 PM, Gavin Yue wrote:

try t.validate to check some errors or check  save  success or not ?


On Thu, Feb 10, 2011 at 1:33 PM, Michael Kimsal <[hidden email]> wrote:
sent a few hours ago from a different account and it didn't take.
apologies if this ends up being a dupe.

----------------------------------------------------------------
Having a devil of a time with GORM updates not flushing to the DB

Info: Grails 1.3.5 and MySQL 5.1

In a controller, I've got

  def dummyaction =
  {
    def t = Event.get(1128710);
    t.comment = System.currentTimeMillis();
    t.save(flush:true)
    render(t.version)
  }

When I'm hitting this, repeatedly, I see the version going up, but

select * from event where id=1128710;

continues to show the 'version 0' version of data.

tried grails.gorm.autoflush=true in Config.groovy - no luck.

Any pointers/help?
==========================
Michael Kimsal
http://www.groovymag.com
for groovy and grails developers
919-827-4724


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




==========================
for groovy and grails developers
919-827-4724


==========================
for groovy and grails developers
919-827-4724



==========================
for groovy and grails developers
919-827-4724

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: grails gorm not flushing

Michael Kimsal-2
A quick update - this is not solved for me, but I did find that if I issue a KILL on the 
mysql thread in question, then carry on, everything's fine.  This is definitely bizarre.  

Of course, yet again, I find myself with a problem no one has ever encountered 
and can't reproduce.  Isn't programming grand?  :/

The problem very well may PEBCAK, but I have no idea where/how to begin 
looking to track it down.

On Feb 10, 2011, at 2:31 PM, Michael Kimsal wrote:

I just did.  It's not exhibiting the behaviour there, so it's something in my code, 
but I've no idea what I should look for.

FWIW, the current app, when started fresh, does not show any transactions 
via show engine innodb status.  However, when *all* I do is run that one action, 
it gets hung.  I will keep looking.

Any other pointers to look for from anyone are appreciated.

Thanks.

On Feb 10, 2011, at 2:28 PM, Gavin Yue wrote:

tried your code. Did not get the same error....
Could you try it on a fresh project?

On Thu, Feb 10, 2011 at 2:12 PM, Michael Kimsal <[hidden email]> wrote:
There's a transaction that is getting started when I hit that dummyaction in the controller, 
and it's not letting go.  I'm seeing this in the mysql client via "show engine innodb status".

If I try to update the same record manually (from mysql client) after hitting the 
dummyaction in the controller, it hangs, because there's a row lock on that particular 
record.

Obviously I'm missing something big.  I've no idea where in my code a transaction would be 
started (or even what that code would look like) - I tend to do plain-vanilla grails stuff, and this 
is baffling me.

I updated the connector jar to the latest, just on the off chance there was an issue there.


On Feb 10, 2011, at 1:43 PM, Michael Kimsal wrote:

Should have mentioned that before - there's no errors.

 def dummyaction =
  {
    def t = Event.get(1128710);
    t.comment = System.currentTimeMillis();
    t.validate()
    render(t.errors)
    render("<BR>")
    t.save(flush:true)
    render(t.version)
  }

hitting that dummyaction I'll get

org.springframework.validation.BeanPropertyBindingResult: 0 errors
27

then

org.springframework.validation.BeanPropertyBindingResult: 0 errors
28

and so on.

The values are getting saved in memory (hibernate cache?) or perhaps it's in an 
overarching all-encompassing transaction which I didn't ask for and don't want.
In any case, the data is working, sort of, but I can't guarantee anything (or 
do any outside verification) because it's not persisting.  Why doesn't flush:true 
actually flush?

What else should I be looking for?



On Feb 10, 2011, at 1:37 PM, Gavin Yue wrote:

try t.validate to check some errors or check  save  success or not ?


On Thu, Feb 10, 2011 at 1:33 PM, Michael Kimsal <[hidden email]> wrote:
sent a few hours ago from a different account and it didn't take.
apologies if this ends up being a dupe.

----------------------------------------------------------------
Having a devil of a time with GORM updates not flushing to the DB

Info: Grails 1.3.5 and MySQL 5.1

In a controller, I've got

  def dummyaction =
  {
    def t = Event.get(1128710);
    t.comment = System.currentTimeMillis();
    t.save(flush:true)
    render(t.version)
  }

When I'm hitting this, repeatedly, I see the version going up, but

select * from event where id=1128710;

continues to show the 'version 0' version of data.

tried grails.gorm.autoflush=true in Config.groovy - no luck.

Any pointers/help?
==========================
Michael Kimsal
http://www.groovymag.com
for groovy and grails developers
919-827-4724


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




==========================
for groovy and grails developers
919-827-4724


==========================
for groovy and grails developers
919-827-4724



==========================
for groovy and grails developers
919-827-4724


==========================
for groovy and grails developers
919-827-4724

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: grails gorm not flushing

Daniel Henrique Alves Lima
In reply to this post by Michael Kimsal-2
        Try to rewrite this as a Service:


class SomeService {

    static transactional = true

    def updateEvent(evtId) {
       def t = Event.get(evtId);
       t.comment = System.currentTimeMillis();
       t.save(flush:true, failOnError: true)
       return t
    }

}


        In your controller:

        def someService

        def dummyaction = {
           def t = someService.updateEvent(1128710)
            render(t.version)
        }


        Are you getting any Exception in your log file (after the view rendering)?

        You can always activate Hibernate log. Try option A first (Config.groovy):


        A)

        debug 'org.hibernate.SQL'

        B)

        debug 'org.hibernate.SQL'
               'org.hibernate.transaction'

        C)

        debug 'org.hibernate.SQL'
               'org.hibernate.transaction'

      trace 'org.hibernate.type'





        Best regards,

                Daniel.


Michael Kimsal wrote:
> sent a few hours ago from a different account and it didn't take.
> apologies if this ends up being a dupe.
>
> ----------------------------------------------------------------
> Having a devil of a time with GORM updates not flushing to the DB
>
> (...)

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: grails gorm not flushing

Michael Kimsal-2
Thanks.

The rewriting isn't something I'm going to do - this is simply illustrating a larger problem I'm seeing.  Some code is already in services, and some isn't.  Something is going awry with whatever setup and code I have such that even if the only thing I do is *get* a domain class (nothing else) I get a transaction that never commits.

No exceptions are being thrown anywhere.

I'm logging all queries to mysql and not seeing anything odd, and have loggingSQL = true already.  I will look at hibernate logging as described below to see if I see anything else.


On Feb 10, 2011, at 3:37 PM, Daniel Henrique Alves Lima wrote:

> Try to rewrite this as a Service:
>
>
> class SomeService {
>
>   static transactional = true
>
>   def updateEvent(evtId) {
>      def t = Event.get(evtId);
>      t.comment = System.currentTimeMillis();
>      t.save(flush:true, failOnError: true)
>      return t
>   }
>
> }
>
>
> In your controller:
>
> def someService
>
> def dummyaction = {
>   def t = someService.updateEvent(1128710)
>           render(t.version)
> }
>
>
> Are you getting any Exception in your log file (after the view rendering)?
>
> You can always activate Hibernate log. Try option A first (Config.groovy):
>
>
> A)
>
> debug 'org.hibernate.SQL'
>
> B)
>
> debug 'org.hibernate.SQL'
>              'org.hibernate.transaction'
>
> C)
>
> debug 'org.hibernate.SQL'
>              'org.hibernate.transaction'
>
>     trace 'org.hibernate.type'
>
>
>
>
>
> Best regards,
>
> Daniel.
>
>
> Michael Kimsal wrote:
>> sent a few hours ago from a different account and it didn't take.
>> apologies if this ends up being a dupe.
>> ---------------------------------------------------------------- Having a devil of a time with GORM updates not flushing to the DB
>> (...)
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>

==========================
Michael Kimsal
http://www.groovymag.com
for groovy and grails developers
919-827-4724


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: grails gorm not flushing

Michael Kimsal-2
FWIW, removing the jdbc-pool plugin seems to have resolved this.  I've not had time to delve deeper yet, but the behaviour stopped when I removed that (actually, that and dbmigrate, but I don't think dbmigrate would have any effect on runtime behaviour).

On Feb 10, 2011, at 3:54 PM, Michael Kimsal wrote:

> Thanks.
>
> The rewriting isn't something I'm going to do - this is simply illustrating a larger problem I'm seeing.  Some code is already in services, and some isn't.  Something is going awry with whatever setup and code I have such that even if the only thing I do is *get* a domain class (nothing else) I get a transaction that never commits.
>
> No exceptions are being thrown anywhere.
>
> I'm logging all queries to mysql and not seeing anything odd, and have loggingSQL = true already.  I will look at hibernate logging as described below to see if I see anything else.
>
>
> On Feb 10, 2011, at 3:37 PM, Daniel Henrique Alves Lima wrote:
>
>> Try to rewrite this as a Service:
>>
>>
>> class SomeService {
>>
>>  static transactional = true
>>
>>  def updateEvent(evtId) {
>>     def t = Event.get(evtId);
>>     t.comment = System.currentTimeMillis();
>>     t.save(flush:true, failOnError: true)
>>     return t
>>  }
>>
>> }
>>
>>
>> In your controller:
>>
>> def someService
>>
>> def dummyaction = {
>>   def t = someService.updateEvent(1128710)
>>          render(t.version)
>> }
>>
>>
>> Are you getting any Exception in your log file (after the view rendering)?
>>
>> You can always activate Hibernate log. Try option A first (Config.groovy):
>>
>>
>> A)
>>
>> debug 'org.hibernate.SQL'
>>
>> B)
>>
>> debug 'org.hibernate.SQL'
>>             'org.hibernate.transaction'
>>
>> C)
>>
>> debug 'org.hibernate.SQL'
>>             'org.hibernate.transaction'
>>
>>   trace 'org.hibernate.type'
>>
>>
>>
>>
>>
>> Best regards,
>>
>> Daniel.
>>
>>
>> Michael Kimsal wrote:
>>> sent a few hours ago from a different account and it didn't take.
>>> apologies if this ends up being a dupe.
>>> ---------------------------------------------------------------- Having a devil of a time with GORM updates not flushing to the DB
>>> (...)
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>  http://xircles.codehaus.org/manage_email
>>
>>
>
> ==========================
> Michael Kimsal
> http://www.groovymag.com
> for groovy and grails developers
> 919-827-4724
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

==========================
Michael Kimsal
http://www.groovymag.com
for groovy and grails developers
919-827-4724


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Loading...