cancel
Showing results for 
Search instead for 
Did you mean: 

association child multiplicity has been violated

pmarreddy
Champ in-the-making
Champ in-the-making
hi,

i have defined my xml
<child-association name="cube:contains1">
               <source>
                  <mandatory>true</mandatory>
                  <many>false</many>
               </source>
           
               <target>
                  <class>cube:exam</class>
                  <mandatory>true</mandatory>
                  <many>false</many>
               </target>
</child-association>


i have a child for both source and target still i get this warning. any one has nay idea.



The association child multiplicity has been violated:
   Association: Association[ class=ClassDef [ name={cube.com}exam], name={cube.com}contains1, target class={cube.com}exam, source role=null, target role=null]
   Required child Multiplicity: 1..1
   Actual child Multiplicity: 0

i have one more question,

what is source target relationship and when we say target mandatory what does it mean.
<target>
        <class>cube:exam</class>
         <mandatory>true</mandatory>
          <many>false</many>
</target>


prasanth
3 REPLIES 3

derek
Star Contributor
Star Contributor
Hi,

The target of your association is a cube:exam, but I can't see the definition for it.  Is the cube:contains1 assocation defined in cube:exam?  If that were the case, then whenever you added a child cube:exam, you would have to add a child for that and a child for that and so on.

You have specified that all cube:exam instances must have exactly two cube:contains associations joined to it.  One coming from a parent and another going to a child.  The mandatory element indicates whether the association is required to exist or not.

If you could put all the elements of the model up, then we could say for sure what is causing the problem.

Regards

davidc
Star Contributor
Star Contributor
One possibility could be to do with the fact that integrity checks are performed at the end of a transaction (i.e. pre-commit).  If you create your parent and child nodes in seperate transactions (which will be the default, if you don't explicitly start a user transaction) then an integrity exception will occur.  This is because the parent will have been created in the first transaction without a child - and your association definition is 1..1.

pmarreddy
Champ in-the-making
Champ in-the-making
thank u for ur reply's, i will chek it out.