jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frédéric Esnault <f...@legisway.com>
Subject RE: atomic vs group node creation/storage
Date Wed, 20 Jun 2007 08:37:43 GMT
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

Mime
View raw message