Micah,

As a Cach�/Java developer, the first I would tell you is not to use an O/R mapper with Cach�; you don't need one! :)

However, let me address your question directly. There are no built-in identity/sequence datatypes in Cach�, so you would have to program your own. This has been discussed before in this newsgroup - there's a fully searchable archive at http://xiscsp.co.uk/ngp hosted by Peter Cooper. In short, both of the approaches you suggest are doable and you may even find some example code.

On the other hand, each Cach� class is given an ID field which is automatically incremented by Cach� and guaranteed to be unique for each object of that class (as long as you don't fiddle with the storages and/or the extent settings...) If you need identity/sequence types for this purpose, then Cach� already has it.

One more thing is that if memory serves me right, the Cach� JDBC driver supports JDBC 2.0 and thus it should be possible to use java.sql.ResultSet::getGeneratedKeys() to retrieve the value of the class ID (see previous paragraph) after inserting an object.

HTH, keep them coming :)

Ram�n

--
ZCacheLib - Open Source Extensions for Cach�
http://www.zcachelib.org



Reply via email to