-->
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: UserType
PostPosted: Fri Apr 07, 2006 5:40 pm 
Beginner
Beginner

Joined: Tue Feb 14, 2006 12:49 pm
Posts: 21
Location: Washington State
I originally posted this as a question about UserType but discovered that the error appears to be in an EclipsePlugin from MyEclipse. Following the Oreilly book Hibernate: A Developer's Notebook by Elliott I am generating a user type. Let's say for this example I want to persist Color as ColorType. Let's say that the object I'm persisting is Chair and my Chair.hbm.xml file has the following in it:
Code:
    <property name="chairColor" type="doowop.ColorType">
      <meta attribute="field-description">Color of the chair</meta>
      <meta attribute="use-in-tostring">true</meta>
    </property>

My typesafe enumeration class for Color has the following:
Code:
public class Color implements Serializable {
...
    public static final Color RED = new Color("red", "Deep Red");
    public static final Color BLUE = new Color("blue", "Navy Blue");

...
}
GeneratePOJO generates a constructor for Chair with the following signature:
Code:
public Chair (..., ColorType colorType, ...) { ... }

which should be:
Code:
public Chair (..., Color color, ...) { ... }

I want to create an instance of chair so I do something like:
Code:
Chair mychair = new Chair( ..., Color.RED, ...)
which obviously fails because Chair expects a ColorType, not a Color object. I'm leaving this post here for anyone interested in using this extremely useful feature.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 11, 2006 9:51 am 
Newbie

Joined: Mon Apr 10, 2006 10:33 am
Posts: 7
Location: LA
Same EXACT problem I'm having!


Top
 Profile  
 
 Post subject: It's their bug
PostPosted: Tue Apr 11, 2006 10:01 am 
Beginner
Beginner

Joined: Tue Feb 14, 2006 12:49 pm
Posts: 21
Location: Washington State
I got word from the people at MyEclipse. They were able to reproduce the bug and have said that it would be fixed in the next release. You can track this on their forum.


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.