-->
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: attribute in the hbm file
PostPosted: Thu Jun 15, 2006 12:38 pm 
Regular
Regular

Joined: Mon Jun 13, 2005 12:38 pm
Posts: 56
Location: Austin, TX
I was wondering what advantage there is for placing attributes like 'length="1"' in the hbm.xml files. This is an attribute for the property tag. From what I can tell, it's not needed. I haven't used them on previous projects, but they are being used on the current one, hence it has given rise to a curiousity.

thanks,
Mike


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 15, 2006 3:29 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
you can export your db schema from the hbm xml files

_________________
Chris

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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 15, 2006 3:47 pm 
Regular
Regular

Joined: Mon Jun 13, 2005 12:38 pm
Posts: 56
Location: Austin, TX
I just found that's where you would use those kinds of attributes. So would you use those attributes for situations where you are not creating the database from the hbm files? I would assume not, but I'd like to get other peoples opinions.


thanks,
Mike


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 15, 2006 4:05 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
It isn't needed. Hibernate does not use the length attribute to perform any validation on the data. It seems to me to be extraneous, but middlegen puts it there so I don't delete it :) You can get the meta data out of the Configuration class if you want to use the length information in your code to do whatever.

I do use it in a haxxored up version of hibernate tools however to help me add some code to my Pojos when I use the hbm2java tasks to make my Pojos from the hbm files.

Other property attributes are used however. for example, not-null="true" attribute does perform validation and hibernate throws an error if you violate it.

_________________
Chris

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


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.