users@glassfish.java.net

Re: need PersistenceUnit configuration parameters

From: Sahoo <Sahoo_at_Sun.COM>
Date: Sun, 18 Jan 2009 11:09:00 +0530

Martin Gainty wrote:
> Hello All
>
> Would anyone know the proper NetBeans 6.5 configuration for
> PersistenceUnit for PetStore 2.x Sample App?
>
> Here is a sampling of PersistenceUnit annotation from
> com.sun.javaee.blueprints.petstore.modelCatalogFacade.java
> @PersistenceUnit(unitName="PetstorePu")
> private EntityManagerFactory emf;
>
> and here is persistence-unit-ref element from web.xml
> <persistence-unit-ref>
>
> <persistence-unit-ref-name>com.sun.javaee.blueprints.petstore.model.CatalogFacade/emf</persistence-unit-ref-name>
> <persistence-unit-name>PetstorePu</persistence-unit-name>
> <injection-target>
>
> <injection-target-class>com.sun.javaee.blueprints.petstore.model.CatalogFacade</injection-target-class>
> <injection-target-name>emf</injection-target-name>
> </injection-target>
> </persistence-unit-ref>
>
You don't really need persistence-unit-ref in web.xml unless you have
set metadata-complete=true in your web.xml. Otherwise, you can safely
remove <persistence-unit-ref> from your web.xml, as it you are already
using @PersistenceUnit in your code.
> AND the MASSIVE stack trace when attempting to run in Netbeans 6.5
>
The stack trace is caused while trying to look up the datasource your
persistence.xml is configured with. Have you created the datasource in
GlassFish?

Thanks,
Sahoo