« Return to Thread: No Hibernate Session bound to thread

Re: No Hibernate Session bound to thread

by Brad Booth :: Rate this Message:

Reply to Author | View in Thread

What error message are getting now?  What is in the errors collection  
on your domain class?

Sent from my iPhone

On Jun 24, 2009, at 5:18 AM, ray211 <raystiegler@...> wrote:

>
> This still isn't working.  Let me paste my code:
>
> class RvdRecordService {
>   static expose = ['jms']
>   static destination = "dataQueue"
>
>   boolean transactional = false
>   def backgroundService
>
> def onMessage = {
>
>   // This method will take my JMS msg and build a list of records  
> from it.
>   def curRecords = parseJson(it).toList()
>
>   // Looping through a list of records that were parsed from a JSON  
> string
> received by a JMS msg.
>   curRecords.each { curRcd ->
>      if (curRcd) {
>
>         backgroundService.execute("Whatever comment you like", {
>            // RcdFact is a domain class.
>            def myRcd = new RcdFact()
>            myRcd.name = curRcd.name
>            // etc...
>            // At this point in the debugger myRcd has the proper data.
>
>            // This line fails to save the record to the database.
>            myRcd.save()
>           } )
>      }
>   }
> }
>
> BTW, I know my connection to the database is valid.
>
> THANKS AGAIN!!!
>
>
> Brad Booth wrote:
>>
>> The closure should contain the database work that needs to be  
>> done.  In
>> the
>> example you game "it" will not be your object.  What you need to do  
>> is
>> something like this...
>>
>> backgroundService.execute("Whatever comment you like", {
>>  def foo = Foo.get(someId)
>>  foo.bar = "some value"
>>  foo.save()
>> }
>>
>>
>> On Tue, Jun 23, 2009 at 4:47 PM, ray211 <raystiegler@...>  
>> wrote:
>>
>>>
>>> I think I am real close.  However, I am still having a problem.
>>>
>>> When I try to do my DB write:
>>> backgroundService.execute("DB Write " + count.toString(), {it.save
>>> ()} )
>>>
>>> I get the following error:
>>> Caused by: groovy.lang.MissingMethodException: No signature of  
>>> method:
>>> static RcdFact.save() is applicable for argument types: () values:  
>>> []
>>> --
>>> View this message in context:
>>> http://www.nabble.com/No-Hibernate-Session-bound-to-thread-tp24169249p24176403.html
>>> Sent from the grails - dev mailing list archive at Nabble.com.
>>>
>>>
>>> ---
>>> ------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>   http://xircles.codehaus.org/manage_email
>>>
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/No-Hibernate-Session-bound-to-thread-tp24169249p24183693.html
> Sent from the grails - dev mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

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

    http://xircles.codehaus.org/manage_email


 « Return to Thread: No Hibernate Session bound to thread