Hi Manu,

This method is always supposed to get a String value.

When a custom primary key is used, its type must be declared in the ejb-jar.xml DD via the prim-key-class element. Also, the primkey-field elements in both the ejb-jar.xml DD and openejb-jar.xml DD must not be set; these elements should be used only whne the CMP has a simple primary key. Could you please confirm that none of these elements have been set?

Thanks,
Gianny

Manu George wrote:

Hi,
I am facing a problem with some CMP EJBs with custom PrimaryKey Classes. I am getting the EJBs deployed but during invoking of the findbyprimarykey method I am getting a TransactionRolledBack Exception. On investigating the cause of this I found that it was due to a ClassCastException that was ocurring in TranQL. In the class org.tranql.sql.jdbc.binding.StringBinding there is a method setValue. Here during execution the value parameter contains the custom primary key class cast as Object. In the setString method it gives a ClassCastException. Shouldn't this be a value.toString() here? or is this method always supposed to get just a string value?

public void setValue(PreparedStatement ps, Object value) throws SQLException {
        ps.setString(index, (String) value);
    }

Is there any specific property we need to put in openejb-jar.xml when we use complex PrimaryKey classes over and above the entries in ejb-jar.xml? Also for the <primkey-field> value in the openejb-jar.xml what do we put if we have a complex primary key consisting of 2 fields?

Thanks
Manu



Reply via email to