-->
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: one class but several mappers
PostPosted: Mon Apr 03, 2006 3:22 am 
Beginner
Beginner

Joined: Mon Apr 03, 2006 2:41 am
Posts: 25
Location: Mauritius
Hi all,

i have the following class :

Code:
public class KeyValue {
        public string key;       
        public string value;
    }


I have a webservice whith several methods which returns an array of KeyValue object.

For each of this method, the meaning is different. For example, a method returns postal code/city code as key/value, another date/public holiday, etc...

So in my code I always get KeyValue object but I need to store them in different table according to the method which is called.

Is there a way to define several mapping for a same class ?
if yes how to define this in the mapping file and use it in the code please ?

Thanks in advance for your feedback

Regards,
Christophe


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 03, 2006 9:58 am 
Newbie

Joined: Fri Mar 31, 2006 11:18 am
Posts: 5
Hi Christophe,

Would it be possible/practical for you to inherit a class from KeyValue for each table, and then map each inherited class to the associated table?

Regards,
Daniel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 04, 2006 5:20 am 
Beginner
Beginner

Joined: Mon Apr 03, 2006 2:41 am
Posts: 25
Location: Mauritius
Hi Dianel.

I can't change the webservice so I can't do it on the webservice side.

If I do this on the webservice client side, I will have to recreate one object for each instance of KeyValue I got, what I want not to do.
( Do you see another way to use those subclasses ?)

My aim is to use the generated classes as they are, and I have hoped to handle this issue at the Mapper level.

If you have any suggestion, you're welcome.
The requirements of what I want to do are :
use the webservice generated classes without changes
avoid to create one new object per instance of KeyValue I got

Thanks for your feedback

Christophe


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.