Hi!

Well, I've found other solution: to assign null value to fields that I don't
want to map. Changing the mapping files is more efficient solution, isn't
it?

Regards



sweex wrote:
> 
> Thanks Ralf! This is what I'm going to do. 
> 
> Regards
> 
> 
> Ralf Joachim wrote:
>> 
>> Hi sweex,
>> 
>> it isn't possible to specify to mappings for one class in one mapping 
>> file. But why don't you use 2 different mapping files, one which maps 
>> all 3 fields of the class and the other that maps one the name. 
>> dependend on what you like to marshal/unmarshal you can use one or the 
>> other mapping file.
>> 
>> Regards
>> Ralf
>> 
>> 
>> sweex schrieb:
>>> Hi Werner,
>>> 
>>> I'm sorry. I don't speak english very well and probably I haven't
>>> explained
>>> it right.
>>> 
>>> I have a class Person.java. It has, for example, 3 attributes/fields. 
>>> 
>>> public class Person {
>>>    private String name;
>>>    private int age;
>>>    private String country;
>>> ...
>>>   // get/set methods
>>> ...
>>> }
>>> 
>>> 
>>> I want to define two different mappings of this class, because sometimes
>>> I
>>> will need to map a person with its 3 fields, but other times I only will
>>> need its "name" field. As I've read at Castor's documentation:
>>> 
>>> 
>>> "
>>> Nested class mapping
>>> 
>>> Since 0.9.5.3, the bind-xml element supports a nested class mapping,
>>> which
>>> is often useful when needing to specify more than one mapping for a
>>> particular class. A good example of this is when mapping
>>> Hashtable/HashMap/Map."
>>> 
>>> I understand the example, but there is no multiple mapping for a unique
>>> class. I don't know how can I do it!
>>> 
>>> That's it.
>>> 
>>> Thanks!!
>>> 
>>> 
>>> 
>>> Werner Guttmann wrote:
>>> 
>>>>Hi,
>>>>
>>>>Not sure what you are trying to achieve, to be honest. Can you please
>>>>elaborate your thoughts ?
>>>>
>>>>Thanks
>>>>Werner
>>>>
>>>>sweex wrote:
>>>>
>>>>>hello!!!
>>>>>
>>>>>
>>>>>My question is very simple: 
>>>>>
>>>>>How can I define more than one mapping for a particular class using
>>>>>nested
>>>>>class mapping? 
>>>>>
>>>>>Thanks!!
>>>>>
>>>>>
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe from this list please visit:
>>>>
>>>>    http://xircles.codehaus.org/manage_email
>>>>
>>>>
>>>>
>>> 
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe from this list please visit:
>> 
>>     http://xircles.codehaus.org/manage_email
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Nested-class-mapping-tf3946270.html#a11208619
Sent from the Castor - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to