• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

entityManager always NULL

Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I looked thru all the available info on this problem in the Internet, nothing applies to or work in my case. Any info and help will be greatly appreciated.

In my Controller,

httpMsg.persist() <----- SUCCESSFUL
return "redirect:/httpmsg/" + httpmsg.getId(); <------ entityManager NULL when doing HTTPMsg.findHTTPMsg(id) in the 'show' method.

To be exact, the problem happens when doing a new EntityManger:

public static final EntityManager entityManager() {
EntityManager em = new HTTPMsg(){}.entityManager;
if (em == null)
throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
return em;

In my Controller:

In my POJO:

In my ApplicationContext.xml, I have:

Also, posted in the Spring Forum but no response so far. Please kindly give me some help on this.

Many Thanks in advance.
    Bookmark Topic Watch Topic
  • New Topic