gavin wrote:
Max is mistaken. MySQL supports identity/native ids. More likely your properties file is not being found.
my mapping file looks like this:
--------------------------------------------------------------------------------
Code:
<hibernate-mapping>
<class name="Cat" table="CAT">
<id name="id" type="long" column="CAT_ID" unsaved-value="0">
<generator class="identity"/>
</id>
<!-- A cat has to have a name, but it shouldn' be too long. -->
<property name="name">
<column name="NAME" sql-type="varchar(16)" not-null="true"/>
</property>
<property name="sex"/>
<property name="weight"/>
</class>
</hibernate-mapping>
my properties file looks like this
-------------------------------------
Code:
<hibernate-configuration>
<session-factory>
<property name="connection.datasource">java:/MySqlDS</property>
<property name="show_sql">false</property>
<property name="dialect">hibernate.dialect net.sf.hibernate.dialect.MySQLDialect</property>
<!-- Mapping files -->
<mapping resource="Cat.hbm.xml"/>
</session-factory>
</hibernate-configuration>
You suggested that the properties file (in my case hibernate.cfg.xml) could not be found. However, when I rename or remove the config file I get
HTTP ERROR: 500 /hibernate.cfg.xml not found
So, finding the config file was not the problem. I am really struggling with this. It feels like this should be a fairly common problem since I am not doing anything complicated.
By the way, I got it working with
generator class="uuid.hex" ... the problem is that I have already started with auto_incremented ids in my tables so I really would like to continue on that path, which I should be able to with generator="identity".
Best regards
Lasse
[/code]