-->
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.  [ 2 posts ] 
Author Message
 Post subject: Custom attributes at runtime
PostPosted: Tue Feb 14, 2006 6:05 pm 
Newbie

Joined: Tue Feb 14, 2006 5:17 pm
Posts: 1
Location: Silicon Valley, California
I want to allow the user to add custom attributes to various entities at runtime. For example, they can add a new field "Birthday" to an "Employee" entity. I want to map these custom attributes (which will likely be stored as name/value pairs) to some separate tables that will store custom attributes. Is there any way to allow mapping of such custom attributes to tables that store custom properties? When I load Employee I want to load both the columns from the Employee table and the rows/columns for the custom attributes from the other table.

Is there any other way to easily achieve implementation of custom attributes at run time?

Thanks,

Sunondo


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 14, 2006 6:44 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
Use a collection (map, set, list, whatever), and have the attrbiute table have the employee id, attribute name and attribute value columns. I'd recommend the map element, with key = emplyoee id, map-key = attribute name, element = attribute value.

If you want to restrict the custom attribute names without using a custom attrbiute name table (for referential integrity), you can make use of dynamic components. See section 8.5 of the ref docs.


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