users@jpa-spec.java.net

[jpa-spec users] [jsr338-experts] Re: Picking the right persistence unit from multiple choices when no unitName is specified

From: Matthew Adams <matthew_at_matthewadams.me>
Date: Wed, 19 Jun 2013 10:07:13 -0500

Perhaps a Java system property called "javax.persistence.default-unit"
would work here instead, since you're talking about a concept that spans
multiple persistence units?


On Wed, Jun 19, 2013 at 6:50 AM, Scott Marlow <smarlow_at_redhat.com> wrote:

> Should application deployment fail if there are multiple persistence units
> defined and no unitName is specified? If not, which persistence unit
> should be picked?
>
> For example, given the below persistence.xml contents:
>
> "
> <persistence
> <persistence-unit name="rightpu1">
> </persistence-unit>
> <persistence-unit name="otherrightpu2">
> </persistence-unit>
> </persistence>
> "
>
> And a persistence context:
>
> "
> @PersistenceContext EntityManager randompu;
> "
>
> Should "rightpu1" be used or "otherrightpu2"?
>
> Should we have a standard pu property ("javax.persistence.default") that
> allows the default pu to be specified for this case?
>
> If the default pu property is not specified, should application deployment
> fail for this case? Or should the application deployment continue with
> whichever persistence unit the deployer happens to pick?
>
> Scott
>



-- 
mailto:matthew_at_matthewadams.me <matthew_at_matthewadams.me>
skype:matthewadams12
googletalk:matthew_at_matthewadams.me
http://matthewadams.me
http://www.linkedin.com/in/matthewadams