-->
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.  [ 1 post ] 
Author Message
 Post subject: Dynamic components specified at runtime programatically?
PostPosted: Wed Nov 26, 2014 7:17 am 
Newbie

Joined: Tue Nov 25, 2014 1:03 pm
Posts: 1
Hi, we have a situation where we allow users to specify custom additional fields for some of our objects. These need to be persisted in the database, but we can't simply put a serialized map in a blob column, as we also want to index the fields. I see from the documentation that we could use the dynamic-component tag in our hbm.xml, but that has two problems:

1. We would really rather use annotations in our models, rather than specifying the mappings in xml

2. Persisting deployment-specific modifications to the list of custom fields would mean modifying the xml file, which can cause problems if some of our models ever change and we need to merge the two when deploying a new version.

Ideally what I would like to do is create a Configuration object, add our annotated classes, modify the mapping for our customisable objects to specify the columns of the dynamic component, and ask Hibernate to update the database schema via alter table commands if needed. It would also be nice to allow for adding and dropping columns while an active session is open, but we can work around that by tearing down the entire session and recreating it with the new configuration - this is expected to be a rare operation.

What would be the best way to do this?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.