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: Please Help w/ my model and mappings
PostPosted: Mon Apr 28, 2008 11:19 am 
Newbie

Joined: Thu Jan 10, 2008 11:33 pm
Posts: 8
Hi all,

I'm trying model the following problem so it works in NHibernate; I think there's a problem with my model because I can't figure out how to make it play nice with the ORM. Any help is appreciated...

Background

I'm basically writing a document templating system. Where the document template is configurable using a bunch of input widgets. The widget behaviors and data types are configurable, too. So you can have a document template that has 1...n widgets of different types.

You might have a widget that accepts text input from the end-user and you want to change its Label for a certain document.

On the other side, I have end-users filling out the documents and I need to capture their input. When they open the document, any input they did has to be restored.


Current State

So... I have Types that can be configured. The configurations are stored in a database. At runtime, the Types can have their states changed by the user.

My model has a Configuration class and an Item. A single type can be configured for different contexts. But parts of the type will be changed and stored/restored for individual users. For example...

class ItemA
{
string Label { get; } // persisted in configuration
string Input { get; set; } // persisted by user
}

In one configuration context, Label = "Enter Code"; in another, it might be "First Name".

Requirements

Input must be saved separately because it can be different for multiple users in the same configuration context. And it must be restored from the database once it has been set by a user.

When I save ItemA, I only want to save the value of Input. Conversely, when I load ItemA for a given user, I want to load it with the common Label but with the changed value of Input (if any).

I want to set and save the Label property separately. So far, I've determined that I can use Configuration.Label for that and just map from the Configuration object to the 'real' object, but I'm open to other approaches.



In sum, I'd like some guidance on how to model this so it works in NHibernate and I can take advantage of all its goodness.

Cheers & Thanks!,

Komptaur


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.