Looks like I'm not the only one ...
It also looks like this problem isn't 100% solved yet.
Perhaps someone can offer a bypass, then.
I want my Action classes to be able to use Entities (Entity beans). Is there a way to get this functionality without using Session Beans ? (right now I'm getting an Exception if I'm trying to use
@PersistenceContextin a Action that is not a SB).
If I can do that, I could use simple POJO's instead of SLSB.
You can use SMPC (Seam Managed Persistence Context if I'm right) using the @In and the correct field name. Example:
@In EntityManager entityManager;
I must be missing something ...
If I try what you suggest, then the EntityManager would still be : javax.persistence.EntityManager, and at runtime, it fails with :
org.jboss.seam.RequiredException: In attribute requires non-null value: register.em
What am I doing wrong ?
Name the field in the "register" component entityManager not em.
I've had some configuration issues when porting my application from Seam 1.2.1.GA, where I had an entity manager named "em", to Seam 2.0.0.BETA1. I decided to simply name the fields entityManager. This way no additional configuration is needed to have it bijected everywhere in the framework and you application.
That worked !!
Thanks a lot.
So now that I can have entity access in my POJO actions, is there any point in insisting to use SLSB (once the Studio\Seam\AS bug is fixed) ?
One more question (I guess I'll have more, as I find more and more things that need be adjusted as a result of this change) :
Previously, the container was responsible for generating the DDL and keeping the DB schema with my entity classes.
Now that I've switched to using just Hibernate, how do I tell it to do the same thing ?
I guess that's not the problem ...
The schema does get updated by Hibernate, but still I'm getting the following exception :
javax.faces.el.EvaluationException: java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [select u from User u where u.name=:el1 and u.active = true]
Here is a thread from today on session beans and seam components:
About switching to just Hibernate I'm not OK with that. What have you changed in you configuration? You should stick to JPA with Hibernate as the persistence provider