I'm trying to get Hibern8IDE to work, but it fails. I only have a hibernate.cfg.xml file, not a properties file.
In the tree on the left, I see the classes I have mapped, so my mapping files are located.
When I try to execute a query, I get an SQLException stating the table I'm using doesn't exist (I'm using the jtds driver with MS SQL server 2000). When I execute the same query from my program, everything works, so there is no problem with my mapping file and my config file (I think).
config file:
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<!-- a SessionFactory instance listed as /jndi/name -->
<session-factory>
<!-- properties -->
<property name="connection.username">swp</property>
<property name="connection.password">swp</property>
<property name="connection.url">jdbc:jtds:sqlserver://swp_ds001:1433/persistencetest</property>
<property name="connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
<property name="dialect">net.sf.hibernate.dialect.SQLServerDialect</property>
<property name="show_sql">true</property>
<property name="use_outer_join">true</property>
<!-- mapping files -->
<mapping resource="hibernate/model/UserGroup.hbm.xml"/>
<mapping resource="hibernate/model/User.hbm.xml"/>
<mapping resource="hibernate/model/AccessLevel.hbm.xml"/>
<mapping resource="hibernate/model/order/Order.hbm.xml"/>
<mapping resource="hibernate/model/order/OrderLine.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Mapping files:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class
name="model.User"
table="Users"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="id"
column="id"
type="java.lang.Integer"
>
<generator class="increment">
</generator>
</id>
<property
name="code"
type="java.lang.String"
update="true"
insert="true"
column="code"
/>
<component
name="name"
class="model.Name"
>
</component>
<many-to-one
name="userGroup"
class="model.UserGroup"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="userGroupID"
/>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-User.xml
containing the additional properties and place it in your merge dir.
-->
</class>
</hibernate-mapping>
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class
name="model.UserGroup"
table="UserGroup"
dynamic-update="false"
dynamic-insert="false"
lazy="true"
>
<id
name="id"
column="id"
type="java.lang.String"
>
<generator class="increment">
</generator>
</id>
<property
name="description"
type="java.lang.String"
update="true"
insert="true"
column="description"
/>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-UserGroup.xml
containing the additional properties and place it in your merge dir.
-->
</class>
</hibernate-mapping>
The tables Users and UserGroup are present in my database.
Any ideas?