[jboss-user] [JBoss Seam] - Problems setting up Seam-managed persistence context

sgollery do-not-reply at jboss.com
Fri Jun 15 13:51:09 EDT 2007


I have a small Seam (1.2.1) application running in Tomcat 5.5.23 and using Hibernate and the Embedded EJB3 container. It works so far when I inject the EntityManager like this:

@PersistenceContext
private EntityManager em;

Now I'm trying to use a Seam-managed persistence context instead. Following instructions at http://docs.jboss.com/seam/1.2.1.GA/reference/en/html/persistence.html and many other places, I added this to context.xml:

<core:managed-persistence-context name="myDatabase" 
                           auto-create="true"
           persistence-unit-jndi-name="java:/EntityManagerFactories/myData"/>

And in persistence.xml, added this to the properties list:

property name="jboss.entity.manager.factory.jndi.name" 
          value="java:/EntityManagerFactories/myData"/>

In one of my session beans, I added:

@In private EntityManager myDatabase;

But as soon as a method in that session bean is executed, I get this exception:

org.jboss.seam.RequiredException: In attribute requires non-null value: myBean.myDatabase

This happens even if I use:

@In(create = true)

I've also tried to use a Seam-managed Hibernate session, but I can't get that to work either.

Apparently I'm missing something. Any idea what it is?

Steve Gollery



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

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



More information about the jboss-user mailing list