And how to perform this with CMP ?
Ludovic
--On vendredi 27 juillet 2001 10:27 +0200 Federico Vesco
<[EMAIL PROTECTED]> wrote:
> Hi.
> Maybe someone might be interested to the solution I adopted:
>
> private Integer insertRow (String projectName,int budget,java.sql.Date
> start,java.sql.Date end) throws SQLException {
>
>
>
> String nextStatement="select nextval('project_idproject_seq')";
> String insertStatement =
> "insert into project
> (\"projectName\",\"budget\",\"start\",\"end\") values ( ?
> , ? , ? , ? )";
>
>
> PreparedStatement nextStmt =
> con.prepareStatement(nextStatement);
> PreparedStatement prepStmt =
> con.prepareStatement(insertStatement);
>
> prepStmt.setString(1, projectName);
> prepStmt.setInt(2, budget);
> prepStmt.setDate(3, start);
> prepStmt.setDate(4, end);
>
> ResultSet rsn=nextStmt.executeQuery();
> rsn.next();
> int i=rsn.getInt(1);
> Integer result=new Integer(i);
> nextStmt.close(); // In this way I obtain the value of the
> auto-incrementing PK
>
> prepStmt.executeUpdate();
> prepStmt.close();
>
>
>
> if(result!=null)
> { return result; }
> else { return null;}
>
>
>}
>
>
> Rember that this solution works for PostgreSQL.
>
> Federico
>
> _
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
>
> ___
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
___
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user