[jboss-user] [EJB 3.0] - entity bean name in ejb3 RC7

michalzel do-not-reply at jboss.com
Sat Aug 5 07:35:51 EDT 2006


Hello!

I have just migrated from JBoss4.0.3, EJB3 RC3 to JBoss 4.0.4, EJB3 RC7. My EAR project consists of two packages: logic.jar (previously .ejb3) with SLSB & SFSB, and data.jar (previously .par) with entity beans. After consulting wiki EJB migration guide, I deployed application to new server. When I try to execute following query:

SELECT u FROM User AS u WHERE u.login= :login
I got the following exception:

  |  javax.persistence.PersistenceException: org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [SELECT u FROM User AS u where u.login = :login]
  | 
Which is strange, as User should be the enity bean name by the specification.
When I put fully qualified name of the entity:
SELECT u FROM myPackage.User AS u WHERE u.login= :login
I got 

  |  javax.persistence.PersistenceException: org.hibernate.HibernateException: could not locate named parameter [login]
  | 
User entity is defined as:

  | package myPackage;
  | @Entity
  | @Table(name = "APPLICATION_USERS")
  | public class User implements Serializable
  | {
  | ...
  | private String login;
  | @Column(name = "USERNAME", nullable = false, unique = true)
  | 	public String getLogin()
  | 	{
  | 		return this.login;
  | 	}
  | 
  | public void setLogin(String login)
  | 	{
  | 		this.login = login;
  | 	}
  | }
  | 
persistence.xml is defined as:

  | <?xml version="1.0" encoding="UTF-8"?>
  | <persistence xmlns="http://java.sun.com/xml/ns/persistence"
  | 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  | 	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
  | 	version="1.0">
  | 	<persistence-unit name="MyEntityManager" transaction-type="JTA">
  | 		<jta-data-source>java:/MyDS</jta-data-source>
  | 		<properties>
  | 			<property name="hibernate.hbm2ddl.auto" value="none" />
  | 			<property name="hibernate.dialect"
  | 				value="org.hibernate.dialect.Oracle9Dialect" />		        </properties>
  | 	</persistence-unit>
  | 	
  | </persistence>
  | 
I have put it into logic and data jars. Am I missing something?

regards

Micha?

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

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



More information about the jboss-user mailing list