quality@glassfish.java.net

Re: Coding for Java-EE 6 while being compatible to Java-EE 5

From: Richard Kolb <rjdkolb_at_gmail.com>
Date: Thu, 24 Dec 2009 08:59:43 +0200

Hi Judy

I have launched a project on Kenai :http://kenai.com/projects/enerwebsample

There are two sample application there :
1) RefSampleEJBApp<http://kenai.com/projects/enerwebsample/sources/source-code-repository/show/RefSampleEJBApp?rev=3>A
simple EJB project using JPA 2.0 and Stateless EJB Facades to expose
the
database.
2) RefSampleWebCrudApp<http://kenai.com/projects/enerwebsample/sources/source-code-repository/show/RefSampleWebCrudApp?rev=3>A
simple JSF 2 application that uses the EJB application.

Both subprojects still need to be vetted and are in initial working states.

The problem with the EJB project is I can not write proper unit tests for
it. We used to write tests using the OpenEJB standalone container, but
OpenEJB seems to freak out about JPA 2 , actually the way the Facades are
built with JPA 2 specific queries.

We need a proper way of testing the EJB project with injection and
transactions.
I was going to move the queries back to JPA 1 style queries, but I will hold
off for a while.

regards
Richard.


2009/12/23 Judy Tang <Judy.J.Tang_at_sun.com>

> Hi Richard, Felipe, Richard,
>
> Nice to see you all. The response may be slower for the holiday season but
> we will continue keep track and follow up.
> Seeing community help each other is great way.
>
> Here is the complete set of GlassFish v2.1.1 doc: click
> <http://docs.sun.com/app/docs/coll/1343.11?l=en&q=Sun+GlassFish+Enterprise+Server+v2.1.1>, good to keep it around :-)
>
> Bookmark this too, complete set of GlassFish v3 doc at: click
> <http://docs.sun.com/app/docs/coll/1343.9?l=en&q=Sun+GlassFish+Enterprise+Server+v3>
>
> For any suggestion on doc, you can continue log a doc issue.
>
> Happy Holidays!
> Judy
>
>
> Richard Kolb wrote:
>
> Hi Wouter
>
> Perhaps I should explain myself fully.
>
> Previously I was using OpenEJB to test my EJB's. OpenEJB allows me to do
> this without a container.
>
> Context initialContext = Properties props = new Properties();
>
> props.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("openejb.properties"));
> props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
> LocalInitialContextFactory.class.getName());
> Context initialContext = new InitialContext(props);
> testConEjb = (TestConnection2EJBLocal)
> initialContext.lookup("TestConnection2EJBLocal");
>
> testConEjb.bla(); // this is my EJB with all the injection done
>
> Perhaps I can do this with GlassFish 3 embedded.
> Have not used it before, and not sure it is final yet.
>
> http://blogs.sun.com/alexismp/entry/glassfish_embedded_reloaded
>
> regards
> Richard.
>
>
>
> 2009/12/23 Wouter van Reeven <wouter_at_van.reeven.nl>
>
>> Hi Richard,
>>
>>
>> Maybe you can package the javax-ejb.jar and the jars it depends on with
>> your application? Please note that GlassFish 2 may require an EAR where
>> GlassFish 3 will allow a WAR.
>>
>>
>> HTH, Wouter
>>
>> On Wed, Dec 23, 2009 at 12:08:01PM +0200, Richard Kolb wrote:
>> > Hi Cats
>> >
>> > I have created my new JPA 2 application for GlassFish 3.
>> >
>> > And it works great.
>> >
>> > JPA 2 example :
>> > CriteriaQuery cq = em.getCriteriaBuilder().createQuery();
>> > cq.select(cq.from(Manufacturer.class));
>> > Query q = em.createQuery(cq);
>> >
>> > As apposed to JPA 1 :
>> > Query q = em.createQuery("select object(o) from Manufacturer as o");
>> >
>> > The problem I have now is this app won't work in GlassFish 2.1. And one
>> of the
>> > developers that works with me is complaining bitterly.
>> >
>> >
>> > Any ideas on how to make sure my app is compatible with GlassFish 2 and
>> still
>> > use JPA 2 ?
>> >
>> >
>> > regards
>> > Richard.
>> >
>> >
>> >
>>
>> --
>> There are 10 kinds of people in the world. Those that understand
>> the binary system and those that don't.
>> [Unknown Source]
>>
>> Skype: wvreeven
>> Facebook: wvreeven
>> Twitter: wvreeven
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: quality-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: quality-help_at_glassfish.dev.java.net
>>
>>
>




picture
(image/png attachment: 01-part)