-->
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.  [ 5 posts ] 
Author Message
 Post subject: UserType and hbm2java problem (newbie)
PostPosted: Tue Nov 01, 2005 3:29 pm 
Newbie

Joined: Tue Nov 01, 2005 3:07 pm
Posts: 7
I'm learning Hibernate (using v 3.0.5) and am trying to implement a UserType as an example.

My understanding is that:

1) I first write my custom type "class MyNewClass"
2) I then write a "class MyNewClassType implements UserType"
3) Finally, I map properties using this "wrapper" type, like:
<property name="someField" type="MyNewClassType"/>

I've done this, but after I run hbm2java to generate code from my SomeClass.hbm.xml, the generated class declares "someField" as being of type "MyNewClassType". I was expecting something like:

public class SomeClass {
MyNewClass someField;
//...
}

I'm assuming that I am missing some type of declaration in the mapping file which maps MyNewClassType as a wrapper for MyNewClass?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 01, 2005 3:35 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
<meta attribute="property-type">MyNewClass</meta>

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
 Post subject: aha!
PostPosted: Tue Nov 01, 2005 6:47 pm 
Newbie

Joined: Tue Nov 01, 2005 3:07 pm
Posts: 7
kochcp wrote:
<meta attribute="property-type">MyNewClass</meta>


now I am looking up how I can rate this answer as useful! :-)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 8:53 am 
Newbie

Joined: Wed Oct 26, 2005 7:35 am
Posts: 10
The problem has been solved in CVS, so later you don't need to define a meta attribute anymore


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 11:12 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
for anything to work the usertype must be on the classpath

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.