Try removing @Inject and only keep @PersistenceContext for the EntityManager field ? :)
On Fri, Oct 11, 2013 at 3:17 PM, Andreas Ernst <a...@ae-online.de> wrote: > Am 11.10.13 13:13, schrieb Eugen: > > Hi, if You defined more persistence units in Your persistence.xml file >> you should inject the EntityManager >> by >> @Inject >> @PersistenceContext(unitName = "unitname") >> > > public class Customers { > > @Property > private Customer customer; > private EntityManagerFactory factory; > @Inject > @PersistenceContext(unitName = "de.aeits_TapestryWeb_war_1.0-** > SNAPSHOTPU") > private EntityManager entityManager; > > > @Log > public List<Customers> getCustomers() { > return entityManager.**createNamedQuery("Customer.** > findAll").getResultList(); > } > } > > org.apache.tapestry5.ioc.**internal.OperationException: Field > entityManager of class de.aeits.tapestryweb.pages.**Customers can not be > claimed by @javax.persistence.**PersistenceContext as it is already > claimed by @Inject. > at org.apache.tapestry5.ioc.**internal.OperationTrackerImpl.** > logAndRethrow(**OperationTrackerImpl.java:121) > at org.apache.tapestry5.ioc.**internal.OperationTrackerImpl.** > invoke(OperationTrackerImpl.**java:88) > at org.apache.tapestry5.ioc.**internal.OperationTrackerImpl.** > run(OperationTrackerImpl.java:**47) > at org.apache.tapestry5.ioc.**internal.** > PerThreadOperationTracker.run(**PerThreadOperationTracker.**java:76) > at org.apache.tapestry5.ioc.**internal.RegistryImpl.run(** > RegistryImpl.java:1116) > > > -- > ae | Andreas Ernst | IT Spektrum > Postfach 5, 65612 Beselich > Schupbacher Str. 32, 65614 Beselich, Germany > Tel: +49-6484-91002 Fax: +49-6484-91003 > a...@ae-online.de | www.ae-online.de > www.tachyon-online.de > > ------------------------------**------------------------------**--------- > To unsubscribe, e-mail: > users-unsubscribe@tapestry.**apache.org<users-unsubscr...@tapestry.apache.org> > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Dmitry Gusev AnjLab Team http://anjlab.com