views:

989

answers:

2
+1  A: 

This exceptions means that you are trying to autowire EntityManagerFactory by type. Do you have any @Autowired annotation in your code?

Aslo, when using @PersistenceContext, set the unit attribute correctly. And (I'm not sure if this is a proper thing to do) - try setting the name attribute to your respective factory name.

Also, check if you haven't copy-pasted incorrectly the REST transaction manager - now there is no such bean REST

Bozho
No @Autowired annotations in my source, I always use:<br>@PersistenceContextprivate EntityManager em;
Castanho
I don't get your point about: transactionManagerREST
Castanho
the <tx:annotation-driven transaction-manager="REST" /> - doesn't seem right
Bozho
check my update about @PersistenceContext usage
Bozho
I understand that if I did not specify the unitName when using @PersistenceContext will use the default, take a look in this link: http://static.springsource.org/spring/docs/2.0.x/reference/transaction.html#transaction-declarative-annotationslook the TIP
Castanho
Which one is the default? There are two entity manager factories.The link you provided is about @Transactional, not @PersistenceContext
Bozho
Yea sorry Bozho, actually what I mean to look in this link is about if I need to specify a name in tx:annotation-driven. Sorry my mistake!
Castanho
A: 

Ensure all of your @PersistenceContext specify unitName. I haven't figured out how to tell Spring that a particular EMF or PersistenceUnit is the default. I thought specifying primary="true" on the default EMF would work but doesn't appear to

Andy O