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