users@glassfish.java.net

Glassfish v3 - default persistence unit name

From: <glassfish_at_javadesktop.org>
Date: Sun, 27 Sep 2009 06:11:52 PDT

Hi,

I am trying to create a new app in Glassfish V3 with JSF2, et al. To get access to an entity manager the following code seems to be used by most of the examples.

@PersistenceContext(unitName="abc")
EntityManager em;

Where the abc persistence unit is defined in a persistence.xml file.

How can I define a default persistent unit to be used so that I can write code like

@PersistenceContext
EntityManager em;

It's important that I don't hard wire the unitName in the code as some of these a relibraries that will be used by multiple applications.

Once again any help would be much appreciated.

Regards.
[Message sent by forum member 'arshadm' (arshadm_at_compuvision.co.uk)]

http://forums.java.net/jive/thread.jspa?messageID=365952