Sunday, 15 August 2010

java ee - JavaEE EJB and Groovy -



java ee - JavaEE EJB and Groovy -

i wanted seek groovy , figured using view layer in new javaee project (no grails or similar). there lot of talk of groovy + javaee, can't find working case match mine.

so have maven ear project, model/controller ejb module remain on java (i included groovy dependencies seems have utilize java that), while view module has total groovy support. using eclipse + m2e , integrates , compiles fine far. in view module can create groovy bean , seems work fine. problem cannot find way inject ejb bean groovy bean via @ejb annotation. since cannot find illustration of similar setup might not possible.

so rest curiosity, if knows how can groovy bean read info ejb's? needn't via said annotation @ all, way fine. create webservice one, bit overly complicated , redundant.

i know slightly old thread, searching, managed utilize groovy in java ee 6 project. both controller , ejbs injected controllers using @ejb.

here's setup:

eclipse juno 4.2.2 ubuntu 12.04 groovy 2.1.3 jsf 2.1 glassfish 3.1.2

the trickiest part groovy lib needs copied glassfish/lib, postgres jdbc driver.

i created new enterprise application project in eclipse, , created:

connector module: interfaces , model, java, think groovy doable web module: groovy controllers ejb module: groovy ejbs

the controller:

@managedbean @viewscoped class controller { @ejb servicelocal service list list() { service.list() } }

the ejb:

@stateless class service implements servicelocal { @override public list<model> list() { [ [name: "a"], [name: "b"], [name: "c"] ] }

and view:

<h:datatable value="#{controller.list()}" var="e"> <h:column> <f:facet name="header">name</f:facet> #{e.name} </h:column> </h:datatable>

and works fine.

java-ee maven groovy ejb

No comments:

Post a Comment