[jboss-user] [EJB 3.0] - Re: Backing beans

raskri do-not-reply at jboss.com
Sun Mar 11 11:53:06 EDT 2007


OK.... I got the solution after some googling.(FGI)

I tried to create the connection by adding:
private NewSession bean = new NewSessionBean();
->but this didn't "create" or "inject" the EntityManger, so i got another NullPointerException saying that EntityMager was NULL.


In the web.xml web-app tag, NetBeans(IDE)automatically adds:

<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

The 2.4 version does not support annotations.

Therefore the web-app tag has to be changed to:
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

->This makes my backing bean's annotation read, and so the EntityManager is "created", and my "Fugl-EB" is persisted into the DB!!!! 


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4026963#4026963

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4026963



More information about the jboss-user mailing list