On Thu, 6 Aug 2009 20:55:52 +0200, "Alessandro" <nemo@nobody.it>
wrote, quoted or indirectly quoted someone who said :
Thinking about making dynalic a JDBC update according to number of fields to
be updated. In my case we have an update to be executed cyclically and at
every cycle I receive values to be updated from another source and they can
be different each time.
This is the classical base for update:
PreparedStatement ps = conn.prepareStatement("UPDATE Messages SET
description = ?, author = ? WHERE id = ? AND seq_num = ?");
ps.setString(1,description);
ps.setString(2,author);
ps.setInt(3,id);
ps.setInt(4,seqNum);
Any idea ? Hibernate simplifies a lot but it needs - look at precedent
post - a preliminary select for each update.Thanks and best
regards,Alessandro
You could have an array of PreparedStatements and select the
appropriate one.
This seems a bit odd. I think of SQL records having a fixed field
structure. Perhaps you could feed SQL an array field (a common
extension), or a blob of some sort to deal the variable portion.
imply that an update has to update a fixed number of fields.