users@glassfish.java.net

Re: Script Entity Beans using Groovy

From: Vivek Pandey <Vivek.Pandey_at_Sun.COM>
Date: Fri, 30 May 2008 10:49:01 -0700

There is JSF groovy support that enables you writing JSF components and
managed beans in groovy. See Ryan's blog[1] that details the approach.
Here he is using a servlet filter to process the groovy scripts, under
the hood it uses GroovyScriptEngine to interpret the groovy scripts.

I am not sure but you can try by creating GroovyScriptEngine[2] with the
thread contextClassLoader frm inside the filter and write your own
classloader that is used to load the Persistence class and create
EntityManager from it. Mitesh or someone from JPA team can confirm this
approach but I think this should work.

I would like to know how it goes...

-vivek.

[1]http://blogs.sun.com/rlubke/entry/groovy_mojarra
[2]http://groovy.codehaus.org/api/groovy/util/GroovyScriptEngine.html

glassfish_at_javadesktop.org wrote:
> Hi,
>
> We are currently doing a pilot project using Java EE and Glassfish.
> Something we would like to do is to be able to write some of the Entity beans using a scripting language.
> I have had a look at groovy and seen some examples of it being used with JPA in a standalone java application.
> I cannot get this working in Glassfish as the scripted classes cannot be found when deploying the application.
>
> I have tried a few things like creating a LicecycleListener where I load the classes at server startup.
> I can then load them using the GroovyClassloader, but the EJBClassloader cannot find them.
>
> Is this at all possible to achieve using Glassfish?
>
> Thanks for your help
>
> Hans
> [Message sent by forum member 'hansflhotmailcom' (hansflhotmailcom)]
>
> http://forums.java.net/jive/thread.jspa?messageID=277521
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>