I am inserting something into a database table which works fine:
Code: Select all
stmt = con.prepareStatement("INSERT INTO `planet` (`user_id`, `main`, `size`, `type`, `seed`) VALUES (?, ?, ?, ?, ?);");
stmt.setInt(1, dbId);
stmt.setInt(2, 1);
stmt.setInt(3, pl.size);
stmt.setInt(4, pl.type);
stmt.setFloat(5, pl.seed);
stmt.execute();
now my question is how I would get the Id (primary key) of the inserted field without querying it again directly? Is that possible?
Thanks
Seb