Hello,
I've a question about support of serial fields of jonas in EntityBeans.
I know that this is a difficult part, because the serial field is
databasedependent.
Is it possible in the ejbCreate method (generated by genIC) direct after the
pstmt.update() to call another method like "getPrimaryKey".
This method is by default empty, but I can overwrite it, if I want to set
the primary key with the serial field. (like the methodic of "setModified")
By example: this is the generated EB:
public de.dpd.dp270.Dt27000EBPK ejbCreate(java.lang.Integer p1,
java.lang.String p2,
...
...
pStmt.setNull(15, Types.INTEGER);
} else {
pStmt.setObject(15, (java.lang.Object)this.updatecounter);
}
pStmt.executeUpdate();
>>>>
here we could call the method like ...
this.primarykey = getPrimaryKeyFromSerial(pStmt);
>>>>
} catch (Exception e) {
TraceEjb.error("Failed to create bean in database", e);
throw new javax.ejb.CreateException(e.toString());
...
with Informix I could then write in my Bean:
public int getPrimaryKeyFromSerial(PreparedStatement pstmt) throws
Exception {
return (int)((IfmxStatement)pstmt).getSerial();
}
This is only a very simple example how it could work. What do you think
about this?
We need it, because after an ejbCreate we want to know the primary key to
link to other tables...
At the moment we use a separate table in the database to store the max
values of the table, but I think this solution is horrible ;-)))
Thank you for any tips,
best regards,
Juergen Messer
****************************************
DELICom
DPD Deutscher Paket Dienst GmbH & Co. KG
E-Mail: [EMAIL PROTECTED]
Internet : http://www.dpd.de
****************************************
----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".