  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | JSP - A mailing list about Java Server Pages specification and reference | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | - PersistenceContext injection in Seam 2.0beta1 | - PersistenceContext injection in Seam 2.0beta1 2007-08-11 - By alexg79
Back Trying to inject a Hibernate Session with @(protected) fails: anonymous wrote : | java.lang.ClassCastException: $Proxy1497 cannot be cast to javax .persistence.EntityManager The reason for this was pretty obvious once I took a look at the code of org .jboss.seam.intercept.SessionBeanInterceptor:
| ... | //wrap any @(protected) attributes in our proxy | for ( BijectedAttribute ba: getComponent() .getPersistenceContextAttributes() ) | { | EntityManager entityManager = (EntityManager) ba.get(bean); | if ( ! (entityManager instanceof EntityManagerProxy ) ) | { | ba.set( bean, new EntityManagerProxy(entityManager) ); | } | } | ... | Apparently it doesn't even look at the field type, and always assumes that I want to inject an EntityManager. Even if I do inject an EntityManager, then #getDelegate() won't give me a Session, as it would without Seam. How the heck do I directly inject a Hibernate Session??
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic &p=4073292#4073292
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode =reply&p=4073292 __ ____ ____ ____ ____ ____ ____ ____ ____ ____ jboss-user mailing list jboss-user@(protected) https://lists.jboss.org/mailman/listinfo/jboss-user
|
|
 |