cancel
Showing results for 
Search instead for 
Did you mean: 

Assigning More than One Value for a Model Attribute

partha
Champ in-the-making
Champ in-the-making
Hi,
     I have created my Custom Content Model which has all the basic attributes like Name, Category, Company , Location etc. and i have one attribute called employeeId and it should have more than one value at a time, means user will be allowed to set more than one value at a time for this.
     I want to know how i can achieve this.

     <property name="hrao:employeeId">
        <type>d:text</type>
        <mandatory enforced="true">true</mandatory>
        <multiple>false</multiple>
     </property>

Currently if i set two values one by one by the following way it takes only the last value assigned, not all the values.
         newChildNode.setProperty("sam:employeeId","12341");
         newChildNode.setProperty("sam:employeeId","12340");

If any other way is there to solve this please give me that solutions.
Thanks in Advance.
3 REPLIES 3

acis
Champ in-the-making
Champ in-the-making
Hello Partha,

maybe you should try :

<multiple>true</multiple>

Smiley Happy

partha
Champ in-the-making
Champ in-the-making
Thanks acis. Can you please tell me how these more then one value gets stored in Database. Is it as an String array or seperate entry for each value.
Will it affect performance while doing search if the values are more.

acis
Champ in-the-making
Champ in-the-making
There is no need to know how it is stored in the database. The tables are managed by Alfresco and it's more or less impossible to find something directly in the database. Anyway, if you want to see how it is stored check the tables alf_node and alf_node_properties.

I have no idea if it affects performance or not.