Sorry, I stand corrected the rowid will not be updated automatically.

----- Original Message -----
From: "K.V. Vinay Menon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 06, 2001 6:56 PM
Subject: Re: [JBoss-dev] Fast Updates Based on Row ID


> Ok,
>     I've changed the JDBCCreateEntityCommand as
>
>    public JDBCCreateEntityCommand(JDBCCommandFactory factory)
>    {
>       super(factory, "Create");
>
>       beanExistsCommand = factory.createBeanExistsCommand();
>
>       // Insert SQL
>
>       String sql = "INSERT INTO " + jawsEntity.getTableName();
>       String fieldSql = "";
>       String valueSql = "";
>
>       Iterator it = jawsEntity.getCMPFields();
>       boolean first = true;
>
>       //Added by Vinay - Start
>       String rowIDColumn = jawsEntity.getRowIDColumnName();
>       if(rowIDColumn==null) rowIDColumn = "";
>
>
>       while (it.hasNext())
>       {
>          CMPFieldMetaData cmpField = (CMPFieldMetaData)it.next();
>
>          if(!cmpField.getColumnName().equalsIgnoreCase(rowIDColumn))
>          {
>              fieldSql += (first ? "" : ",") +
>                          cmpField.getColumnName();
>              valueSql += first ? "?" : ",?";
>              first = false;
>          }
>       }
>
>       sql += " ("+fieldSql+") VALUES ("+valueSql+")";
>
>       setSQL(sql);
>    }
>
>
> and
>
>    protected void setParameters(PreparedStatement stmt, Object argOrArgs)
>       throws Exception
>    {
>       EntityEnterpriseContext ctx = (EntityEnterpriseContext)argOrArgs;
>       int idx = 1; // Parameter-index
>
>       Iterator iter = jawsEntity.getCMPFields();
>
>       String rowIDColumn = jawsEntity.getRowIDColumnName();
>       if(rowIDColumn==null) rowIDColumn = "";
>
>
>
>       while (iter.hasNext())
>       {
>         CMPFieldMetaData cmpField = (CMPFieldMetaData)iter.next();
>
>          if(!cmpField.getColumnName().equalsIgnoreCase(rowIDColumn))
>          {
>              Object value = getCMPFieldValue(ctx.getInstance(), cmpField);
>              setParameter(stmt, idx++, cmpField.getJDBCType(), value);
>          }
>       }
>    }
>
>    Now in my client code I have done something like
>
>                 cl.addItemizedCall(callItem); //does the insert
>                 calls =
> cl.getAllItemizedCalls("999999","07947018717","5050505050");
>
>                 I *DO* get the row ID. I believe some things have changed
in
> Oracle 817 and perhaps this is one of them but I do get the ROWID
> automatically without *any* additional code in the ejbPostCreate Method.
>
> Vinay
>
>
>


_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to