I've been over this a hundred times in at least 20 different approaches. I don't know what happened, but my EJB3 entities stopped working. I now get org.hibernate.MappingException: Unknown entity all the time. If I reconfigure things I get other errors, but it never works.
I have a .par file that has my User class. It is annotated properly and the persistence.xml file looks like:
<entity-manager> <name>myManager</name> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:com.me.dsn.myDsn</jta-data-source> <class>com.me.entities.User</class> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect" /> <property name="hibernate.hbm2ddl.auto" value="none"/> </properties> </entity-manager>
Query q = em.createNamedQuery("UserSelect"); q.setParameter("userId", Integer.valueOf(userId)); User user = (User) q.getSingleResult();
15:48:23,625 INFO [STDOUT] javax.ejb.EJBException: null; CausedByException is: Named query not known: UserSelect
Query q = em.createNativeQuery("{call svc_user_select(:userId)}",User.class); q.setParameter("userId", Integer.valueOf(userId)); User user = (User) q.getSingleResult();
15:50:17,794 INFO [STDOUT] javax.ejb.EJBException: null; CausedByException is: Unknown entity: com.me.entities.User
Wrong forum. My Bad.