If you are just starting into this project I would recommend that you use Spring for your DAO factory. As far as SQL Exceptions you can use the getErrorCode to interpret what error it is. This will not be cross-database compatible. You could simply avoid the SQLException by performing a simple select on the database before you insert. If you have the ID then you make your change. If you don't have the ID you go ahead and update.

Brandon

On 7/22/06, Edwin Lukaweski <[EMAIL PROTECTED]> wrote:
Hi:
 
    I need some hints as to how to handle a situation with iBatis.
 
    I would like to perform an INSERT, then catch the sqlexception and determine if it is caused by a duplicate key. If so, I will want to perform an UPDATE to the record.
 
    I realize that DAO throws a daoexception, but I am not quite sure how to handle it.
 
    Does anybody have any ideas?
 
Thanks in advance,
Edwin
 

Reply via email to