Hi all,
I'm having a problem with autowiring my EntityManager. Actually at server startup I can see that the injection works ok, though when trying to use my EntityManager it appears to be null again.
@Component
public class DataDaoImpl {
protected EntityManager entityManager;
@Autowired
public void setEntityManager(EntityManager entityManager) {
System.out.println("Injecting "+entityManager); //works!
this.entityManager = entityManager;
}
public void createData(String key, String value) {
System.out.println("In createData entityManager is "+entityManager);
//entityManager null!?
...
Output:
Injecting org.datanucleus.store.appengine.jpa.DatastoreEntityManager@a60d19
The server is running at http://localhost:8888/
In createData entityManager is null
So somehow the autowired entityManager is reset to null when trying to use it. It's a graniteds powered project though I don't think this is graniteds related.
Any ideas?
Thanks a lot in advance,
Jochen