If you have defined only one persistence unit in your config then openejb will 
inject that into any bare @PersistenceContext annotations so you don’t need to 
be explicit by specifying the unit name with the annotation. If you have 
multiple defined units in your config, then you must add the (unitName 
=“movie-unit”) to the annotation.



On 27 Feb 2014, at 08:42, mauro2java2011 <[email protected]> wrote:

> i know that for inject a EntityManager i have to write:
> 
> 
> @PersistenceContext(unitName = "movie-unit")
>    private EntityManager entityManager;
> 
> But from examples i have also  found  a  different use:
> 
> @PersistenceContex
>    private EntityManager entityManager;
> 
> when it is possible  use it?
> 
> 
> 
> 
> --
> View this message in context: 
> http://openejb.979440.n4.nabble.com/when-use-the-inject-EntityManager-without-specify-the-unitname-tp4668006.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to