This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Spring and the fly likes entityManager always NULL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "entityManager always NULL" Watch "entityManager always NULL" New topic
Author

entityManager always NULL

Mimi Tam
Ranch Hand

Joined: Mar 05, 2010
Posts: 121
Hi,

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: entityManager always NULL
 
Similar Threads
Within the infrastruture - How to and Where - to intercept HTTP request and to send HTTP response?
@Responsebody for HTTP msg and a View to show the HTTP response msg
How do a RequestMapping in Spring 3.0 for /{id} and /form
Respond to 3rd party requests
How to do both?