Oops,
First algorithm is mass creation then save, second algorithm is node by node.
Sorry for mistake and about the FOR at the end of a comment....Outlook will
kill me...
/////////////////////////////////////////////////////////////////
// FIRST ALGORITHM : Block creation //
////////////////////////////////////////////////////////////////
Node contractors = (Node) session.getItem("/lgw:root/lgw:contractors");
int count = number_of_nodes; // whatever, put the number of nodes to create
for (int i = 0; i < count; i++) {
Node contractor = contractors.addNode("lgw:contractor");
initializeContractor(session, contractor);
created++;
}
session.save();
////////////////////////////////////////////////
// END FIRST ALGORITHM //
////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
// SECOND ALGORITHM : Node by Node//
/////////////////////////////////////////////////////////////////////
Node contractors = (Node) session.getItem("/lgw:root/lgw:contractors");
int count = number_of_nodes; // whatever, put the number of nodes to create
for (int i = 0; i < count; i++) {
Node contractor = contractors.addNode("lgw:contractor");
initializeContractor(session, contractor);
created++;
session.save();
}
/////////////////////////////////////////////////////
// END SECOND ALGORITHM //
////////////////////////////////////////////////////
Frédéric Esnault - Ingénieur R&D