-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: QuerySyntaxException: Person is not mapped
PostPosted: Sat Jun 13, 2009 12:53 am 
Newbie

Joined: Sat Jun 13, 2009 12:47 am
Posts: 2
I'm creating a project where I have messages and messages are sent and received by people. My hibernate.cfg.xml is as follows:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    ...
    <mapping resource="com/magusoft/msg/data/Messages.hbm.xml"/>
    <mapping resource="com/magusoft/msg/data/People.hbm.xml"/>
  </session-factory>
</hibernate-configuration>


And the People.hbm.xml file is as follows, located in the com.magusoft.msg.data package:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Jun 12, 2009 11:37:50 PM by Hibernate Tools 3.2.1.GA -->
<hibernate-mapping>
  <class catalog="messages" name="com.magusoft.msg.data.Person" table="people">
    <id name="id" type="java.lang.Integer">
      <column name="id"/>
      <generator class="identity"/>
    </id>
    <property name="name" type="string">
      <column length="50" name="name"/>
    </property>
    <property name="username" type="string">
      <column length="30" name="username" unique="true"/>
    </property>
    <property name="pass" type="string">
      <column length="50" name="pass"/>
    </property>
    <set inverse="true" name="messagesesForToId">
      <key>
        <column name="to_id"/>
      </key>
      <one-to-many class="com.magusoft.msg.data.Messages"/>
    </set>
    <set inverse="true" name="messagesesForFromId">
      <key>
        <column name="from_id"/>
      </key>
      <one-to-many class="com.magusoft.msg.data.Messages"/>
    </set>
  </class>
</hibernate-mapping>


But whenever I input the following query

Code:
from Person


I get the following exception:

Code:
org.hibernate.hql.ast.QuerySyntaxException: Person is not mapped [from Person]


Which is telling me that Person is not mapped, but it is mapped in the hbm file (as far as I can tell) so I'm not sure what I am doing wrong.

Any help is greatly appreciated.

Thanks,
Magus


Top
 Profile  
 
 Post subject: Re: QuerySyntaxException: Person is not mapped
PostPosted: Sat Jun 13, 2009 10:03 am 
Newbie

Joined: Sat Jun 13, 2009 12:47 am
Posts: 2
I came back after the night and it worked. I have absolutely no idea what it was but now it works ok... :S :S

Thanks,
Magus


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.