-->
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.  [ 6 posts ] 
Author Message
 Post subject: Accessing meta-tag content from code
PostPosted: Fri Oct 03, 2003 5:28 am 
Newbie

Joined: Wed Sep 03, 2003 8:55 am
Posts: 7
Can the content of [code]meta[/code]-tags defined in mapping documents (used by hbm2java, for example) be accessed from client code or, if not, is this feature going to be implemented in a future version?

.shoka.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 07, 2003 3:25 am 
I reported this need few months ago. I like to add that another need for me would be to access to the length of the string fields. This would allow me to directly restrain user input in forms to the max length in the database with a simple framework. Nothing is more boring than copy the max length from my 50 fields from my hbm files to my forms.

http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-173

Adrien


Top
  
 
 Post subject:
PostPosted: Tue Oct 07, 2003 3:53 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Currently the meta tag information is not available at runtime - but we will consider it's inclusion, if we find a good way to provide it ;)

The length of fields IS accessible via the current metadata in Hibernate2.
You can get them from the Configuration object which has a set of getXXXMapping(s). e.g. cfg.getClassMapping(Foo.class) will return a PersistentClass where you have access to all the length you will ever want ;)

/max

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 07, 2003 12:22 pm 
I don't find any method to access to the length in PersistentClass neither in RootClass.

I post modifications of few classes to allow access to length and metadata (at least for properties) with the ClassMetaData on JIRA.

(Sorry, I have some problem with the diff command to make a patch).

http://opensource.atlassian.com/project ... key=HB-173

Adrien


Top
  
 
 Post subject:
PostPosted: Tue Oct 07, 2003 3:10 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Configuration.getClassMappings() returns a list of PersistentClass,
on this you can do getProperty(propname).getColumnIterator()

And this give you a Column - which got the info.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 08, 2003 3:44 am 
Newbie

Joined: Wed Sep 03, 2003 8:55 am
Posts: 7
I'm not interested on the length and/or types of the properties, but instead trying to find a convenient way of expressing automatic validation instructions for business objects - this is done by a layer directly on top of (and hiding it from the application) persistence engine (Hibernate).

The most convenient way of course is to use Apache's validation framework coupled with definition of validation rules in Hibernate mapping documents and a custom interceptor which triggers validation when necessary. It can of course be implemented by additional validation document, but it would be a real pain to write these..

That's why I need the actual tag content. :)

_________________
.shoka.


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