I am new to Hibernate and I am having a problem with the generator tools.
Here is my hibernate.cfg.xml:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory >
<!-- local connection properties -->
<property name="hibernate.connection.url">jdbc:mysql://192.168.1.1/PulseCRM</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.username">admin</property>
<property name="hibernate.connection.password">******</property>
<!-- property name="hibernate.connection.pool_size"></property -->
<!-- dialect for MySQL -->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<mapping resource="com/johnjake/pulseCRM/controler/da/User.hbm.xml" />
<mapping resource="com/johnjake/pulseCRM/controler/da/Note.hbm.xml" />
</session-factory>
</hibernate-configuration>
and I have two mapping files:
com/johnjake/pulseCRM/controler/da/User.hbm.xml
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping package="com.johnjake.pulseCRM.controler.da">
<class
name="User"
table="users"
>
<meta attribute="sync-DAO">false</meta>
<id
name="Id"
type="integer"
column="id"
>
<generator class="native"/>
</id>
<property
name="Name"
column="name"
type="string"
not-null="true"
length="255"
unique="true"
/>
<property
name="Password"
column="password"
type="string"
not-null="true"
length="255"
/>
<property
name="Level"
column="level"
type="integer"
not-null="true"
length="10"
/>
</class>
</hibernate-mapping>
and com/johnjake/pulseCRM/controler/da/Note.hbm.xml
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping package="com.johnjake.pulseCRM.controler.da" auto-import="true" >
<class
name="Note"
table="notes"
>
<meta attribute="sync-DAO">false</meta>
<id
name="Id"
type="integer"
column="id"
>
<generator class="native"/>
</id>
<property
name="Note"
column="note"
type="string"
not-null="true"
/>
<property
name="CreateDate"
column="create_date"
type="timestamp"
not-null="true"
/>
<many-to-one
name="CreateUserId"
column="create_user_id"
class="User"
cascade="none"
/>
<property
name="UpdateDate"
column="update_date"
type="timestamp"
not-null="false"
/>
</class>
</hibernate-mapping>
When I run any of the commands (hbm2java, schemaexport) I get the following error: resource: com/johnjake/pulseCRM/controler/da/User.hbm.xml not found
I even tried the third party tool hibernate synchronizer and it worked fine for User, but when I ran it against Note, I got the error: an association from the table notes refers to an unmapped class User, but if I paste the <class> section from user into note, hibernate synchronizer handles it fine.
Am i not defining something correct in my hibernatecfg.xml?
Any help would be most appreciated!
Thanks,
Jake
Hibernate version: 3.2