我有以下代码使用java将数据输入数据库。但是,第一列实际上是由 postgresql 数据库自动生成的。现在,我将如何更改代码使其不触及第一列?
String sql = "insert into members values (?,?,?,?)";
PreparedStatement pst = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); // I used RETURN_GENERATED_KEYS, but I don't know how to utilize it.
pst.setInt(1, memid); // I want this line to be skipped
pst.setInt(2, birthyear);
pst.setString(3, familyname);
pst.setString(4, givenname);
// Executing the insert
pst.executeUpdate();