Hibernate version: 3.0rc1
Annotations version alpha3
Hi,
I'd like to submit the following case:
- Enum Gender
- EnumUserType as defined in
http://www.hibernate.org/272.html
- Annotated DependentObject class :
Code:
@DependentObject
public class Name
{
private Gender gender;
private String firstName;
private String lastName;
/**
*
*/
public Name()
{
}
...
/**
* @return Returns the gender.
*/
@Type(type="gender")
public Gender getGender()
{
return gender;
}
...
- Annotated Entity class :
Code:
@Entity
public class Person
{
private Name name;
...
/**
* @return Returns the Name.
*/
public Name getName()
{
return name;
}
...
I want to externalize the type definition "Gender" in a ressource file called global.hbm.xml :
Code:
<hibernate-mapping package="com.persistence">
<typedef name="gender" class='EnumUserType'>
<param name="enumClassName">com.model.Gender</param>
</typedef>
</hibernate-mapping>
Ok, now I have to merge everything in my hibernate.cfg.xml :
Code:
<hibernate-configuration>
<session-factory>
<property name="connection.datasource">java:/comp/env/jdbc/annuaire</property>
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="show_sql">false</property>
<mapping resource="com/persistence/global.hbm.xml"/>
<mapping package="com.model"/>
<mapping class="com.model.Person"/>
</session-factory>
</hibernate-configuration>
The problem is that Hibernate returns :
Quote:
Could not determine type for : gender, for columns : [org.hibernate.mapping.Column(gender)]
What i'm doing wrong ?