ok, You need @Inject in services, in a page @PersistenceContext is enought..

2013/10/11 Andreas Ernst <[email protected]>:
> 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
> [email protected] | www.ae-online.de
> www.tachyon-online.de
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to