Hibernate version:
Hibernate Tools 3.2.2.GA / Eclipse 3.4
Mapping documents:
Example:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Sep 9, 2008 3:03:57 PM by Hibernate Tools 3.2.2.GA -->
<hibernate-mapping>
<class name="com.mycompany.domain.generated.Action" table="action">
<id name="actionId" type="java.lang.Integer">
<column name="actionID" />
<generator class="identity" />
</id>
<property name="name" type="string">
<column name="name" not-null="true" unique="true" />
</property>
<property name="idType1" type="string">
<column name="idType1" length="50" />
</property>
</class>
</hibernate-mapping>
Table Syntax
CREATE TABLE `action` (
`actionID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL DEFAULT '',
`idType` varchar(50) DEFAULT NULL,
PRIMARY KEY (`actionID`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8
Name and version of the database you are using:
MySQL 5.1.26-rc
I'm using Hibernate Tools in Eclipse to reverse engineer a fairly large existing database. For some reason the
hbm files that are generated only contain the length attribute for columns when the length of the database field is less than 255. I have other tables in which both field are nullable and issue still exists, it seems to be directly related to the length of 255.
Does this ring a bell for anyone? Thanks