8 Replies Latest reply on Jan 26, 2007 10:26 AM by Meinert Schwartau

    Error after executing HQL-Statement: Entity is not mapped

    Meinert Schwartau Newbie


      If I execute a hql query, I get always the following exception:
      org.hibernate.hql.ast.QuerySyntaxException: MyEntity is not mapped [select e.myAttribute from MyEntity e]

      I don't have any idea, what I'm doing wrong :-(.

      I did the follwing things:
      1) Set up an empty projekt
      2) Create a new hibernate configuration file with the wizard
      2.1) I set the database dialect to "Oracle"
      2.2) I set the username, password and connection url with the correct values. I set Driver Class to "oracle.jdbc.driver.OracleDriver". I let all other fields empty.
      3) Create a console configuration
      3.1) Add the oracle driver jar to the classpath
      3.2) Add the folder, which contains the entity class files, to the classpath.

      After that, I can do the following things:
      1.) Open the hibernate configuration view
      1.1) I see an entry for my projekt. If I click that entry, the node is unfolded an I see all the schema's of my database. If I click on "my" schema, I see all tables. If I click on a table, mostly nothing happens. Sometimes I can see the attributes of a table, but mostly not.
      2) Open the HQL Editor and the Hibernate Query Result view.
      2.1) Select my Projekt
      2.2) Enter the query select e.myAttribute from MyEntity e
      2.3) I see the error message which is printed above in the result view.
      2.4) Enter the query select e.myAttribute from MySchema.MyEntity e
      2.5) I see the error message which is printed above in the Result view (only the query is different in the error message)

      Why doesn't the stuff work?

      I use Oracle 10g, the JBossIDE for Eclipse (Build 2.0.0.Beta2), JBOSS 4.0.5GA and EJB 3.

      Best regards