0 Replies Latest reply on Oct 7, 2003 6:34 AM by morten Matras

    How can I insert element by index into Entity-reference - co

    morten Matras Newbie

      I don't know whether it is adviseable to implement an "insertElementAt(Object obj , int index)" as the example below:

      The entity Page has a 1-many relation to the Entity Part. I want to insert the new Part newPart into the parts collection on position number "index".

      Collection parts = page.getParts();
      Vector v = new Vector(parts);
      v.insertElementAt(newPart , index);
      page.setParts(v);

      Can I do this without wrapping the collection into a Vector?
      Is it possible at all to thrust the order of a Entity-relationship-collection at all or should I use somekind of indexing instead?