Just curious.. a doInsert to DAOIBaseHelper & a rollback question
"Rick Reumann" <[email protected]> Sun, 11 May 2003 15:59:13 -0400
| Newsgroups | gmane.comp.java.mvc.devel |
|---|---|
| Organization | baseBeans Engineering |
| Message-ID | <[email protected]> |
Hi ya Vic,
I understand what's going on with doUpdate of DAOIBaseHelper and how it
looks for the "new" flag to decide whether to call the "insert" sql or
instead calls the "update" sql. I'm wondering what the problem would be if
I decided to add a doInsert in the DAOIBaseHelper vs having doUpdate
decide on what to call? Conceptionally I think doUpdate() should only be
responsible for doing a 'true' update and a doInsert() would of course
just call the insert sql. Do you see a problem with me doing it this way
instead?
Also, I notice you call "_sqlMap.rollbackTransaction()" 'before' you end
up starting any transaction. I assume this is to make sure that any
outstanding connections are properly returned to the pool, but couldn't I
just make sure that I always call _sqlMap.rollbackTransaction() before
leaving the try/catch block in a finally?
finally {
if (_sqlMap != null ) _sqlMap.rollbackTransaction();
}
I only bring it up because
1 ) the postgres log keeps showing
WARNING: ROLLBACK: no transaction in progress since the first time a
query/update is called there won't be anything to rollback.
and
2) conceptually I think it's best to return the connection to the pool as
soon as possible.
I know that it'll work fine calling _sqlMap.rollbackTransaction() before
you begin to use _sqlMap.startTransaction(), I was just wondering if there
was some particular reason that I'm not aware of why you are calling the
rollback first?
Thanks,
PS - I'm so glad I actually started programming a very small app based on
your Basic Portal stuff. Amazing how awesomely cool this Map/List backed
bean approach with Ibatis works out. I'm a person that has to actually
begin "doing" in order to see how great it is.
--
Rick