« Return to Thread: domain relationships in shell / console
This should work in the groovy console, the shell has a problem since
it was migrated to the new syntax highlighted one that means the
events aren't fired (which attach a hibernate session to each command)
Cheers--
On Feb 12, 2008 3:03 PM, Jon Evans <jon@...> wrote:
>
> Hi,
>
> I'm trying to investigate the properties of relationships between domain
> objects, using the groovy console or shell. I can't get it to load the
> associations though.
>
> /* trimmed down to remove irrelevant fields and methods */
> class Customer {
> String name
> Set sites
> static hasMany = [ sites : Site ]
> }
>
> $ grails shell
> [...]
> groovy:000> c = Customer.get(1)
> ===> Customer One
>
> groovy:000> c.sites
> [92288] hibernate.LazyInitializationException failed to lazily initialize a
> collection of role: Customer.sites, no session or session was closed
> [snip massive stack trace]
>
> I think I understand what's happening, but I need some code for the console
> that says "execute the following block in the context of a valid Hibernate
> session".
>
> Thanks
>
> Jon
> --
> View this message in context: http://www.nabble.com/domain-relationships-in-shell---console-tp15434264p15434264.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
G2One, Inc. Chief Technology Officer
http://www.g2one.com
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
« Return to Thread: domain relationships in shell / console
| Free embeddable forum powered by Nabble | Forum Help |