Quantcast

Getting the datastore in a grails 2.0.1 project

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

Getting the datastore in a grails 2.0.1 project

Andréas Kühne
Hi all,

I have been trying to create a AbstractPersistenceEventListener. The problem is however that the documentation for this is incorrect and I can't seem to find anything about it on the Internet either. 

So what I need to do is get the following code working in my plugin: 

def doWithApplicationContext = { applicationContext ->

        applicationContext.addApplicationListener(new PersistentEventListener("getDatastore()"))

}

I know that the getDatastore part is not correct, but does anyone know how to get it?

Regards,

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

Re: Getting the datastore in a grails 2.0.1 project

burtbeckwith
Which GORM impl are you using? The Mongo datastore is registered as the "mongoDatastore" bean and the Redis one is the "redisDatastore" bean. So you would use

        applicationContext.addApplicationListener(newPersistentEventListener(applicationContext.mongoDatastore))

or

        applicationContext.addApplicationListener(newPersistentEventListener(applicationContext.redisDatastore))

Burt

Andréas Kühne wrote
Hi all,

I have been trying to create a AbstractPersistenceEventListener. The
problem is however that the documentation for this is incorrect and I can't
seem to find anything about it on the Internet either.

So what I need to do is get the following code working in my plugin:

def doWithApplicationContext = { applicationContext ->

        applicationContext.addApplicationListener(newPersistentEventListener("getDatastore()"))

}
I know that the getDatastore part is not correct, but does anyone know how
to get it?

Regards,

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

Re: Getting the datastore in a grails 2.0.1 project

Graeme Rocher-4
Administrator
In reply to this post by Andréas Kühne
Just add your PersistentEventListener as a spring bean in resources.groovy

myListener(PersistentEventListener)

It will be picked up automatically

On Sat, Mar 31, 2012 at 2:55 PM, Andréas Kühne <[hidden email]> wrote:

> Hi all,
>
> I have been trying to create a AbstractPersistenceEventListener. The problem
> is however that the documentation for this is incorrect and I can't seem to
> find anything about it on the Internet either.
>
> So what I need to do is get the following code working in my plugin:
>
> def doWithApplicationContext = { applicationContext ->
>
>         applicationContext.addApplicationListener(new
> PersistentEventListener("getDatastore()"))
>
> }
>
> I know that the getDatastore part is not correct, but does anyone know how
> to get it?
>
> Regards,
>
> Andréas



--
Graeme Rocher
Grails Project Lead
SpringSource - A Division of VMware
http://www.springsource.com

---------------------------------------------------------------------
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: Getting the datastore in a grails 2.0.1 project

Andréas Kühne
Hi again,

The problem is it is in a plugin project. Can I do it in the plugin so that it starts up with whatever project it is in?

// Andréas

Den 3 april 2012 10:13 skrev Graeme Rocher <[hidden email]>:
Just add your PersistentEventListener as a spring bean in resources.groovy

myListener(PersistentEventListener)

It will be picked up automatically

On Sat, Mar 31, 2012 at 2:55 PM, Andréas Kühne <[hidden email]> wrote:
> Hi all,
>
> I have been trying to create a AbstractPersistenceEventListener. The problem
> is however that the documentation for this is incorrect and I can't seem to
> find anything about it on the Internet either.
>
> So what I need to do is get the following code working in my plugin:
>
> def doWithApplicationContext = { applicationContext ->
>
>         applicationContext.addApplicationListener(new
> PersistentEventListener("getDatastore()"))
>
> }
>
> I know that the getDatastore part is not correct, but does anyone know how
> to get it?
>
> Regards,
>
> Andréas



--
Graeme Rocher
Grails Project Lead
SpringSource - A Division of VMware
http://www.springsource.com

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

   http://xircles.codehaus.org/manage_email





--
vänliga hälsningar,

Andréas

Upplandsgatan 93 . 113 44 . Stockholm
Mobil <a href="tel:076%20543%208825" value="+46765438825" target="_blank">076 543 8825
[hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Getting the datastore in a grails 2.0.1 project

Andréas Kühne
In reply to this post by burtbeckwith
I am using MySQL, however this is in a plugin project, so I wouldn't want to use a specific GORM impl, just the one the user is using...

// Andréas

Den 2 april 2012 20:36 skrev burtbeckwith <[hidden email]>:
Which GORM impl are you using? The Mongo datastore is registered as the
"mongoDatastore" bean and the Redis one is the "redisDatastore" bean. So you
would use


applicationContext.addApplicationListener(newPersistentEventListener(applicationContext.mongoDatastore))

or


applicationContext.addApplicationListener(newPersistentEventListener(applicationContext.redisDatastore))

Burt


Andréas Kühne wrote
>
> Hi all,
>
> I have been trying to create a AbstractPersistenceEventListener. The
> problem is however that the documentation for this is incorrect and I
> can't
> seem to find anything about it on the Internet either.
>
> So what I need to do is get the following code working in my plugin:
>
> def doWithApplicationContext = { applicationContext ->
>
>
> applicationContext.addApplicationListener(newPersistentEventListener("getDatastore()"))
>
> }
> I know that the getDatastore part is not correct, but does anyone know how
> to get it?
>
> Regards,
>
> Andréas
>


--
View this message in context: http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4526866.html
Sent from the Grails - user mailing list archive at Nabble.com.

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

   http://xircles.codehaus.org/manage_email





--
vänliga hälsningar,

Andréas

Upplandsgatan 93 . 113 44 . Stockholm
Mobil 076 543 8825
[hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Getting the datastore in a grails 2.0.1 project

Andréas Kühne
In reply to this post by Graeme Rocher-4
Could you elaborate a bit on this? I tried it, but still need to get the datastore from somewhere. How would the code look in resources.groovy?

Den 3 april 2012 10:13 skrev Graeme Rocher <[hidden email]>:
Just add your PersistentEventListener as a spring bean in resources.groovy

myListener(PersistentEventListener)

It will be picked up automatically

On Sat, Mar 31, 2012 at 2:55 PM, Andréas Kühne <[hidden email]> wrote:
> Hi all,
>
> I have been trying to create a AbstractPersistenceEventListener. The problem
> is however that the documentation for this is incorrect and I can't seem to
> find anything about it on the Internet either.
>
> So what I need to do is get the following code working in my plugin:
>
> def doWithApplicationContext = { applicationContext ->
>
>         applicationContext.addApplicationListener(new
> PersistentEventListener("getDatastore()"))
>
> }
>
> I know that the getDatastore part is not correct, but does anyone know how
> to get it?
>
> Regards,
>
> Andréas



--
Graeme Rocher
Grails Project Lead
SpringSource - A Division of VMware
http://www.springsource.com

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

   http://xircles.codehaus.org/manage_email





--
vänliga hälsningar,

Andréas

Upplandsgatan 93 . 113 44 . Stockholm
Mobil 076 543 8825
[hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Getting the datastore in a grails 2.0.1 project

Ian Roberts
In reply to this post by Andréas Kühne
On 03/04/2012 19:34, Andréas Kühne wrote:
> Hi again,
>
> The problem is it is in a plugin project. Can I do it in the plugin so
> that it starts up with whatever project it is in?

The plugin equivalent of resources.groovy is the doWithSpring closure in
the plugin descriptor.

Ian

--
Ian Roberts               | Department of Computer Science
[hidden email]  | University of Sheffield, UK

---------------------------------------------------------------------
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: Getting the datastore in a grails 2.0.1 project

Andréas Kühne
Thanks Ian,

I now know how to set it up so that it runs when the plugin is attached. But I still am having a problem when trying to instantiate the event listener. If I try to create a bean without any parameters I get the following errors:
Error executing script TestApp: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistentEventListener': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [grails.plugin.nestedset.domain.PersistentEventListener]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: org.grails.datastore.mapping.engine.event.AbstractPersistenceEventListener: method <init>()V not found (Use --stacktrace to see the full trace)

So I still need the datastore...

// Andréas

Den 4 april 2012 11:17 skrev Ian Roberts <[hidden email]>:
On 03/04/2012 19:34, Andréas Kühne wrote:
> Hi again,
>
> The problem is it is in a plugin project. Can I do it in the plugin so
> that it starts up with whatever project it is in?

The plugin equivalent of resources.groovy is the doWithSpring closure in
the plugin descriptor.

Ian

--
Ian Roberts               | Department of Computer Science
[hidden email]  | University of Sheffield, UK

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

   http://xircles.codehaus.org/manage_email





--
vänliga hälsningar,

Andréas

Upplandsgatan 93 . 113 44 . Stockholm
Mobil 076 543 8825
[hidden email]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Getting the datastore in a grails 2.0.1 project

sfarfarini
This post has NOT been accepted by the mailing list yet.
Hi, i get this thread from the graveyard because I have the same issue.

I'm trying to extend AbstractPersistenceEventListener as explained in the documentation, using grails 2.1.0.
Anyway, I have the same issue while registering the listener (in bootstrap, in resorces.groovy, always the same).

Right now I'm testing the functionality in a plain application, but this project is intended to be a plugin, so the datastore need to be also provided by the application.

I cannot find a working solution.

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

Re: Getting the datastore in a grails 2.0.1 project

jason.stlouis
In reply to this post by Andréas Kühne
Did anyone ever figure this out? I am trying to accomplish the same thing and get the same exception when not providing a datastore as a constructor parameter ("method <init>()V not found") and can't find out how to reference the default datastore (my project that includes the plugin just uses default hibernate/gorm)

For full information, I'm trying to do this from a plugin, I've defined my own extension to AbstractPersistenceEventListener and am defining it in my plugin definition in the doWithSpring closure :

    def doWithSpring = {
        ownedPersistenceEventListener(OwnedPersistenceEventListener, null) {
            springSecurityService = ref('springSecurityService')
        }
    }

I can get it to load and it is executed on events when using this definition, but the PersistentEntity in the AbstractPersistenceEvent is always null - I presume if it actually had access to the datastore it wouldn't be.

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

Re: Getting the datastore in a grails 2.0.1 project

Graeme Rocher-4
Administrator
Depending what datastore you're targeting (hibernate, mongo etc.) you can do:

    def doWithSpring = {
        ownedPersistenceEventListener(OwnedPersistenceEventListener,
ref("hibernateDatastore")) {
            springSecurityService = ref('springSecurityService')
        }
    }

Or

    def doWithSpring = {
        ownedPersistenceEventListener(OwnedPersistenceEventListener,
ref("mongoDatastore")) {
            springSecurityService = ref('springSecurityService')
        }
    }

Cheers
On Mon, Aug 27, 2012 at 9:02 PM, jason.stlouis <[hidden email]> wrote:

> Did anyone ever figure this out? I am trying to accomplish the same thing and
> get the same exception when not providing a datastore as a constructor
> parameter ("method <init>()V not found") and can't find out how to reference
> the default datastore (my project that includes the plugin just uses default
> hibernate/gorm)
>
> For full information, I'm trying to do this from a plugin, I've defined my
> own extension to AbstractPersistenceEventListener and am defining it in my
> plugin definition in the doWithSpring closure :
>
>     def doWithSpring = {
>         ownedPersistenceEventListener(OwnedPersistenceEventListener, null) {
>             springSecurityService = ref('springSecurityService')
>         }
>     }
>
> I can get it to load and it is executed on events when using this
> definition, but the PersistentEntity in the AbstractPersistenceEvent is
> always null - I presume if it actually had access to the datastore it
> wouldn't be.
>
>
>
>
>
> --
> View this message in context: http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633842.html
> Sent from the Grails - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>



--
Graeme Rocher
Grails Project Lead
SpringSource - A Division of VMware
http://www.springsource.com

---------------------------------------------------------------------
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: Getting the datastore in a grails 2.0.1 project

jason.stlouis
That didn't work - here's the error message I receive:

| Error 2012-08-28 08:44:33,868 [pool-5-thread-1] ERROR context.GrailsContextLoader  - Error executing bootstraps: Error creating bean with name 'ownedPersistenceEventListener': Cannot resolve reference to bean 'hibernateDatastore' while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'hibernateDatastore' is defined
Message: Error creating bean with name 'ownedPersistenceEventListener': Cannot resolve reference to bean 'hibernateDatastore' while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'hibernateDatastore' is defined
   Line | Method
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|   138 | run      in java.util.concurrent.FutureTask
|   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
|   908 | run      in     ''
^   662 | run . .  in java.lang.Thread

Caused by NoSuchBeanDefinitionException: No bean named 'hibernateDatastore' is defined
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|   138 | run      in java.util.concurrent.FutureTask
|   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
|   908 | run      in     ''
^   662 | run . .  in java.lang.Thread

I put a little snippet in Boostrap.groovy to output the names of all the beans in the applicationContext and I don't see hibernateDatastore in there.

I am just using the default gorm implementation right now as this is a new app. I only have the following additional plugins installed:
fields 1.3
spring-security-core 1.2.7.3
twitter-bootstrap 2.1.0

I've actually accomplished what I want to do by defining dynamic beforeInsert and beforeUpdate methods in the doWithDynamicMethods section of my domain plugin.  However, I really want to see this method working since my current solution won't allow me to define beforeInsert/beforeUpdate methods directly on any domain classes that are affected that my doWithDynamicMethods affects without overwriting those dynamic methods. 

Any help would be appreciated.

Jason

On Tue, Aug 28, 2012 at 1:42 AM, Graeme Rocher-4 [via Grails] <[hidden email]> wrote:
Depending what datastore you're targeting (hibernate, mongo etc.) you can do:

    def doWithSpring = {
        ownedPersistenceEventListener(OwnedPersistenceEventListener,
ref("hibernateDatastore")) {
            springSecurityService = ref('springSecurityService')
        }
    }

Or

    def doWithSpring = {
        ownedPersistenceEventListener(OwnedPersistenceEventListener,
ref("mongoDatastore")) {
            springSecurityService = ref('springSecurityService')
        }
    }

Cheers
On Mon, Aug 27, 2012 at 9:02 PM, jason.stlouis <[hidden email]> wrote:

> Did anyone ever figure this out? I am trying to accomplish the same thing and
> get the same exception when not providing a datastore as a constructor
> parameter ("method <init>()V not found") and can't find out how to reference
> the default datastore (my project that includes the plugin just uses default
> hibernate/gorm)
>
> For full information, I'm trying to do this from a plugin, I've defined my
> own extension to AbstractPersistenceEventListener and am defining it in my
> plugin definition in the doWithSpring closure :
>
>     def doWithSpring = {
>         ownedPersistenceEventListener(OwnedPersistenceEventListener, null) {
>             springSecurityService = ref('springSecurityService')
>         }
>     }
>
> I can get it to load and it is executed on events when using this
> definition, but the PersistentEntity in the AbstractPersistenceEvent is
> always null - I presume if it actually had access to the datastore it
> wouldn't be.
>
>
>
>
>
> --
> View this message in context: http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633842.html
> Sent from the Grails - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>



--
Graeme Rocher
Grails Project Lead
SpringSource - A Division of VMware
http://www.springsource.com

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

    http://xircles.codehaus.org/manage_email





If you reply to this email, your message will be added to the discussion below:
http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633868.html
To unsubscribe from Getting the datastore in a grails 2.0.1 project, click here.
NAML

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

Re: Getting the datastore in a grails 2.0.1 project

Graeme Rocher-4
Administrator
Well looking at the code that does this in the various plugins, they
don't use Spring config to achieve what you're trying to achieve. What
they do is:

    void configure(ConfigurableApplicationContext ctx) {
        final datastore =
ctx.getBean("${datastoreType.toLowerCase()}Datastore", Datastore)
        ctx.addApplicationListener new DomainEventListener(datastore)
        ctx.addApplicationListener new AutoTimestampEventListener(datastore)
    }

Which happens after the ApplicationContext is built. You would have to
do this in your application I would guess. To do this with a BootStrap
class you would have to do:

class BootStrap implements ApplicationContextAware {

   ApplicationContext applicationContext
   def init = {
        def datastores = applicationContext.getBeansOfType(Datastore)
        for(d in datastores) {
            applicationContext.addApplicationListener new MyEventListener(d)
        }
   }
}

Note: untested code

Cheers

On Tue, Aug 28, 2012 at 4:04 PM, jason.stlouis <[hidden email]> wrote:

> That didn't work - here's the error message I receive:
>
> | Error 2012-08-28 08:44:33,868 [pool-5-thread-1] ERROR
> context.GrailsContextLoader  - Error executing bootstraps: Error creating
> bean with name 'ownedPersistenceEventListener': Cannot resolve reference to
> bean 'hibernateDatastore' while setting constructor argument; nested
> exception is
> org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
> named 'hibernateDatastore' is defined
> Message: Error creating bean with name 'ownedPersistenceEventListener':
> Cannot resolve reference to bean 'hibernateDatastore' while setting
> constructor argument; nested exception is
> org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
> named 'hibernateDatastore' is defined
>    Line | Method
> ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> |   138 | run      in java.util.concurrent.FutureTask
> |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
> |   908 | run      in     ''
> ^   662 | run . .  in java.lang.Thread
>
> Caused by NoSuchBeanDefinitionException: No bean named 'hibernateDatastore'
> is defined
> ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> |   138 | run      in java.util.concurrent.FutureTask
> |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
> |   908 | run      in     ''
> ^   662 | run . .  in java.lang.Thread
>
> I put a little snippet in Boostrap.groovy to output the names of all the
> beans in the applicationContext and I don't see hibernateDatastore in there.
>
> I am just using the default gorm implementation right now as this is a new
> app. I only have the following additional plugins installed:
> fields 1.3
> spring-security-core 1.2.7.3
> twitter-bootstrap 2.1.0
>
> I've actually accomplished what I want to do by defining dynamic
> beforeInsert and beforeUpdate methods in the doWithDynamicMethods section of
> my domain plugin.  However, I really want to see this method working since
> my current solution won't allow me to define beforeInsert/beforeUpdate
> methods directly on any domain classes that are affected that my
> doWithDynamicMethods affects without overwriting those dynamic methods.
>
> Any help would be appreciated.
>
> Jason
>
> On Tue, Aug 28, 2012 at 1:42 AM, Graeme Rocher-4 [via Grails] <[hidden
> email]> wrote:
>>
>> Depending what datastore you're targeting (hibernate, mongo etc.) you can
>> do:
>>
>>     def doWithSpring = {
>>         ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> ref("hibernateDatastore")) {
>>             springSecurityService = ref('springSecurityService')
>>         }
>>     }
>>
>> Or
>>
>>     def doWithSpring = {
>>         ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> ref("mongoDatastore")) {
>>             springSecurityService = ref('springSecurityService')
>>         }
>>     }
>>
>> Cheers
>> On Mon, Aug 27, 2012 at 9:02 PM, jason.stlouis <[hidden email]> wrote:
>>
>> > Did anyone ever figure this out? I am trying to accomplish the same
>> > thing and
>> > get the same exception when not providing a datastore as a constructor
>> > parameter ("method <init>()V not found") and can't find out how to
>> > reference
>> > the default datastore (my project that includes the plugin just uses
>> > default
>> > hibernate/gorm)
>> >
>> > For full information, I'm trying to do this from a plugin, I've defined
>> > my
>> > own extension to AbstractPersistenceEventListener and am defining it in
>> > my
>> > plugin definition in the doWithSpring closure :
>> >
>> >     def doWithSpring = {
>> >         ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> > null) {
>> >             springSecurityService = ref('springSecurityService')
>> >         }
>> >     }
>> >
>> > I can get it to load and it is executed on events when using this
>> > definition, but the PersistentEntity in the AbstractPersistenceEvent is
>> > always null - I presume if it actually had access to the datastore it
>> > wouldn't be.
>> >
>> >
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> > http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633842.html
>> > Sent from the Grails - user mailing list archive at Nabble.com.
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe from this list, please visit:
>> >
>> >     http://xircles.codehaus.org/manage_email
>> >
>> >
>>
>>
>>
>> --
>> Graeme Rocher
>> Grails Project Lead
>> SpringSource - A Division of VMware
>> http://www.springsource.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>>
>> ________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633868.html
>> To unsubscribe from Getting the datastore in a grails 2.0.1 project, click
>> here.
>> NAML
>
>
>
> ________________________________
> View this message in context: Re: Getting the datastore in a grails 2.0.1
> project
>
> Sent from the Grails - user mailing list archive at Nabble.com.



--
Graeme Rocher
Grails Project Lead
SpringSource - A Division of VMware
http://www.springsource.com

---------------------------------------------------------------------
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: Getting the datastore in a grails 2.0.1 project

jason.stlouis
Thanks for trying to help Graeme but this still does not work for me:

I put the following in my Bootstrap:

class BootStrap {

    def init = { servletContext ->
        log.debug "Running Application Bootstrap"
        log.debug  "Listing available datastores"  
        def applicationContext = servletContext.getAttribute(ApplicationAttributes.APPLICATION_CONTEXT)   
        def datastores = applicationContext.getBeansOfType(Datastore) 
        log.debug  "Datastore count: ${datastores.size()}"
        for(d in datastores) { 
            log.debug  "Datastore: ${d}"
            //applicationContext.addApplicationListener new OwnedPersistenceEventListener(d) 
        }          

And see the following in the log: 

2012-08-29 09:52:08,129 [pool-5-thread-1] DEBUG conf.BootStrap  - Running Application Bootstrap
2012-08-29 09:52:08,129 [pool-5-thread-1] DEBUG conf.BootStrap  - Listing datastores
2012-08-29 09:52:08,132 [pool-5-thread-1] DEBUG conf.BootStrap  - Datastore count: 0

This is far more complicated than the documentation in 6.5.1 for Custom Event Listeners led me to believe.

On Wed, Aug 29, 2012 at 1:53 AM, Graeme Rocher-4 [via Grails] <[hidden email]> wrote:
Well looking at the code that does this in the various plugins, they
don't use Spring config to achieve what you're trying to achieve. What
they do is:

    void configure(ConfigurableApplicationContext ctx) {
        final datastore =
ctx.getBean("${datastoreType.toLowerCase()}Datastore", Datastore)
        ctx.addApplicationListener new DomainEventListener(datastore)
        ctx.addApplicationListener new AutoTimestampEventListener(datastore)
    }

Which happens after the ApplicationContext is built. You would have to
do this in your application I would guess. To do this with a BootStrap
class you would have to do:

class BootStrap implements ApplicationContextAware {

   ApplicationContext applicationContext
   def init = {
        def datastores = applicationContext.getBeansOfType(Datastore)
        for(d in datastores) {
            applicationContext.addApplicationListener new MyEventListener(d)
        }
   }
}

Note: untested code

Cheers

On Tue, Aug 28, 2012 at 4:04 PM, jason.stlouis <[hidden email]> wrote:

> That didn't work - here's the error message I receive:
>
> | Error 2012-08-28 08:44:33,868 [pool-5-thread-1] ERROR
> context.GrailsContextLoader  - Error executing bootstraps: Error creating
> bean with name 'ownedPersistenceEventListener': Cannot resolve reference to
> bean 'hibernateDatastore' while setting constructor argument; nested
> exception is
> org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
> named 'hibernateDatastore' is defined
> Message: Error creating bean with name 'ownedPersistenceEventListener':
> Cannot resolve reference to bean 'hibernateDatastore' while setting
> constructor argument; nested exception is
> org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
> named 'hibernateDatastore' is defined
>    Line | Method
> ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> |   138 | run      in java.util.concurrent.FutureTask
> |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
> |   908 | run      in     ''
> ^   662 | run . .  in java.lang.Thread
>
> Caused by NoSuchBeanDefinitionException: No bean named 'hibernateDatastore'
> is defined
> ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> |   138 | run      in java.util.concurrent.FutureTask
> |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
> |   908 | run      in     ''
> ^   662 | run . .  in java.lang.Thread
>
> I put a little snippet in Boostrap.groovy to output the names of all the
> beans in the applicationContext and I don't see hibernateDatastore in there.
>
> I am just using the default gorm implementation right now as this is a new
> app. I only have the following additional plugins installed:
> fields 1.3
> spring-security-core 1.2.7.3
> twitter-bootstrap 2.1.0
>
> I've actually accomplished what I want to do by defining dynamic
> beforeInsert and beforeUpdate methods in the doWithDynamicMethods section of
> my domain plugin.  However, I really want to see this method working since
> my current solution won't allow me to define beforeInsert/beforeUpdate
> methods directly on any domain classes that are affected that my
> doWithDynamicMethods affects without overwriting those dynamic methods.
>
> Any help would be appreciated.
>
> Jason
>
> On Tue, Aug 28, 2012 at 1:42 AM, Graeme Rocher-4 [via Grails] <[hidden

> email]> wrote:
>>
>> Depending what datastore you're targeting (hibernate, mongo etc.) you can
>> do:
>>
>>     def doWithSpring = {
>>         ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> ref("hibernateDatastore")) {
>>             springSecurityService = ref('springSecurityService')
>>         }
>>     }
>>
>> Or
>>
>>     def doWithSpring = {
>>         ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> ref("mongoDatastore")) {
>>             springSecurityService = ref('springSecurityService')
>>         }
>>     }
>>
>> Cheers
>> On Mon, Aug 27, 2012 at 9:02 PM, jason.stlouis <[hidden email]> wrote:
>>
>> > Did anyone ever figure this out? I am trying to accomplish the same
>> > thing and
>> > get the same exception when not providing a datastore as a constructor
>> > parameter ("method <init>()V not found") and can't find out how to
>> > reference
>> > the default datastore (my project that includes the plugin just uses
>> > default
>> > hibernate/gorm)
>> >
>> > For full information, I'm trying to do this from a plugin, I've defined
>> > my
>> > own extension to AbstractPersistenceEventListener and am defining it in
>> > my
>> > plugin definition in the doWithSpring closure :
>> >
>> >     def doWithSpring = {
>> >         ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> > null) {
>> >             springSecurityService = ref('springSecurityService')
>> >         }
>> >     }
>> >
>> > I can get it to load and it is executed on events when using this
>> > definition, but the PersistentEntity in the AbstractPersistenceEvent is
>> > always null - I presume if it actually had access to the datastore it
>> > wouldn't be.
>> >
>> >
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> > http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633842.html
>> > Sent from the Grails - user mailing list archive at Nabble.com.

>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe from this list, please visit:
>> >
>> >     http://xircles.codehaus.org/manage_email
>> >
>> >
>>
>>
>>
>> --
>> Graeme Rocher
>> Grails Project Lead
>> SpringSource - A Division of VMware
>> http://www.springsource.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>>
>> ________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633868.html
>> To unsubscribe from Getting the datastore in a grails 2.0.1 project, click
>> here.
>> NAML
>
>
>
> ________________________________
> View this message in context: Re: Getting the datastore in a grails 2.0.1
> project
>
> Sent from the Grails - user mailing list archive at Nabble.com.



--
Graeme Rocher
Grails Project Lead
SpringSource - A Division of VMware
http://www.springsource.com

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

    http://xircles.codehaus.org/manage_email





If you reply to this email, your message will be added to the discussion below:
http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633962.html
To unsubscribe from Getting the datastore in a grails 2.0.1 project, click here.
NAML

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

Re: Getting the datastore in a grails 2.0.1 project

Graeme Rocher-4
Administrator
Hmm yeah we do need to make this easier and improve the documentation.

It seems we never register a bean for the HibernateDatastore, you'll
probably need to create your own instance:

        MappingContext mappingContext =
ctx.getBean("grailsDomainClassMappingContext", MappingContext)
        SessionFactory sessionFactory = ctx.getBean("sessionFactory")
        final datastore = new HibernateDatastore(mappingContext,
sessionFactory, ctx, application.config)

Sorry for the hassle

Cheers

On Wed, Aug 29, 2012 at 4:57 PM, jason.stlouis <[hidden email]> wrote:

> Thanks for trying to help Graeme but this still does not work for me:
>
> I put the following in my Bootstrap:
>
> class BootStrap {
>
>     def init = { servletContext ->
>         log.debug "Running Application Bootstrap"
>         log.debug  "Listing available datastores"
>         def applicationContext =
> servletContext.getAttribute(ApplicationAttributes.APPLICATION_CONTEXT)
>         def datastores = applicationContext.getBeansOfType(Datastore)
>         log.debug  "Datastore count: ${datastores.size()}"
>         for(d in datastores) {
>             log.debug  "Datastore: ${d}"
>             //applicationContext.addApplicationListener new
> OwnedPersistenceEventListener(d)
>         }
>
> And see the following in the log:
>
> 2012-08-29 09:52:08,129 [pool-5-thread-1] DEBUG conf.BootStrap  - Running
> Application Bootstrap
> 2012-08-29 09:52:08,129 [pool-5-thread-1] DEBUG conf.BootStrap  - Listing
> datastores
> 2012-08-29 09:52:08,132 [pool-5-thread-1] DEBUG conf.BootStrap  - Datastore
> count: 0
>
> This is far more complicated than the documentation in 6.5.1 for Custom
> Event Listeners led me to believe.
>
> On Wed, Aug 29, 2012 at 1:53 AM, Graeme Rocher-4 [via Grails] <[hidden
> email]> wrote:
>>
>> Well looking at the code that does this in the various plugins, they
>> don't use Spring config to achieve what you're trying to achieve. What
>> they do is:
>>
>>     void configure(ConfigurableApplicationContext ctx) {
>>         final datastore =
>> ctx.getBean("${datastoreType.toLowerCase()}Datastore", Datastore)
>>         ctx.addApplicationListener new DomainEventListener(datastore)
>>         ctx.addApplicationListener new
>> AutoTimestampEventListener(datastore)
>>     }
>>
>> Which happens after the ApplicationContext is built. You would have to
>> do this in your application I would guess. To do this with a BootStrap
>> class you would have to do:
>>
>> class BootStrap implements ApplicationContextAware {
>>
>>    ApplicationContext applicationContext
>>    def init = {
>>         def datastores = applicationContext.getBeansOfType(Datastore)
>>         for(d in datastores) {
>>             applicationContext.addApplicationListener new
>> MyEventListener(d)
>>         }
>>    }
>> }
>>
>> Note: untested code
>>
>> Cheers
>>
>> On Tue, Aug 28, 2012 at 4:04 PM, jason.stlouis <[hidden email]> wrote:
>>
>> > That didn't work - here's the error message I receive:
>> >
>> > | Error 2012-08-28 08:44:33,868 [pool-5-thread-1] ERROR
>> > context.GrailsContextLoader  - Error executing bootstraps: Error
>> > creating
>> > bean with name 'ownedPersistenceEventListener': Cannot resolve reference
>> > to
>> > bean 'hibernateDatastore' while setting constructor argument; nested
>> > exception is
>> > org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
>> > named 'hibernateDatastore' is defined
>> > Message: Error creating bean with name 'ownedPersistenceEventListener':
>> > Cannot resolve reference to bean 'hibernateDatastore' while setting
>> > constructor argument; nested exception is
>> > org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
>> > named 'hibernateDatastore' is defined
>> >    Line | Method
>> > ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
>> > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> > |   138 | run      in java.util.concurrent.FutureTask
>> > |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
>> > |   908 | run      in     ''
>> > ^   662 | run . .  in java.lang.Thread
>> >
>> > Caused by NoSuchBeanDefinitionException: No bean named
>> > 'hibernateDatastore'
>> > is defined
>> > ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
>> > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> > |   138 | run      in java.util.concurrent.FutureTask
>> > |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
>> > |   908 | run      in     ''
>> > ^   662 | run . .  in java.lang.Thread
>> >
>> > I put a little snippet in Boostrap.groovy to output the names of all the
>> > beans in the applicationContext and I don't see hibernateDatastore in
>> > there.
>> >
>> > I am just using the default gorm implementation right now as this is a
>> > new
>> > app. I only have the following additional plugins installed:
>> > fields 1.3
>> > spring-security-core 1.2.7.3
>> > twitter-bootstrap 2.1.0
>> >
>> > I've actually accomplished what I want to do by defining dynamic
>> > beforeInsert and beforeUpdate methods in the doWithDynamicMethods
>> > section of
>> > my domain plugin.  However, I really want to see this method working
>> > since
>> > my current solution won't allow me to define beforeInsert/beforeUpdate
>> > methods directly on any domain classes that are affected that my
>> > doWithDynamicMethods affects without overwriting those dynamic methods.
>> >
>> > Any help would be appreciated.
>> >
>> > Jason
>> >
>> > On Tue, Aug 28, 2012 at 1:42 AM, Graeme Rocher-4 [via Grails] <[hidden
>>
>> > email]> wrote:
>> >>
>> >> Depending what datastore you're targeting (hibernate, mongo etc.) you
>> >> can
>> >> do:
>> >>
>> >>     def doWithSpring = {
>> >>         ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> >> ref("hibernateDatastore")) {
>> >>             springSecurityService = ref('springSecurityService')
>> >>         }
>> >>     }
>> >>
>> >> Or
>> >>
>> >>     def doWithSpring = {
>> >>         ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> >> ref("mongoDatastore")) {
>> >>             springSecurityService = ref('springSecurityService')
>> >>         }
>> >>     }
>> >>
>> >> Cheers
>> >> On Mon, Aug 27, 2012 at 9:02 PM, jason.stlouis <[hidden email]> wrote:
>> >>
>> >> > Did anyone ever figure this out? I am trying to accomplish the same
>> >> > thing and
>> >> > get the same exception when not providing a datastore as a
>> >> > constructor
>> >> > parameter ("method <init>()V not found") and can't find out how to
>> >> > reference
>> >> > the default datastore (my project that includes the plugin just uses
>> >> > default
>> >> > hibernate/gorm)
>> >> >
>> >> > For full information, I'm trying to do this from a plugin, I've
>> >> > defined
>> >> > my
>> >> > own extension to AbstractPersistenceEventListener and am defining it
>> >> > in
>> >> > my
>> >> > plugin definition in the doWithSpring closure :
>> >> >
>> >> >     def doWithSpring = {
>> >> >         ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> >> > null) {
>> >> >             springSecurityService = ref('springSecurityService')
>> >> >         }
>> >> >     }
>> >> >
>> >> > I can get it to load and it is executed on events when using this
>> >> > definition, but the PersistentEntity in the AbstractPersistenceEvent
>> >> > is
>> >> > always null - I presume if it actually had access to the datastore it
>> >> > wouldn't be.
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > View this message in context:
>> >> >
>> >> > http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633842.html
>> >> > Sent from the Grails - user mailing list archive at Nabble.com.
>>
>> >> >
>> >> > ---------------------------------------------------------------------
>> >> > To unsubscribe from this list, please visit:
>> >> >
>> >> >     http://xircles.codehaus.org/manage_email
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Graeme Rocher
>> >> Grails Project Lead
>> >> SpringSource - A Division of VMware
>> >> http://www.springsource.com
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe from this list, please visit:
>> >>
>> >>     http://xircles.codehaus.org/manage_email
>> >>
>> >>
>> >>
>> >>
>> >> ________________________________
>> >> If you reply to this email, your message will be added to the
>> >> discussion
>> >> below:
>> >>
>> >>
>> >> http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633868.html
>> >> To unsubscribe from Getting the datastore in a grails 2.0.1 project,
>> >> click
>> >> here.
>> >> NAML
>> >
>> >
>> >
>> > ________________________________
>> > View this message in context: Re: Getting the datastore in a grails
>> > 2.0.1
>> > project
>> >
>> > Sent from the Grails - user mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Graeme Rocher
>> Grails Project Lead
>> SpringSource - A Division of VMware
>> http://www.springsource.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>>
>> ________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633962.html
>> To unsubscribe from Getting the datastore in a grails 2.0.1 project, click
>> here.
>> NAML
>
>
>
> ________________________________
> View this message in context: Re: Getting the datastore in a grails 2.0.1
> project
> Sent from the Grails - user mailing list archive at Nabble.com.



--
Graeme Rocher
Grails Project Lead
SpringSource - A Division of VMware
http://www.springsource.com

---------------------------------------------------------------------
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: Getting the datastore in a grails 2.0.1 project

jason.stlouis
I found another way to reference the hibernateDatastore form this Jira: http://jira.grails.org/browse/GRAILS-8824 

grailsApplication.mainContext.eventTriggeringInterceptor.datastores

So now I'm doing this in my plugin config:

def doWithApplicationContext = { applicationContext ->
    application.mainContext.eventTriggeringInterceptor.datastores.each { k, datastore ->
        applicationContext.addApplicationListener new UserAuditedPersistenceEventListener(datastore, applicationContext.springSecurityService)
    }
}

and that works. Here's my next question :)

I followed the same pattern in my listener that the AutoTimestampEventListener does:

However, in my Listener the event.entity and event.entityAccess are always null - the only thing I can reference is the event.entityObject - which I've been able to use to do what I'm trying to do (I'm updating the createdBy and updatedBy user on objects) - but doing it this way ends up in 1 insert and 2 updates getting run every time I create a new domain object, and 2 updates getting run whenever I update a domain object.  So are event.entity and event.entityAccess expected to be null here or am I missing something else?

Also, based on your responses in this thread (and your comment on GRAILS-8824), it seems you expect a hibernateDatastore bean to be present in the applicationContext and there isn't - is this something that should be corrected? Should I put in a Jira ticket for that?  

Thanks a bunch for your help Graeme!  Hopefully this thread will be a good resource for anyone else trying to accomplish this.


On Thu, Aug 30, 2012 at 1:40 AM, Graeme Rocher-4 [via Grails] <[hidden email]> wrote:
Hmm yeah we do need to make this easier and improve the documentation.

It seems we never register a bean for the HibernateDatastore, you'll
probably need to create your own instance:

        MappingContext mappingContext =
ctx.getBean("grailsDomainClassMappingContext", MappingContext)
        SessionFactory sessionFactory = ctx.getBean("sessionFactory")
        final datastore = new HibernateDatastore(mappingContext,
sessionFactory, ctx, application.config)

Sorry for the hassle

Cheers

On Wed, Aug 29, 2012 at 4:57 PM, jason.stlouis <[hidden email]> wrote:

> Thanks for trying to help Graeme but this still does not work for me:
>
> I put the following in my Bootstrap:
>
> class BootStrap {
>
>     def init = { servletContext ->
>         log.debug "Running Application Bootstrap"
>         log.debug  "Listing available datastores"
>         def applicationContext =
> servletContext.getAttribute(ApplicationAttributes.APPLICATION_CONTEXT)
>         def datastores = applicationContext.getBeansOfType(Datastore)
>         log.debug  "Datastore count: ${datastores.size()}"
>         for(d in datastores) {
>             log.debug  "Datastore: ${d}"
>             //applicationContext.addApplicationListener new
> OwnedPersistenceEventListener(d)
>         }
>
> And see the following in the log:
>
> 2012-08-29 09:52:08,129 [pool-5-thread-1] DEBUG conf.BootStrap  - Running
> Application Bootstrap
> 2012-08-29 09:52:08,129 [pool-5-thread-1] DEBUG conf.BootStrap  - Listing
> datastores
> 2012-08-29 09:52:08,132 [pool-5-thread-1] DEBUG conf.BootStrap  - Datastore
> count: 0
>
> This is far more complicated than the documentation in 6.5.1 for Custom
> Event Listeners led me to believe.
>
> On Wed, Aug 29, 2012 at 1:53 AM, Graeme Rocher-4 [via Grails] <[hidden

> email]> wrote:
>>
>> Well looking at the code that does this in the various plugins, they
>> don't use Spring config to achieve what you're trying to achieve. What
>> they do is:
>>
>>     void configure(ConfigurableApplicationContext ctx) {
>>         final datastore =
>> ctx.getBean("${datastoreType.toLowerCase()}Datastore", Datastore)
>>         ctx.addApplicationListener new DomainEventListener(datastore)
>>         ctx.addApplicationListener new
>> AutoTimestampEventListener(datastore)
>>     }
>>
>> Which happens after the ApplicationContext is built. You would have to
>> do this in your application I would guess. To do this with a BootStrap
>> class you would have to do:
>>
>> class BootStrap implements ApplicationContextAware {
>>
>>    ApplicationContext applicationContext
>>    def init = {
>>         def datastores = applicationContext.getBeansOfType(Datastore)
>>         for(d in datastores) {
>>             applicationContext.addApplicationListener new
>> MyEventListener(d)
>>         }
>>    }
>> }
>>
>> Note: untested code
>>
>> Cheers
>>
>> On Tue, Aug 28, 2012 at 4:04 PM, jason.stlouis <[hidden email]> wrote:
>>
>> > That didn't work - here's the error message I receive:
>> >
>> > | Error 2012-08-28 08:44:33,868 [pool-5-thread-1] ERROR
>> > context.GrailsContextLoader  - Error executing bootstraps: Error
>> > creating
>> > bean with name 'ownedPersistenceEventListener': Cannot resolve reference
>> > to
>> > bean 'hibernateDatastore' while setting constructor argument; nested
>> > exception is
>> > org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
>> > named 'hibernateDatastore' is defined
>> > Message: Error creating bean with name 'ownedPersistenceEventListener':
>> > Cannot resolve reference to bean 'hibernateDatastore' while setting
>> > constructor argument; nested exception is
>> > org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean
>> > named 'hibernateDatastore' is defined
>> >    Line | Method
>> > ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
>> > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> > |   138 | run      in java.util.concurrent.FutureTask
>> > |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
>> > |   908 | run      in     ''
>> > ^   662 | run . .  in java.lang.Thread
>> >
>> > Caused by NoSuchBeanDefinitionException: No bean named
>> > 'hibernateDatastore'
>> > is defined
>> > ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
>> > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> > |   138 | run      in java.util.concurrent.FutureTask
>> > |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
>> > |   908 | run      in     ''
>> > ^   662 | run . .  in java.lang.Thread
>> >
>> > I put a little snippet in Boostrap.groovy to output the names of all the
>> > beans in the applicationContext and I don't see hibernateDatastore in
>> > there.
>> >
>> > I am just using the default gorm implementation right now as this is a
>> > new
>> > app. I only have the following additional plugins installed:
>> > fields 1.3
>> > spring-security-core 1.2.7.3
>> > twitter-bootstrap 2.1.0
>> >
>> > I've actually accomplished what I want to do by defining dynamic
>> > beforeInsert and beforeUpdate methods in the doWithDynamicMethods
>> > section of
>> > my domain plugin.  However, I really want to see this method working
>> > since
>> > my current solution won't allow me to define beforeInsert/beforeUpdate
>> > methods directly on any domain classes that are affected that my
>> > doWithDynamicMethods affects without overwriting those dynamic methods.
>> >
>> > Any help would be appreciated.
>> >
>> > Jason
>> >
>> > On Tue, Aug 28, 2012 at 1:42 AM, Graeme Rocher-4 [via Grails] <[hidden
>>
>> > email]> wrote:
>> >>
>> >> Depending what datastore you're targeting (hibernate, mongo etc.) you
>> >> can
>> >> do:
>> >>
>> >>     def doWithSpring = {
>> >>         ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> >> ref("hibernateDatastore")) {
>> >>             springSecurityService = ref('springSecurityService')
>> >>         }
>> >>     }
>> >>
>> >> Or
>> >>
>> >>     def doWithSpring = {
>> >>         ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> >> ref("mongoDatastore")) {
>> >>             springSecurityService = ref('springSecurityService')
>> >>         }
>> >>     }
>> >>
>> >> Cheers
>> >> On Mon, Aug 27, 2012 at 9:02 PM, jason.stlouis <[hidden email]> wrote:
>> >>
>> >> > Did anyone ever figure this out? I am trying to accomplish the same
>> >> > thing and
>> >> > get the same exception when not providing a datastore as a
>> >> > constructor
>> >> > parameter ("method <init>()V not found") and can't find out how to
>> >> > reference
>> >> > the default datastore (my project that includes the plugin just uses
>> >> > default
>> >> > hibernate/gorm)
>> >> >
>> >> > For full information, I'm trying to do this from a plugin, I've
>> >> > defined
>> >> > my
>> >> > own extension to AbstractPersistenceEventListener and am defining it
>> >> > in
>> >> > my
>> >> > plugin definition in the doWithSpring closure :
>> >> >
>> >> >     def doWithSpring = {
>> >> >         ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> >> > null) {
>> >> >             springSecurityService = ref('springSecurityService')
>> >> >         }
>> >> >     }
>> >> >
>> >> > I can get it to load and it is executed on events when using this
>> >> > definition, but the PersistentEntity in the AbstractPersistenceEvent
>> >> > is
>> >> > always null - I presume if it actually had access to the datastore it
>> >> > wouldn't be.
>> >> >
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > View this message in context:
>> >> >
>> >> > http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633842.html
>> >> > Sent from the Grails - user mailing list archive at Nabble.com.

>>
>> >> >
>> >> > ---------------------------------------------------------------------
>> >> > To unsubscribe from this list, please visit:
>> >> >
>> >> >     http://xircles.codehaus.org/manage_email
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Graeme Rocher
>> >> Grails Project Lead
>> >> SpringSource - A Division of VMware
>> >> http://www.springsource.com
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe from this list, please visit:
>> >>
>> >>     http://xircles.codehaus.org/manage_email
>> >>
>> >>
>> >>
>> >>
>> >> ________________________________
>> >> If you reply to this email, your message will be added to the
>> >> discussion
>> >> below:
>> >>
>> >>
>> >> http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633868.html
>> >> To unsubscribe from Getting the datastore in a grails 2.0.1 project,

>> >> click
>> >> here.
>> >> NAML
>> >
>> >
>> >
>> > ________________________________
>> > View this message in context: Re: Getting the datastore in a grails
>> > 2.0.1
>> > project
>> >
>> > Sent from the Grails - user mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Graeme Rocher
>> Grails Project Lead
>> SpringSource - A Division of VMware
>> http://www.springsource.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>>
>> ________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633962.html
>> To unsubscribe from Getting the datastore in a grails 2.0.1 project, click
>> here.
>> NAML
>
>
>
> ________________________________
> View this message in context: Re: Getting the datastore in a grails 2.0.1
> project
> Sent from the Grails - user mailing list archive at Nabble.com.



--
Graeme Rocher
Grails Project Lead
SpringSource - A Division of VMware
http://www.springsource.com

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

    http://xircles.codehaus.org/manage_email





If you reply to this email, your message will be added to the discussion below:
http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4634020.html
To unsubscribe from Getting the datastore in a grails 2.0.1 project, click here.
NAML

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

Re: Getting the datastore in a grails 2.0.1 project

Graeme Rocher-4
Administrator
Yeah I think the datastore should be a bean, feel free to raise a JIRA
ticket for that and to update the docs on how to do this properly

Thanks

On Thu, Aug 30, 2012 at 5:28 PM, jason.stlouis <[hidden email]> wrote:

> I found another way to reference the hibernateDatastore form this Jira:
> http://jira.grails.org/browse/GRAILS-8824
>
> grailsApplication.mainContext.eventTriggeringInterceptor.datastores
>
> So now I'm doing this in my plugin config:
>
> def doWithApplicationContext = { applicationContext ->
>     application.mainContext.eventTriggeringInterceptor.datastores.each { k,
> datastore ->
>         applicationContext.addApplicationListener new
> UserAuditedPersistenceEventListener(datastore,
> applicationContext.springSecurityService)
>     }
> }
>
> and that works. Here's my next question :)
>
> I followed the same pattern in my listener that the
> AutoTimestampEventListener does:
> https://github.com/SpringSource/grails-data-mapping/blob/master/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/events/AutoTimestampEventListener.java
>
> However, in my Listener the event.entity and event.entityAccess are always
> null - the only thing I can reference is the event.entityObject - which I've
> been able to use to do what I'm trying to do (I'm updating the createdBy and
> updatedBy user on objects) - but doing it this way ends up in 1 insert and 2
> updates getting run every time I create a new domain object, and 2 updates
> getting run whenever I update a domain object.  So are event.entity and
> event.entityAccess expected to be null here or am I missing something else?
>
> Also, based on your responses in this thread (and your comment on
> GRAILS-8824), it seems you expect a hibernateDatastore bean to be present in
> the applicationContext and there isn't - is this something that should be
> corrected? Should I put in a Jira ticket for that?
>
> Thanks a bunch for your help Graeme!  Hopefully this thread will be a good
> resource for anyone else trying to accomplish this.
>
>
> On Thu, Aug 30, 2012 at 1:40 AM, Graeme Rocher-4 [via Grails] <[hidden
> email]> wrote:
>>
>> Hmm yeah we do need to make this easier and improve the documentation.
>>
>> It seems we never register a bean for the HibernateDatastore, you'll
>> probably need to create your own instance:
>>
>>         MappingContext mappingContext =
>> ctx.getBean("grailsDomainClassMappingContext", MappingContext)
>>         SessionFactory sessionFactory = ctx.getBean("sessionFactory")
>>         final datastore = new HibernateDatastore(mappingContext,
>> sessionFactory, ctx, application.config)
>>
>> Sorry for the hassle
>>
>> Cheers
>>
>> On Wed, Aug 29, 2012 at 4:57 PM, jason.stlouis <[hidden email]> wrote:
>>
>> > Thanks for trying to help Graeme but this still does not work for me:
>> >
>> > I put the following in my Bootstrap:
>> >
>> > class BootStrap {
>> >
>> >     def init = { servletContext ->
>> >         log.debug "Running Application Bootstrap"
>> >         log.debug  "Listing available datastores"
>> >         def applicationContext =
>> > servletContext.getAttribute(ApplicationAttributes.APPLICATION_CONTEXT)
>> >         def datastores = applicationContext.getBeansOfType(Datastore)
>> >         log.debug  "Datastore count: ${datastores.size()}"
>> >         for(d in datastores) {
>> >             log.debug  "Datastore: ${d}"
>> >             //applicationContext.addApplicationListener new
>> > OwnedPersistenceEventListener(d)
>> >         }
>> >
>> > And see the following in the log:
>> >
>> > 2012-08-29 09:52:08,129 [pool-5-thread-1] DEBUG conf.BootStrap  -
>> > Running
>> > Application Bootstrap
>> > 2012-08-29 09:52:08,129 [pool-5-thread-1] DEBUG conf.BootStrap  -
>> > Listing
>> > datastores
>> > 2012-08-29 09:52:08,132 [pool-5-thread-1] DEBUG conf.BootStrap  -
>> > Datastore
>> > count: 0
>> >
>> > This is far more complicated than the documentation in 6.5.1 for Custom
>> > Event Listeners led me to believe.
>> >
>> > On Wed, Aug 29, 2012 at 1:53 AM, Graeme Rocher-4 [via Grails] <[hidden
>>
>> > email]> wrote:
>> >>
>> >> Well looking at the code that does this in the various plugins, they
>> >> don't use Spring config to achieve what you're trying to achieve. What
>> >> they do is:
>> >>
>> >>     void configure(ConfigurableApplicationContext ctx) {
>> >>         final datastore =
>> >> ctx.getBean("${datastoreType.toLowerCase()}Datastore", Datastore)
>> >>         ctx.addApplicationListener new DomainEventListener(datastore)
>> >>         ctx.addApplicationListener new
>> >> AutoTimestampEventListener(datastore)
>> >>     }
>> >>
>> >> Which happens after the ApplicationContext is built. You would have to
>> >> do this in your application I would guess. To do this with a BootStrap
>> >> class you would have to do:
>> >>
>> >> class BootStrap implements ApplicationContextAware {
>> >>
>> >>    ApplicationContext applicationContext
>> >>    def init = {
>> >>         def datastores = applicationContext.getBeansOfType(Datastore)
>> >>         for(d in datastores) {
>> >>             applicationContext.addApplicationListener new
>> >> MyEventListener(d)
>> >>         }
>> >>    }
>> >> }
>> >>
>> >> Note: untested code
>> >>
>> >> Cheers
>> >>
>> >> On Tue, Aug 28, 2012 at 4:04 PM, jason.stlouis <[hidden email]> wrote:
>> >>
>> >> > That didn't work - here's the error message I receive:
>> >> >
>> >> > | Error 2012-08-28 08:44:33,868 [pool-5-thread-1] ERROR
>> >> > context.GrailsContextLoader  - Error executing bootstraps: Error
>> >> > creating
>> >> > bean with name 'ownedPersistenceEventListener': Cannot resolve
>> >> > reference
>> >> > to
>> >> > bean 'hibernateDatastore' while setting constructor argument; nested
>> >> > exception is
>> >> > org.springframework.beans.factory.NoSuchBeanDefinitionException: No
>> >> > bean
>> >> > named 'hibernateDatastore' is defined
>> >> > Message: Error creating bean with name
>> >> > 'ownedPersistenceEventListener':
>> >> > Cannot resolve reference to bean 'hibernateDatastore' while setting
>> >> > constructor argument; nested exception is
>> >> > org.springframework.beans.factory.NoSuchBeanDefinitionException: No
>> >> > bean
>> >> > named 'hibernateDatastore' is defined
>> >> >    Line | Method
>> >> > ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
>> >> > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> >> > -
>> >> > |   138 | run      in java.util.concurrent.FutureTask
>> >> > |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
>> >> > |   908 | run      in     ''
>> >> > ^   662 | run . .  in java.lang.Thread
>> >> >
>> >> > Caused by NoSuchBeanDefinitionException: No bean named
>> >> > 'hibernateDatastore'
>> >> > is defined
>> >> > ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
>> >> > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> >> > -
>> >> > |   138 | run      in java.util.concurrent.FutureTask
>> >> > |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
>> >> > |   908 | run      in     ''
>> >> > ^   662 | run . .  in java.lang.Thread
>> >> >
>> >> > I put a little snippet in Boostrap.groovy to output the names of all
>> >> > the
>> >> > beans in the applicationContext and I don't see hibernateDatastore in
>> >> > there.
>> >> >
>> >> > I am just using the default gorm implementation right now as this is
>> >> > a
>> >> > new
>> >> > app. I only have the following additional plugins installed:
>> >> > fields 1.3
>> >> > spring-security-core 1.2.7.3
>> >> > twitter-bootstrap 2.1.0
>> >> >
>> >> > I've actually accomplished what I want to do by defining dynamic
>> >> > beforeInsert and beforeUpdate methods in the doWithDynamicMethods
>> >> > section of
>> >> > my domain plugin.  However, I really want to see this method working
>> >> > since
>> >> > my current solution won't allow me to define
>> >> > beforeInsert/beforeUpdate
>> >> > methods directly on any domain classes that are affected that my
>> >> > doWithDynamicMethods affects without overwriting those dynamic
>> >> > methods.
>> >> >
>> >> > Any help would be appreciated.
>> >> >
>> >> > Jason
>> >> >
>> >> > On Tue, Aug 28, 2012 at 1:42 AM, Graeme Rocher-4 [via Grails]
>> >> > <[hidden
>> >>
>> >> > email]> wrote:
>> >> >>
>> >> >> Depending what datastore you're targeting (hibernate, mongo etc.)
>> >> >> you
>> >> >> can
>> >> >> do:
>> >> >>
>> >> >>     def doWithSpring = {
>> >> >>         ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> >> >> ref("hibernateDatastore")) {
>> >> >>             springSecurityService = ref('springSecurityService')
>> >> >>         }
>> >> >>     }
>> >> >>
>> >> >> Or
>> >> >>
>> >> >>     def doWithSpring = {
>> >> >>         ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> >> >> ref("mongoDatastore")) {
>> >> >>             springSecurityService = ref('springSecurityService')
>> >> >>         }
>> >> >>     }
>> >> >>
>> >> >> Cheers
>> >> >> On Mon, Aug 27, 2012 at 9:02 PM, jason.stlouis <[hidden email]>
>> >> >> wrote:
>> >> >>
>> >> >> > Did anyone ever figure this out? I am trying to accomplish the
>> >> >> > same
>> >> >> > thing and
>> >> >> > get the same exception when not providing a datastore as a
>> >> >> > constructor
>> >> >> > parameter ("method <init>()V not found") and can't find out how to
>> >> >> > reference
>> >> >> > the default datastore (my project that includes the plugin just
>> >> >> > uses
>> >> >> > default
>> >> >> > hibernate/gorm)
>> >> >> >
>> >> >> > For full information, I'm trying to do this from a plugin, I've
>> >> >> > defined
>> >> >> > my
>> >> >> > own extension to AbstractPersistenceEventListener and am defining
>> >> >> > it
>> >> >> > in
>> >> >> > my
>> >> >> > plugin definition in the doWithSpring closure :
>> >> >> >
>> >> >> >     def doWithSpring = {
>> >> >> >
>> >> >> > ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> >> >> > null) {
>> >> >> >             springSecurityService = ref('springSecurityService')
>> >> >> >         }
>> >> >> >     }
>> >> >> >
>> >> >> > I can get it to load and it is executed on events when using this
>> >> >> > definition, but the PersistentEntity in the
>> >> >> > AbstractPersistenceEvent
>> >> >> > is
>> >> >> > always null - I presume if it actually had access to the datastore
>> >> >> > it
>> >> >> > wouldn't be.
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > View this message in context:
>> >> >> >
>> >> >> >
>> >> >> > http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633842.html
>> >> >> > Sent from the Grails - user mailing list archive at Nabble.com.
>>
>> >>
>> >> >> >
>> >> >> >
>> >> >> > ---------------------------------------------------------------------
>> >> >> > To unsubscribe from this list, please visit:
>> >> >> >
>> >> >> >     http://xircles.codehaus.org/manage_email
>> >> >> >
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Graeme Rocher
>> >> >> Grails Project Lead
>> >> >> SpringSource - A Division of VMware
>> >> >> http://www.springsource.com
>> >> >>
>> >> >>
>> >> >> ---------------------------------------------------------------------
>> >> >> To unsubscribe from this list, please visit:
>> >> >>
>> >> >>     http://xircles.codehaus.org/manage_email
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> ________________________________
>> >> >> If you reply to this email, your message will be added to the
>> >> >> discussion
>> >> >> below:
>> >> >>
>> >> >>
>> >> >>
>> >> >> http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633868.html
>> >> >> To unsubscribe from Getting the datastore in a grails 2.0.1 project,
>>
>> >> >> click
>> >> >> here.
>> >> >> NAML
>> >> >
>> >> >
>> >> >
>> >> > ________________________________
>> >> > View this message in context: Re: Getting the datastore in a grails
>> >> > 2.0.1
>> >> > project
>> >> >
>> >> > Sent from the Grails - user mailing list archive at Nabble.com.
>> >>
>> >>
>> >>
>> >> --
>> >> Graeme Rocher
>> >> Grails Project Lead
>> >> SpringSource - A Division of VMware
>> >> http://www.springsource.com
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe from this list, please visit:
>> >>
>> >>     http://xircles.codehaus.org/manage_email
>> >>
>> >>
>> >>
>> >>
>> >> ________________________________
>> >> If you reply to this email, your message will be added to the
>> >> discussion
>> >> below:
>> >>
>> >>
>> >> http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633962.html
>> >> To unsubscribe from Getting the datastore in a grails 2.0.1 project,
>> >> click
>> >> here.
>> >> NAML
>> >
>> >
>> >
>> > ________________________________
>> > View this message in context: Re: Getting the datastore in a grails
>> > 2.0.1
>> > project
>> > Sent from the Grails - user mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Graeme Rocher
>> Grails Project Lead
>> SpringSource - A Division of VMware
>> http://www.springsource.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>>
>> ________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4634020.html
>> To unsubscribe from Getting the datastore in a grails 2.0.1 project, click
>> here.
>> NAML
>
>
>
> ________________________________
> View this message in context: Re: Getting the datastore in a grails 2.0.1
> project
> Sent from the Grails - user mailing list archive at Nabble.com.



--
Graeme Rocher
Grails Project Lead
SpringSource - A Division of VMware
http://www.springsource.com

---------------------------------------------------------------------
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: Getting the datastore in a grails 2.0.1 project

jason.stlouis
Ok, I added http://jira.grails.org/browse/GRAILS-9373.  I'll see what I can do about updating the documentation.

Any ideas about my other problem, event.entity and event.entityAccess always being null in my Listener?


On Fri, Aug 31, 2012 at 3:34 AM, Graeme Rocher <[hidden email]> wrote:
Yeah I think the datastore should be a bean, feel free to raise a JIRA
ticket for that and to update the docs on how to do this properly

Thanks

On Thu, Aug 30, 2012 at 5:28 PM, jason.stlouis <[hidden email]> wrote:
> I found another way to reference the hibernateDatastore form this Jira:
> http://jira.grails.org/browse/GRAILS-8824
>
> grailsApplication.mainContext.eventTriggeringInterceptor.datastores
>
> So now I'm doing this in my plugin config:
>
> def doWithApplicationContext = { applicationContext ->
>     application.mainContext.eventTriggeringInterceptor.datastores.each { k,
> datastore ->
>         applicationContext.addApplicationListener new
> UserAuditedPersistenceEventListener(datastore,
> applicationContext.springSecurityService)
>     }
> }
>
> and that works. Here's my next question :)
>
> I followed the same pattern in my listener that the
> AutoTimestampEventListener does:
> https://github.com/SpringSource/grails-data-mapping/blob/master/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/events/AutoTimestampEventListener.java
>
> However, in my Listener the event.entity and event.entityAccess are always
> null - the only thing I can reference is the event.entityObject - which I've
> been able to use to do what I'm trying to do (I'm updating the createdBy and
> updatedBy user on objects) - but doing it this way ends up in 1 insert and 2
> updates getting run every time I create a new domain object, and 2 updates
> getting run whenever I update a domain object.  So are event.entity and
> event.entityAccess expected to be null here or am I missing something else?
>
> Also, based on your responses in this thread (and your comment on
> GRAILS-8824), it seems you expect a hibernateDatastore bean to be present in
> the applicationContext and there isn't - is this something that should be
> corrected? Should I put in a Jira ticket for that?
>
> Thanks a bunch for your help Graeme!  Hopefully this thread will be a good
> resource for anyone else trying to accomplish this.
>
>
> On Thu, Aug 30, 2012 at 1:40 AM, Graeme Rocher-4 [via Grails] <[hidden
> email]> wrote:
>>
>> Hmm yeah we do need to make this easier and improve the documentation.
>>
>> It seems we never register a bean for the HibernateDatastore, you'll
>> probably need to create your own instance:
>>
>>         MappingContext mappingContext =
>> ctx.getBean("grailsDomainClassMappingContext", MappingContext)
>>         SessionFactory sessionFactory = ctx.getBean("sessionFactory")
>>         final datastore = new HibernateDatastore(mappingContext,
>> sessionFactory, ctx, application.config)
>>
>> Sorry for the hassle
>>
>> Cheers
>>
>> On Wed, Aug 29, 2012 at 4:57 PM, jason.stlouis <[hidden email]> wrote:
>>
>> > Thanks for trying to help Graeme but this still does not work for me:
>> >
>> > I put the following in my Bootstrap:
>> >
>> > class BootStrap {
>> >
>> >     def init = { servletContext ->
>> >         log.debug "Running Application Bootstrap"
>> >         log.debug  "Listing available datastores"
>> >         def applicationContext =
>> > servletContext.getAttribute(ApplicationAttributes.APPLICATION_CONTEXT)
>> >         def datastores = applicationContext.getBeansOfType(Datastore)
>> >         log.debug  "Datastore count: ${datastores.size()}"
>> >         for(d in datastores) {
>> >             log.debug  "Datastore: ${d}"
>> >             //applicationContext.addApplicationListener new
>> > OwnedPersistenceEventListener(d)
>> >         }
>> >
>> > And see the following in the log:
>> >
>> > 2012-08-29 09:52:08,129 [pool-5-thread-1] DEBUG conf.BootStrap  -
>> > Running
>> > Application Bootstrap
>> > 2012-08-29 09:52:08,129 [pool-5-thread-1] DEBUG conf.BootStrap  -
>> > Listing
>> > datastores
>> > 2012-08-29 09:52:08,132 [pool-5-thread-1] DEBUG conf.BootStrap  -
>> > Datastore
>> > count: 0
>> >
>> > This is far more complicated than the documentation in 6.5.1 for Custom
>> > Event Listeners led me to believe.
>> >
>> > On Wed, Aug 29, 2012 at 1:53 AM, Graeme Rocher-4 [via Grails] <[hidden
>>
>> > email]> wrote:
>> >>
>> >> Well looking at the code that does this in the various plugins, they
>> >> don't use Spring config to achieve what you're trying to achieve. What
>> >> they do is:
>> >>
>> >>     void configure(ConfigurableApplicationContext ctx) {
>> >>         final datastore =
>> >> ctx.getBean("${datastoreType.toLowerCase()}Datastore", Datastore)
>> >>         ctx.addApplicationListener new DomainEventListener(datastore)
>> >>         ctx.addApplicationListener new
>> >> AutoTimestampEventListener(datastore)
>> >>     }
>> >>
>> >> Which happens after the ApplicationContext is built. You would have to
>> >> do this in your application I would guess. To do this with a BootStrap
>> >> class you would have to do:
>> >>
>> >> class BootStrap implements ApplicationContextAware {
>> >>
>> >>    ApplicationContext applicationContext
>> >>    def init = {
>> >>         def datastores = applicationContext.getBeansOfType(Datastore)
>> >>         for(d in datastores) {
>> >>             applicationContext.addApplicationListener new
>> >> MyEventListener(d)
>> >>         }
>> >>    }
>> >> }
>> >>
>> >> Note: untested code
>> >>
>> >> Cheers
>> >>
>> >> On Tue, Aug 28, 2012 at 4:04 PM, jason.stlouis <[hidden email]> wrote:
>> >>
>> >> > That didn't work - here's the error message I receive:
>> >> >
>> >> > | Error 2012-08-28 08:44:33,868 [pool-5-thread-1] ERROR
>> >> > context.GrailsContextLoader  - Error executing bootstraps: Error
>> >> > creating
>> >> > bean with name 'ownedPersistenceEventListener': Cannot resolve
>> >> > reference
>> >> > to
>> >> > bean 'hibernateDatastore' while setting constructor argument; nested
>> >> > exception is
>> >> > org.springframework.beans.factory.NoSuchBeanDefinitionException: No
>> >> > bean
>> >> > named 'hibernateDatastore' is defined
>> >> > Message: Error creating bean with name
>> >> > 'ownedPersistenceEventListener':
>> >> > Cannot resolve reference to bean 'hibernateDatastore' while setting
>> >> > constructor argument; nested exception is
>> >> > org.springframework.beans.factory.NoSuchBeanDefinitionException: No
>> >> > bean
>> >> > named 'hibernateDatastore' is defined
>> >> >    Line | Method
>> >> > ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
>> >> > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> >> > -
>> >> > |   138 | run      in java.util.concurrent.FutureTask
>> >> > |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
>> >> > |   908 | run      in     ''
>> >> > ^   662 | run . .  in java.lang.Thread
>> >> >
>> >> > Caused by NoSuchBeanDefinitionException: No bean named
>> >> > 'hibernateDatastore'
>> >> > is defined
>> >> > ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
>> >> > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> >> > -
>> >> > |   138 | run      in java.util.concurrent.FutureTask
>> >> > |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
>> >> > |   908 | run      in     ''
>> >> > ^   662 | run . .  in java.lang.Thread
>> >> >
>> >> > I put a little snippet in Boostrap.groovy to output the names of all
>> >> > the
>> >> > beans in the applicationContext and I don't see hibernateDatastore in
>> >> > there.
>> >> >
>> >> > I am just using the default gorm implementation right now as this is
>> >> > a
>> >> > new
>> >> > app. I only have the following additional plugins installed:
>> >> > fields 1.3
>> >> > spring-security-core 1.2.7.3
>> >> > twitter-bootstrap 2.1.0
>> >> >
>> >> > I've actually accomplished what I want to do by defining dynamic
>> >> > beforeInsert and beforeUpdate methods in the doWithDynamicMethods
>> >> > section of
>> >> > my domain plugin.  However, I really want to see this method working
>> >> > since
>> >> > my current solution won't allow me to define
>> >> > beforeInsert/beforeUpdate
>> >> > methods directly on any domain classes that are affected that my
>> >> > doWithDynamicMethods affects without overwriting those dynamic
>> >> > methods.
>> >> >
>> >> > Any help would be appreciated.
>> >> >
>> >> > Jason
>> >> >
>> >> > On Tue, Aug 28, 2012 at 1:42 AM, Graeme Rocher-4 [via Grails]
>> >> > <[hidden
>> >>
>> >> > email]> wrote:
>> >> >>
>> >> >> Depending what datastore you're targeting (hibernate, mongo etc.)
>> >> >> you
>> >> >> can
>> >> >> do:
>> >> >>
>> >> >>     def doWithSpring = {
>> >> >>         ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> >> >> ref("hibernateDatastore")) {
>> >> >>             springSecurityService = ref('springSecurityService')
>> >> >>         }
>> >> >>     }
>> >> >>
>> >> >> Or
>> >> >>
>> >> >>     def doWithSpring = {
>> >> >>         ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> >> >> ref("mongoDatastore")) {
>> >> >>             springSecurityService = ref('springSecurityService')
>> >> >>         }
>> >> >>     }
>> >> >>
>> >> >> Cheers
>> >> >> On Mon, Aug 27, 2012 at 9:02 PM, jason.stlouis <[hidden email]>
>> >> >> wrote:
>> >> >>
>> >> >> > Did anyone ever figure this out? I am trying to accomplish the
>> >> >> > same
>> >> >> > thing and
>> >> >> > get the same exception when not providing a datastore as a
>> >> >> > constructor
>> >> >> > parameter ("method <init>()V not found") and can't find out how to
>> >> >> > reference
>> >> >> > the default datastore (my project that includes the plugin just
>> >> >> > uses
>> >> >> > default
>> >> >> > hibernate/gorm)
>> >> >> >
>> >> >> > For full information, I'm trying to do this from a plugin, I've
>> >> >> > defined
>> >> >> > my
>> >> >> > own extension to AbstractPersistenceEventListener and am defining
>> >> >> > it
>> >> >> > in
>> >> >> > my
>> >> >> > plugin definition in the doWithSpring closure :
>> >> >> >
>> >> >> >     def doWithSpring = {
>> >> >> >
>> >> >> > ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> >> >> > null) {
>> >> >> >             springSecurityService = ref('springSecurityService')
>> >> >> >         }
>> >> >> >     }
>> >> >> >
>> >> >> > I can get it to load and it is executed on events when using this
>> >> >> > definition, but the PersistentEntity in the
>> >> >> > AbstractPersistenceEvent
>> >> >> > is
>> >> >> > always null - I presume if it actually had access to the datastore
>> >> >> > it
>> >> >> > wouldn't be.
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > View this message in context:
>> >> >> >
>> >> >> >
>> >> >> > http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633842.html
>> >> >> > Sent from the Grails - user mailing list archive at Nabble.com.
>>
>> >>
>> >> >> >
>> >> >> >
>> >> >> > ---------------------------------------------------------------------
>> >> >> > To unsubscribe from this list, please visit:
>> >> >> >
>> >> >> >     http://xircles.codehaus.org/manage_email
>> >> >> >
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Graeme Rocher
>> >> >> Grails Project Lead
>> >> >> SpringSource - A Division of VMware
>> >> >> http://www.springsource.com
>> >> >>
>> >> >>
>> >> >> ---------------------------------------------------------------------
>> >> >> To unsubscribe from this list, please visit:
>> >> >>
>> >> >>     http://xircles.codehaus.org/manage_email
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> ________________________________
>> >> >> If you reply to this email, your message will be added to the
>> >> >> discussion
>> >> >> below:
>> >> >>
>> >> >>
>> >> >>
>> >> >> http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633868.html
>> >> >> To unsubscribe from Getting the datastore in a grails 2.0.1 project,
>>
>> >> >> click
>> >> >> here.
>> >> >> NAML
>> >> >
>> >> >
>> >> >
>> >> > ________________________________
>> >> > View this message in context: Re: Getting the datastore in a grails
>> >> > 2.0.1
>> >> > project
>> >> >
>> >> > Sent from the Grails - user mailing list archive at Nabble.com.
>> >>
>> >>
>> >>
>> >> --
>> >> Graeme Rocher
>> >> Grails Project Lead
>> >> SpringSource - A Division of VMware
>> >> http://www.springsource.com
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe from this list, please visit:
>> >>
>> >>     http://xircles.codehaus.org/manage_email
>> >>
>> >>
>> >>
>> >>
>> >> ________________________________
>> >> If you reply to this email, your message will be added to the
>> >> discussion
>> >> below:
>> >>
>> >>
>> >> http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633962.html
>> >> To unsubscribe from Getting the datastore in a grails 2.0.1 project,
>> >> click
>> >> here.
>> >> NAML
>> >
>> >
>> >
>> > ________________________________
>> > View this message in context: Re: Getting the datastore in a grails
>> > 2.0.1
>> > project
>> > Sent from the Grails - user mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Graeme Rocher
>> Grails Project Lead
>> SpringSource - A Division of VMware
>> http://www.springsource.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>>
>> ________________________________
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4634020.html
>> To unsubscribe from Getting the datastore in a grails 2.0.1 project, click
>> here.
>> NAML
>
>
>
> ________________________________
> View this message in context: Re: Getting the datastore in a grails 2.0.1
> project
> Sent from the Grails - user mailing list archive at Nabble.com.



--
Graeme Rocher
Grails Project Lead
SpringSource - A Division of VMware
http://www.springsource.com

---------------------------------------------------------------------
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: Getting the datastore in a grails 2.0.1 project

Graeme Rocher-4
Administrator
On Fri, Aug 31, 2012 at 4:57 PM, Jason St Louis <[hidden email]> wrote:
> Ok, I added http://jira.grails.org/browse/GRAILS-9373.  I'll see what I can
> do about updating the documentation.
>
> Any ideas about my other problem, event.entity and event.entityAccess always
> being null in my Listener?

From the code there is no way this should be happening. I can't
reproduce when running the tests for our normal event listeners
either. Can you post an example in a JIRA?

Cheers

>
>
> On Fri, Aug 31, 2012 at 3:34 AM, Graeme Rocher <[hidden email]> wrote:
>>
>> Yeah I think the datastore should be a bean, feel free to raise a JIRA
>> ticket for that and to update the docs on how to do this properly
>>
>> Thanks
>>
>> On Thu, Aug 30, 2012 at 5:28 PM, jason.stlouis <[hidden email]>
>> wrote:
>> > I found another way to reference the hibernateDatastore form this Jira:
>> > http://jira.grails.org/browse/GRAILS-8824
>> >
>> > grailsApplication.mainContext.eventTriggeringInterceptor.datastores
>> >
>> > So now I'm doing this in my plugin config:
>> >
>> > def doWithApplicationContext = { applicationContext ->
>> >     application.mainContext.eventTriggeringInterceptor.datastores.each {
>> > k,
>> > datastore ->
>> >         applicationContext.addApplicationListener new
>> > UserAuditedPersistenceEventListener(datastore,
>> > applicationContext.springSecurityService)
>> >     }
>> > }
>> >
>> > and that works. Here's my next question :)
>> >
>> > I followed the same pattern in my listener that the
>> > AutoTimestampEventListener does:
>> >
>> > https://github.com/SpringSource/grails-data-mapping/blob/master/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/events/AutoTimestampEventListener.java
>> >
>> > However, in my Listener the event.entity and event.entityAccess are
>> > always
>> > null - the only thing I can reference is the event.entityObject - which
>> > I've
>> > been able to use to do what I'm trying to do (I'm updating the createdBy
>> > and
>> > updatedBy user on objects) - but doing it this way ends up in 1 insert
>> > and 2
>> > updates getting run every time I create a new domain object, and 2
>> > updates
>> > getting run whenever I update a domain object.  So are event.entity and
>> > event.entityAccess expected to be null here or am I missing something
>> > else?
>> >
>> > Also, based on your responses in this thread (and your comment on
>> > GRAILS-8824), it seems you expect a hibernateDatastore bean to be
>> > present in
>> > the applicationContext and there isn't - is this something that should
>> > be
>> > corrected? Should I put in a Jira ticket for that?
>> >
>> > Thanks a bunch for your help Graeme!  Hopefully this thread will be a
>> > good
>> > resource for anyone else trying to accomplish this.
>> >
>> >
>> > On Thu, Aug 30, 2012 at 1:40 AM, Graeme Rocher-4 [via Grails] <[hidden
>> > email]> wrote:
>> >>
>> >> Hmm yeah we do need to make this easier and improve the documentation.
>> >>
>> >> It seems we never register a bean for the HibernateDatastore, you'll
>> >> probably need to create your own instance:
>> >>
>> >>         MappingContext mappingContext =
>> >> ctx.getBean("grailsDomainClassMappingContext", MappingContext)
>> >>         SessionFactory sessionFactory = ctx.getBean("sessionFactory")
>> >>         final datastore = new HibernateDatastore(mappingContext,
>> >> sessionFactory, ctx, application.config)
>> >>
>> >> Sorry for the hassle
>> >>
>> >> Cheers
>> >>
>> >> On Wed, Aug 29, 2012 at 4:57 PM, jason.stlouis <[hidden email]> wrote:
>> >>
>> >> > Thanks for trying to help Graeme but this still does not work for me:
>> >> >
>> >> > I put the following in my Bootstrap:
>> >> >
>> >> > class BootStrap {
>> >> >
>> >> >     def init = { servletContext ->
>> >> >         log.debug "Running Application Bootstrap"
>> >> >         log.debug  "Listing available datastores"
>> >> >         def applicationContext =
>> >> >
>> >> > servletContext.getAttribute(ApplicationAttributes.APPLICATION_CONTEXT)
>> >> >         def datastores = applicationContext.getBeansOfType(Datastore)
>> >> >         log.debug  "Datastore count: ${datastores.size()}"
>> >> >         for(d in datastores) {
>> >> >             log.debug  "Datastore: ${d}"
>> >> >             //applicationContext.addApplicationListener new
>> >> > OwnedPersistenceEventListener(d)
>> >> >         }
>> >> >
>> >> > And see the following in the log:
>> >> >
>> >> > 2012-08-29 09:52:08,129 [pool-5-thread-1] DEBUG conf.BootStrap  -
>> >> > Running
>> >> > Application Bootstrap
>> >> > 2012-08-29 09:52:08,129 [pool-5-thread-1] DEBUG conf.BootStrap  -
>> >> > Listing
>> >> > datastores
>> >> > 2012-08-29 09:52:08,132 [pool-5-thread-1] DEBUG conf.BootStrap  -
>> >> > Datastore
>> >> > count: 0
>> >> >
>> >> > This is far more complicated than the documentation in 6.5.1 for
>> >> > Custom
>> >> > Event Listeners led me to believe.
>> >> >
>> >> > On Wed, Aug 29, 2012 at 1:53 AM, Graeme Rocher-4 [via Grails]
>> >> > <[hidden
>> >>
>> >> > email]> wrote:
>> >> >>
>> >> >> Well looking at the code that does this in the various plugins, they
>> >> >> don't use Spring config to achieve what you're trying to achieve.
>> >> >> What
>> >> >> they do is:
>> >> >>
>> >> >>     void configure(ConfigurableApplicationContext ctx) {
>> >> >>         final datastore =
>> >> >> ctx.getBean("${datastoreType.toLowerCase()}Datastore", Datastore)
>> >> >>         ctx.addApplicationListener new
>> >> >> DomainEventListener(datastore)
>> >> >>         ctx.addApplicationListener new
>> >> >> AutoTimestampEventListener(datastore)
>> >> >>     }
>> >> >>
>> >> >> Which happens after the ApplicationContext is built. You would have
>> >> >> to
>> >> >> do this in your application I would guess. To do this with a
>> >> >> BootStrap
>> >> >> class you would have to do:
>> >> >>
>> >> >> class BootStrap implements ApplicationContextAware {
>> >> >>
>> >> >>    ApplicationContext applicationContext
>> >> >>    def init = {
>> >> >>         def datastores =
>> >> >> applicationContext.getBeansOfType(Datastore)
>> >> >>         for(d in datastores) {
>> >> >>             applicationContext.addApplicationListener new
>> >> >> MyEventListener(d)
>> >> >>         }
>> >> >>    }
>> >> >> }
>> >> >>
>> >> >> Note: untested code
>> >> >>
>> >> >> Cheers
>> >> >>
>> >> >> On Tue, Aug 28, 2012 at 4:04 PM, jason.stlouis <[hidden email]>
>> >> >> wrote:
>> >> >>
>> >> >> > That didn't work - here's the error message I receive:
>> >> >> >
>> >> >> > | Error 2012-08-28 08:44:33,868 [pool-5-thread-1] ERROR
>> >> >> > context.GrailsContextLoader  - Error executing bootstraps: Error
>> >> >> > creating
>> >> >> > bean with name 'ownedPersistenceEventListener': Cannot resolve
>> >> >> > reference
>> >> >> > to
>> >> >> > bean 'hibernateDatastore' while setting constructor argument;
>> >> >> > nested
>> >> >> > exception is
>> >> >> > org.springframework.beans.factory.NoSuchBeanDefinitionException:
>> >> >> > No
>> >> >> > bean
>> >> >> > named 'hibernateDatastore' is defined
>> >> >> > Message: Error creating bean with name
>> >> >> > 'ownedPersistenceEventListener':
>> >> >> > Cannot resolve reference to bean 'hibernateDatastore' while
>> >> >> > setting
>> >> >> > constructor argument; nested exception is
>> >> >> > org.springframework.beans.factory.NoSuchBeanDefinitionException:
>> >> >> > No
>> >> >> > bean
>> >> >> > named 'hibernateDatastore' is defined
>> >> >> >    Line | Method
>> >> >> > ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
>> >> >> > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> >> >> > - -
>> >> >> > -
>> >> >> > |   138 | run      in java.util.concurrent.FutureTask
>> >> >> > |   886 | runTask  in
>> >> >> > java.util.concurrent.ThreadPoolExecutor$Worker
>> >> >> > |   908 | run      in     ''
>> >> >> > ^   662 | run . .  in java.lang.Thread
>> >> >> >
>> >> >> > Caused by NoSuchBeanDefinitionException: No bean named
>> >> >> > 'hibernateDatastore'
>> >> >> > is defined
>> >> >> > ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
>> >> >> > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> >> >> > - -
>> >> >> > -
>> >> >> > |   138 | run      in java.util.concurrent.FutureTask
>> >> >> > |   886 | runTask  in
>> >> >> > java.util.concurrent.ThreadPoolExecutor$Worker
>> >> >> > |   908 | run      in     ''
>> >> >> > ^   662 | run . .  in java.lang.Thread
>> >> >> >
>> >> >> > I put a little snippet in Boostrap.groovy to output the names of
>> >> >> > all
>> >> >> > the
>> >> >> > beans in the applicationContext and I don't see hibernateDatastore
>> >> >> > in
>> >> >> > there.
>> >> >> >
>> >> >> > I am just using the default gorm implementation right now as this
>> >> >> > is
>> >> >> > a
>> >> >> > new
>> >> >> > app. I only have the following additional plugins installed:
>> >> >> > fields 1.3
>> >> >> > spring-security-core 1.2.7.3
>> >> >> > twitter-bootstrap 2.1.0
>> >> >> >
>> >> >> > I've actually accomplished what I want to do by defining dynamic
>> >> >> > beforeInsert and beforeUpdate methods in the doWithDynamicMethods
>> >> >> > section of
>> >> >> > my domain plugin.  However, I really want to see this method
>> >> >> > working
>> >> >> > since
>> >> >> > my current solution won't allow me to define
>> >> >> > beforeInsert/beforeUpdate
>> >> >> > methods directly on any domain classes that are affected that my
>> >> >> > doWithDynamicMethods affects without overwriting those dynamic
>> >> >> > methods.
>> >> >> >
>> >> >> > Any help would be appreciated.
>> >> >> >
>> >> >> > Jason
>> >> >> >
>> >> >> > On Tue, Aug 28, 2012 at 1:42 AM, Graeme Rocher-4 [via Grails]
>> >> >> > <[hidden
>> >> >>
>> >> >> > email]> wrote:
>> >> >> >>
>> >> >> >> Depending what datastore you're targeting (hibernate, mongo etc.)
>> >> >> >> you
>> >> >> >> can
>> >> >> >> do:
>> >> >> >>
>> >> >> >>     def doWithSpring = {
>> >> >> >>
>> >> >> >> ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> >> >> >> ref("hibernateDatastore")) {
>> >> >> >>             springSecurityService = ref('springSecurityService')
>> >> >> >>         }
>> >> >> >>     }
>> >> >> >>
>> >> >> >> Or
>> >> >> >>
>> >> >> >>     def doWithSpring = {
>> >> >> >>
>> >> >> >> ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> >> >> >> ref("mongoDatastore")) {
>> >> >> >>             springSecurityService = ref('springSecurityService')
>> >> >> >>         }
>> >> >> >>     }
>> >> >> >>
>> >> >> >> Cheers
>> >> >> >> On Mon, Aug 27, 2012 at 9:02 PM, jason.stlouis <[hidden email]>
>> >> >> >> wrote:
>> >> >> >>
>> >> >> >> > Did anyone ever figure this out? I am trying to accomplish the
>> >> >> >> > same
>> >> >> >> > thing and
>> >> >> >> > get the same exception when not providing a datastore as a
>> >> >> >> > constructor
>> >> >> >> > parameter ("method <init>()V not found") and can't find out how
>> >> >> >> > to
>> >> >> >> > reference
>> >> >> >> > the default datastore (my project that includes the plugin just
>> >> >> >> > uses
>> >> >> >> > default
>> >> >> >> > hibernate/gorm)
>> >> >> >> >
>> >> >> >> > For full information, I'm trying to do this from a plugin, I've
>> >> >> >> > defined
>> >> >> >> > my
>> >> >> >> > own extension to AbstractPersistenceEventListener and am
>> >> >> >> > defining
>> >> >> >> > it
>> >> >> >> > in
>> >> >> >> > my
>> >> >> >> > plugin definition in the doWithSpring closure :
>> >> >> >> >
>> >> >> >> >     def doWithSpring = {
>> >> >> >> >
>> >> >> >> > ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> >> >> >> > null) {
>> >> >> >> >             springSecurityService =
>> >> >> >> > ref('springSecurityService')
>> >> >> >> >         }
>> >> >> >> >     }
>> >> >> >> >
>> >> >> >> > I can get it to load and it is executed on events when using
>> >> >> >> > this
>> >> >> >> > definition, but the PersistentEntity in the
>> >> >> >> > AbstractPersistenceEvent
>> >> >> >> > is
>> >> >> >> > always null - I presume if it actually had access to the
>> >> >> >> > datastore
>> >> >> >> > it
>> >> >> >> > wouldn't be.
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > --
>> >> >> >> > View this message in context:
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633842.html
>> >> >> >> > Sent from the Grails - user mailing list archive at Nabble.com.
>> >>
>> >> >>
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > ---------------------------------------------------------------------
>> >> >> >> > To unsubscribe from this list, please visit:
>> >> >> >> >
>> >> >> >> >     http://xircles.codehaus.org/manage_email
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> --
>> >> >> >> Graeme Rocher
>> >> >> >> Grails Project Lead
>> >> >> >> SpringSource - A Division of VMware
>> >> >> >> http://www.springsource.com
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> ---------------------------------------------------------------------
>> >> >> >> To unsubscribe from this list, please visit:
>> >> >> >>
>> >> >> >>     http://xircles.codehaus.org/manage_email
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> ________________________________
>> >> >> >> If you reply to this email, your message will be added to the
>> >> >> >> discussion
>> >> >> >> below:
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633868.html
>> >> >> >> To unsubscribe from Getting the datastore in a grails 2.0.1
>> >> >> >> project,
>> >>
>> >> >> >> click
>> >> >> >> here.
>> >> >> >> NAML
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > ________________________________
>> >> >> > View this message in context: Re: Getting the datastore in a
>> >> >> > grails
>> >> >> > 2.0.1
>> >> >> > project
>> >> >> >
>> >> >> > Sent from the Grails - user mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Graeme Rocher
>> >> >> Grails Project Lead
>> >> >> SpringSource - A Division of VMware
>> >> >> http://www.springsource.com
>> >> >>
>> >> >>
>> >> >> ---------------------------------------------------------------------
>> >> >> To unsubscribe from this list, please visit:
>> >> >>
>> >> >>     http://xircles.codehaus.org/manage_email
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> ________________________________
>> >> >> If you reply to this email, your message will be added to the
>> >> >> discussion
>> >> >> below:
>> >> >>
>> >> >>
>> >> >>
>> >> >> http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633962.html
>> >> >> To unsubscribe from Getting the datastore in a grails 2.0.1 project,
>> >> >> click
>> >> >> here.
>> >> >> NAML
>> >> >
>> >> >
>> >> >
>> >> > ________________________________
>> >> > View this message in context: Re: Getting the datastore in a grails
>> >> > 2.0.1
>> >> > project
>> >> > Sent from the Grails - user mailing list archive at Nabble.com.
>> >>
>> >>
>> >>
>> >> --
>> >> Graeme Rocher
>> >> Grails Project Lead
>> >> SpringSource - A Division of VMware
>> >> http://www.springsource.com
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe from this list, please visit:
>> >>
>> >>     http://xircles.codehaus.org/manage_email
>> >>
>> >>
>> >>
>> >>
>> >> ________________________________
>> >> If you reply to this email, your message will be added to the
>> >> discussion
>> >> below:
>> >>
>> >>
>> >> http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4634020.html
>> >> To unsubscribe from Getting the datastore in a grails 2.0.1 project,
>> >> click
>> >> here.
>> >> NAML
>> >
>> >
>> >
>> > ________________________________
>> > View this message in context: Re: Getting the datastore in a grails
>> > 2.0.1
>> > project
>> > Sent from the Grails - user mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Graeme Rocher
>> Grails Project Lead
>> SpringSource - A Division of VMware
>> http://www.springsource.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>



--
Graeme Rocher
Grails Project Lead
SpringSource - A Division of VMware
http://www.springsource.com

---------------------------------------------------------------------
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: Getting the datastore in a grails 2.0.1 project

jason.stlouis
ok, will do.

On Fri, Aug 31, 2012 at 10:07 AM, Graeme Rocher <[hidden email]> wrote:
On Fri, Aug 31, 2012 at 4:57 PM, Jason St Louis <[hidden email]> wrote:
> Ok, I added http://jira.grails.org/browse/GRAILS-9373.  I'll see what I can
> do about updating the documentation.
>
> Any ideas about my other problem, event.entity and event.entityAccess always
> being null in my Listener?

From the code there is no way this should be happening. I can't
reproduce when running the tests for our normal event listeners
either. Can you post an example in a JIRA?

Cheers
>
>
> On Fri, Aug 31, 2012 at 3:34 AM, Graeme Rocher <[hidden email]> wrote:
>>
>> Yeah I think the datastore should be a bean, feel free to raise a JIRA
>> ticket for that and to update the docs on how to do this properly
>>
>> Thanks
>>
>> On Thu, Aug 30, 2012 at 5:28 PM, jason.stlouis <[hidden email]>
>> wrote:
>> > I found another way to reference the hibernateDatastore form this Jira:
>> > http://jira.grails.org/browse/GRAILS-8824
>> >
>> > grailsApplication.mainContext.eventTriggeringInterceptor.datastores
>> >
>> > So now I'm doing this in my plugin config:
>> >
>> > def doWithApplicationContext = { applicationContext ->
>> >     application.mainContext.eventTriggeringInterceptor.datastores.each {
>> > k,
>> > datastore ->
>> >         applicationContext.addApplicationListener new
>> > UserAuditedPersistenceEventListener(datastore,
>> > applicationContext.springSecurityService)
>> >     }
>> > }
>> >
>> > and that works. Here's my next question :)
>> >
>> > I followed the same pattern in my listener that the
>> > AutoTimestampEventListener does:
>> >
>> > https://github.com/SpringSource/grails-data-mapping/blob/master/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/events/AutoTimestampEventListener.java
>> >
>> > However, in my Listener the event.entity and event.entityAccess are
>> > always
>> > null - the only thing I can reference is the event.entityObject - which
>> > I've
>> > been able to use to do what I'm trying to do (I'm updating the createdBy
>> > and
>> > updatedBy user on objects) - but doing it this way ends up in 1 insert
>> > and 2
>> > updates getting run every time I create a new domain object, and 2
>> > updates
>> > getting run whenever I update a domain object.  So are event.entity and
>> > event.entityAccess expected to be null here or am I missing something
>> > else?
>> >
>> > Also, based on your responses in this thread (and your comment on
>> > GRAILS-8824), it seems you expect a hibernateDatastore bean to be
>> > present in
>> > the applicationContext and there isn't - is this something that should
>> > be
>> > corrected? Should I put in a Jira ticket for that?
>> >
>> > Thanks a bunch for your help Graeme!  Hopefully this thread will be a
>> > good
>> > resource for anyone else trying to accomplish this.
>> >
>> >
>> > On Thu, Aug 30, 2012 at 1:40 AM, Graeme Rocher-4 [via Grails] <[hidden
>> > email]> wrote:
>> >>
>> >> Hmm yeah we do need to make this easier and improve the documentation.
>> >>
>> >> It seems we never register a bean for the HibernateDatastore, you'll
>> >> probably need to create your own instance:
>> >>
>> >>         MappingContext mappingContext =
>> >> ctx.getBean("grailsDomainClassMappingContext", MappingContext)
>> >>         SessionFactory sessionFactory = ctx.getBean("sessionFactory")
>> >>         final datastore = new HibernateDatastore(mappingContext,
>> >> sessionFactory, ctx, application.config)
>> >>
>> >> Sorry for the hassle
>> >>
>> >> Cheers
>> >>
>> >> On Wed, Aug 29, 2012 at 4:57 PM, jason.stlouis <[hidden email]> wrote:
>> >>
>> >> > Thanks for trying to help Graeme but this still does not work for me:
>> >> >
>> >> > I put the following in my Bootstrap:
>> >> >
>> >> > class BootStrap {
>> >> >
>> >> >     def init = { servletContext ->
>> >> >         log.debug "Running Application Bootstrap"
>> >> >         log.debug  "Listing available datastores"
>> >> >         def applicationContext =
>> >> >
>> >> > servletContext.getAttribute(ApplicationAttributes.APPLICATION_CONTEXT)
>> >> >         def datastores = applicationContext.getBeansOfType(Datastore)
>> >> >         log.debug  "Datastore count: ${datastores.size()}"
>> >> >         for(d in datastores) {
>> >> >             log.debug  "Datastore: ${d}"
>> >> >             //applicationContext.addApplicationListener new
>> >> > OwnedPersistenceEventListener(d)
>> >> >         }
>> >> >
>> >> > And see the following in the log:
>> >> >
>> >> > 2012-08-29 09:52:08,129 [pool-5-thread-1] DEBUG conf.BootStrap  -
>> >> > Running
>> >> > Application Bootstrap
>> >> > 2012-08-29 09:52:08,129 [pool-5-thread-1] DEBUG conf.BootStrap  -
>> >> > Listing
>> >> > datastores
>> >> > 2012-08-29 09:52:08,132 [pool-5-thread-1] DEBUG conf.BootStrap  -
>> >> > Datastore
>> >> > count: 0
>> >> >
>> >> > This is far more complicated than the documentation in 6.5.1 for
>> >> > Custom
>> >> > Event Listeners led me to believe.
>> >> >
>> >> > On Wed, Aug 29, 2012 at 1:53 AM, Graeme Rocher-4 [via Grails]
>> >> > <[hidden
>> >>
>> >> > email]> wrote:
>> >> >>
>> >> >> Well looking at the code that does this in the various plugins, they
>> >> >> don't use Spring config to achieve what you're trying to achieve.
>> >> >> What
>> >> >> they do is:
>> >> >>
>> >> >>     void configure(ConfigurableApplicationContext ctx) {
>> >> >>         final datastore =
>> >> >> ctx.getBean("${datastoreType.toLowerCase()}Datastore", Datastore)
>> >> >>         ctx.addApplicationListener new
>> >> >> DomainEventListener(datastore)
>> >> >>         ctx.addApplicationListener new
>> >> >> AutoTimestampEventListener(datastore)
>> >> >>     }
>> >> >>
>> >> >> Which happens after the ApplicationContext is built. You would have
>> >> >> to
>> >> >> do this in your application I would guess. To do this with a
>> >> >> BootStrap
>> >> >> class you would have to do:
>> >> >>
>> >> >> class BootStrap implements ApplicationContextAware {
>> >> >>
>> >> >>    ApplicationContext applicationContext
>> >> >>    def init = {
>> >> >>         def datastores =
>> >> >> applicationContext.getBeansOfType(Datastore)
>> >> >>         for(d in datastores) {
>> >> >>             applicationContext.addApplicationListener new
>> >> >> MyEventListener(d)
>> >> >>         }
>> >> >>    }
>> >> >> }
>> >> >>
>> >> >> Note: untested code
>> >> >>
>> >> >> Cheers
>> >> >>
>> >> >> On Tue, Aug 28, 2012 at 4:04 PM, jason.stlouis <[hidden email]>
>> >> >> wrote:
>> >> >>
>> >> >> > That didn't work - here's the error message I receive:
>> >> >> >
>> >> >> > | Error 2012-08-28 08:44:33,868 [pool-5-thread-1] ERROR
>> >> >> > context.GrailsContextLoader  - Error executing bootstraps: Error
>> >> >> > creating
>> >> >> > bean with name 'ownedPersistenceEventListener': Cannot resolve
>> >> >> > reference
>> >> >> > to
>> >> >> > bean 'hibernateDatastore' while setting constructor argument;
>> >> >> > nested
>> >> >> > exception is
>> >> >> > org.springframework.beans.factory.NoSuchBeanDefinitionException:
>> >> >> > No
>> >> >> > bean
>> >> >> > named 'hibernateDatastore' is defined
>> >> >> > Message: Error creating bean with name
>> >> >> > 'ownedPersistenceEventListener':
>> >> >> > Cannot resolve reference to bean 'hibernateDatastore' while
>> >> >> > setting
>> >> >> > constructor argument; nested exception is
>> >> >> > org.springframework.beans.factory.NoSuchBeanDefinitionException:
>> >> >> > No
>> >> >> > bean
>> >> >> > named 'hibernateDatastore' is defined
>> >> >> >    Line | Method
>> >> >> > ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
>> >> >> > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> >> >> > - -
>> >> >> > -
>> >> >> > |   138 | run      in java.util.concurrent.FutureTask
>> >> >> > |   886 | runTask  in
>> >> >> > java.util.concurrent.ThreadPoolExecutor$Worker
>> >> >> > |   908 | run      in     ''
>> >> >> > ^   662 | run . .  in java.lang.Thread
>> >> >> >
>> >> >> > Caused by NoSuchBeanDefinitionException: No bean named
>> >> >> > 'hibernateDatastore'
>> >> >> > is defined
>> >> >> > ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
>> >> >> > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> >> >> > - -
>> >> >> > -
>> >> >> > |   138 | run      in java.util.concurrent.FutureTask
>> >> >> > |   886 | runTask  in
>> >> >> > java.util.concurrent.ThreadPoolExecutor$Worker
>> >> >> > |   908 | run      in     ''
>> >> >> > ^   662 | run . .  in java.lang.Thread
>> >> >> >
>> >> >> > I put a little snippet in Boostrap.groovy to output the names of
>> >> >> > all
>> >> >> > the
>> >> >> > beans in the applicationContext and I don't see hibernateDatastore
>> >> >> > in
>> >> >> > there.
>> >> >> >
>> >> >> > I am just using the default gorm implementation right now as this
>> >> >> > is
>> >> >> > a
>> >> >> > new
>> >> >> > app. I only have the following additional plugins installed:
>> >> >> > fields 1.3
>> >> >> > spring-security-core 1.2.7.3
>> >> >> > twitter-bootstrap 2.1.0
>> >> >> >
>> >> >> > I've actually accomplished what I want to do by defining dynamic
>> >> >> > beforeInsert and beforeUpdate methods in the doWithDynamicMethods
>> >> >> > section of
>> >> >> > my domain plugin.  However, I really want to see this method
>> >> >> > working
>> >> >> > since
>> >> >> > my current solution won't allow me to define
>> >> >> > beforeInsert/beforeUpdate
>> >> >> > methods directly on any domain classes that are affected that my
>> >> >> > doWithDynamicMethods affects without overwriting those dynamic
>> >> >> > methods.
>> >> >> >
>> >> >> > Any help would be appreciated.
>> >> >> >
>> >> >> > Jason
>> >> >> >
>> >> >> > On Tue, Aug 28, 2012 at 1:42 AM, Graeme Rocher-4 [via Grails]
>> >> >> > <[hidden
>> >> >>
>> >> >> > email]> wrote:
>> >> >> >>
>> >> >> >> Depending what datastore you're targeting (hibernate, mongo etc.)
>> >> >> >> you
>> >> >> >> can
>> >> >> >> do:
>> >> >> >>
>> >> >> >>     def doWithSpring = {
>> >> >> >>
>> >> >> >> ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> >> >> >> ref("hibernateDatastore")) {
>> >> >> >>             springSecurityService = ref('springSecurityService')
>> >> >> >>         }
>> >> >> >>     }
>> >> >> >>
>> >> >> >> Or
>> >> >> >>
>> >> >> >>     def doWithSpring = {
>> >> >> >>
>> >> >> >> ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> >> >> >> ref("mongoDatastore")) {
>> >> >> >>             springSecurityService = ref('springSecurityService')
>> >> >> >>         }
>> >> >> >>     }
>> >> >> >>
>> >> >> >> Cheers
>> >> >> >> On Mon, Aug 27, 2012 at 9:02 PM, jason.stlouis <[hidden email]>
>> >> >> >> wrote:
>> >> >> >>
>> >> >> >> > Did anyone ever figure this out? I am trying to accomplish the
>> >> >> >> > same
>> >> >> >> > thing and
>> >> >> >> > get the same exception when not providing a datastore as a
>> >> >> >> > constructor
>> >> >> >> > parameter ("method <init>()V not found") and can't find out how
>> >> >> >> > to
>> >> >> >> > reference
>> >> >> >> > the default datastore (my project that includes the plugin just
>> >> >> >> > uses
>> >> >> >> > default
>> >> >> >> > hibernate/gorm)
>> >> >> >> >
>> >> >> >> > For full information, I'm trying to do this from a plugin, I've
>> >> >> >> > defined
>> >> >> >> > my
>> >> >> >> > own extension to AbstractPersistenceEventListener and am
>> >> >> >> > defining
>> >> >> >> > it
>> >> >> >> > in
>> >> >> >> > my
>> >> >> >> > plugin definition in the doWithSpring closure :
>> >> >> >> >
>> >> >> >> >     def doWithSpring = {
>> >> >> >> >
>> >> >> >> > ownedPersistenceEventListener(OwnedPersistenceEventListener,
>> >> >> >> > null) {
>> >> >> >> >             springSecurityService =
>> >> >> >> > ref('springSecurityService')
>> >> >> >> >         }
>> >> >> >> >     }
>> >> >> >> >
>> >> >> >> > I can get it to load and it is executed on events when using
>> >> >> >> > this
>> >> >> >> > definition, but the PersistentEntity in the
>> >> >> >> > AbstractPersistenceEvent
>> >> >> >> > is
>> >> >> >> > always null - I presume if it actually had access to the
>> >> >> >> > datastore
>> >> >> >> > it
>> >> >> >> > wouldn't be.
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > --
>> >> >> >> > View this message in context:
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633842.html
>> >> >> >> > Sent from the Grails - user mailing list archive at Nabble.com.
>> >>
>> >> >>
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > ---------------------------------------------------------------------
>> >> >> >> > To unsubscribe from this list, please visit:
>> >> >> >> >
>> >> >> >> >     http://xircles.codehaus.org/manage_email
>> >> >> >> >
>> >> >> >> >
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> --
>> >> >> >> Graeme Rocher
>> >> >> >> Grails Project Lead
>> >> >> >> SpringSource - A Division of VMware
>> >> >> >> http://www.springsource.com
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> ---------------------------------------------------------------------
>> >> >> >> To unsubscribe from this list, please visit:
>> >> >> >>
>> >> >> >>     http://xircles.codehaus.org/manage_email
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> ________________________________
>> >> >> >> If you reply to this email, your message will be added to the
>> >> >> >> discussion
>> >> >> >> below:
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633868.html
>> >> >> >> To unsubscribe from Getting the datastore in a grails 2.0.1
>> >> >> >> project,
>> >>
>> >> >> >> click
>> >> >> >> here.
>> >> >> >> NAML
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > ________________________________
>> >> >> > View this message in context: Re: Getting the datastore in a
>> >> >> > grails
>> >> >> > 2.0.1
>> >> >> > project
>> >> >> >
>> >> >> > Sent from the Grails - user mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Graeme Rocher
>> >> >> Grails Project Lead
>> >> >> SpringSource - A Division of VMware
>> >> >> http://www.springsource.com
>> >> >>
>> >> >>
>> >> >> ---------------------------------------------------------------------
>> >> >> To unsubscribe from this list, please visit:
>> >> >>
>> >> >>     http://xircles.codehaus.org/manage_email
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> ________________________________
>> >> >> If you reply to this email, your message will be added to the
>> >> >> discussion
>> >> >> below:
>> >> >>
>> >> >>
>> >> >>
>> >> >> http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4633962.html
>> >> >> To unsubscribe from Getting the datastore in a grails 2.0.1 project,
>> >> >> click
>> >> >> here.
>> >> >> NAML
>> >> >
>> >> >
>> >> >
>> >> > ________________________________
>> >> > View this message in context: Re: Getting the datastore in a grails
>> >> > 2.0.1
>> >> > project
>> >> > Sent from the Grails - user mailing list archive at Nabble.com.
>> >>
>> >>
>> >>
>> >> --
>> >> Graeme Rocher
>> >> Grails Project Lead
>> >> SpringSource - A Division of VMware
>> >> http://www.springsource.com
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe from this list, please visit:
>> >>
>> >>     http://xircles.codehaus.org/manage_email
>> >>
>> >>
>> >>
>> >>
>> >> ________________________________
>> >> If you reply to this email, your message will be added to the
>> >> discussion
>> >> below:
>> >>
>> >>
>> >> http://grails.1312388.n4.nabble.com/Getting-the-datastore-in-a-grails-2-0-1-project-tp4521590p4634020.html
>> >> To unsubscribe from Getting the datastore in a grails 2.0.1 project,
>> >> click
>> >> here.
>> >> NAML
>> >
>> >
>> >
>> > ________________________________
>> > View this message in context: Re: Getting the datastore in a grails
>> > 2.0.1
>> > project
>> > Sent from the Grails - user mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Graeme Rocher
>> Grails Project Lead
>> SpringSource - A Division of VMware
>> http://www.springsource.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>



--
Graeme Rocher
Grails Project Lead
SpringSource - A Division of VMware
http://www.springsource.com

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

    http://xircles.codehaus.org/manage_email



12
Loading...