-->
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: Column width for Component properties ?
PostPosted: Mon Oct 17, 2005 6:04 am 
Newbie

Joined: Thu Sep 30, 2004 4:36 am
Posts: 4
Location: Gent
Hi,

In our application we frequently need to read the column width of a string property (typically for validation and for measuring the width of an editable field in a GUI).
I already discovered that this information is available by navigation from the Configuration class, e.g. for a class 'Company' and property 'name'

[quote]
<property
column="COMPANYNAME"
length="64"
name="name"
type="string"
/>
[/quote]

we can find the value "64" using

[code]
Configuration
.getClassMapping("Company")
.getProperty("name")
.getColumnIterator()
.next()
.getLength()
[/code]

For properties of a Component instead of a PersistentClass, things seem
a bit different : if a property is a Component

prop.getType().isComponentType() == true

then I can access Component property names by casting the type

((AbstractComponentType)prop.getType()).getPropertyNames()

But that's as far as I got, from this point on I couldn't find any method
to obtain a Property and its columns.

Could anyone give me a hint here ?

Thanks a lot !

Daan Van Heghe


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 17, 2005 7:50 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Component c = (Component)property.getValue();

c.getPropertyIterator();
c.getProperty(name);
...

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 17, 2005 9:46 am 
Newbie

Joined: Thu Sep 30, 2004 4:36 am
Posts: 4
Location: Gent
That worked ! Thanks a lot !


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.