5
I have a project in Spring MVC, I’m using the getJdbcTemplate
to make Insert’s.
Only I do not insert the key Primary in Oracle from a sequence and need that value to re-enter another table where this value is foreign key.
For example:
insert into tableS(SEQ, dateX, ab, flag) values(SEQ_table.nextval, ?, ?, 'N')
And I’m wearing the getJdbcTemplate
to insert from Spring, only I need the java-side SEQ value to insert into the following table with the foreign key value.
getJdbcTemplate().batchUpdate(INSERT_TABLE, new BatchPreparedStatementSetter() {
public void setValues(PreparedStatement ps, int i) throws SQLException {
String valor= info.getvalues().get(i);
ps.setString(1, valor.geta());
ps.setLong(2, valor.getb());
}
public int getBatchSize() {
return info.getvalues().size();
}
});
Any idea how to solve this problem?
Any restriction on the use of JPA?
– Weslley Tavares
I wish I didn’t have to change the project structure because of the time, but with JPA I can get the entered value ?
– user2989745