-->
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.  [ 4 posts ] 
Author Message
 Post subject: xdoclet annotated pojo => hbm => ddl (component &
PostPosted: Mon Jun 07, 2004 11:35 am 
Newbie

Joined: Thu Apr 29, 2004 11:40 am
Posts: 7
Hi all,

I am having a problem with complex types.

The setup is simple:
we have a class that represents a varchar (with length checking in it)
like construct. It has 1 read/write property (getString, setString), and
a readOnly property (maxLength).

We would now want to make our pojo's using this class for all the
varchar fields (db validation is too late!).

For instance, we have a class with Experts. It has a simple
Long as Id and a few ConstrainedStrings as properties.
(For instance a firstName and lastName property)

What I want to know and do is the following:
with the path: xdoclet/pojo=>hbm=>ddl

How would I annotate the firstName and lastName properties,
and make clear to xdoclet that for the generation of the hbm
file I need something like:

map getFirstName().getString() to a java.lang.String into a
column named firstName (of type varchar(100)) on the db

and getLastName().getString() to a java.lang.String into a column
named lastName (of type varchar(150)) on the db

What would I need to put on the 'string' property of ConstrainedString
(xdoclet tags) as well as what to do for the firstname and lastname
properties in the Expert table.

Or can this not be done? (I have looked a few hours now, both on these
forums as with google, and found nothing).

tnx in advance,
Dimitri Smits
aka gongo


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 07, 2004 11:58 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Use a custom UserType or a new PropertyAccessor. UserType sounds nicer to me.


Top
 Profile  
 
 Post subject: usertype and/or property accessor
PostPosted: Tue Jun 08, 2004 4:10 am 
Newbie

Joined: Thu Apr 29, 2004 11:40 am
Posts: 7
michael wrote:
Use a custom UserType or a new PropertyAccessor. UserType sounds nicer to me.


could you elaborate a bit on these topics or send me in a direction to where I can find more info?

I'm still a noob with regard to hibernate and I am not sure what you mean.

ConstrainedString is a new type. (mutable, with property string)
I only have a getter for firstName on my Expert table.

thnx,
Dimitri Smits
aka gongo


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 08, 2004 6:21 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Check the wiki section, there are quite some examples on custom userTypes.


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