Hi Eswar,

you could use a loop to insert multiple records. Here's my code:

BufferedReader reader = new BufferedReader(new 
InputStreamReader(System.in));
System.out.println("Insert the number of record to create: ");
String input = null;
input = reader.readLine();
int num = Integer.parseInt(input);
int tot = 0;
for (int i = 1; i <= num; i++) {

System.out.println("Enter your student ID: ");
Scanner scannerID = new Scanner(System.in);
int studentID = scannerID.nextInt();

System.out.println("Enter your student NAME: ");
Scanner scannerNAME = new Scanner(System.in);
String studentNAME = scannerNAME.nextLine();

System.out.println("Enter your student ADDRESS: ");
Scanner scannerADDRESS = new Scanner(System.in);
String studentADDRESS = scannerADDRESS.nextLine();

OrientVertex v = g.addVertex("class:Student");
v.setProperties("ID", studentID);
v.setProperties("NAME", studentNAME);
v.setProperties("ADDRESS", studentADDRESS);
System.out.println();
System.out.println("Inserted data: ");
System.out.println("ID: " + studentID + " --- NAME: " + studentNAME + " --- 
ADDRESS: " + studentADDRESS);
tot = i;
g.commit();

}

System.out.println();
System.out.println("Total inserted records: "+tot);

Hope it helps

Luca

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to