-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Annotations + EnumUserType + global typedef
PostPosted: Fri Mar 11, 2005 7:04 am 
Regular
Regular

Joined: Tue Oct 07, 2003 1:13 pm
Posts: 70
Location: Paris, France
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 ?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 11, 2005 12:09 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
could you please wrap it into a runnable testcase and post it to JIRA, I'll have a look

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 12, 2005 8:24 pm 
Regular
Regular

Joined: Tue Oct 07, 2003 1:13 pm
Posts: 70
Location: Paris, France
Done! JIRA HBX-138


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.