Results 1 to 4 of 4

Thread: Is getSqlMapClientTemplate().getSqlMapClient().flushD ataCache() needed?

  1. #1
    Join Date
    Dec 2007
    Posts
    90

    Default Is getSqlMapClientTemplate().getSqlMapClient().flushD ataCache() needed?

    Hi, I am wondering if iBatis SqlMap implementations in Spring need to be flushed once a transaction is committed? It isn't called explicitly (I think) by anything but SqlMapClient extends com.ibatis.sqlmap.client.SqlMapTransactionManager, and you can do:

    getSqlMapClientTemplate().getSqlMapClient().flushD ataCache();

    If so, is the best placement of it in a custom SqlMapClientTemplate so that you don't need to put it in your DAO interface and implement it in all DAO's?
    like:
    public class MySqlMapClientTemplate{

    public void flushDataSource(){
    this.getSqlMapClient().flushDataCache();
    }

    thanks!

  2. #2
    Join Date
    Dec 2007
    Posts
    90

    Default

    What I am talking about is this scenario for Hibernate, only for iBATIS
    http://blog.interface21.com/main/200...-example-code/

    does anyone know?
    Last edited by Helena; Jan 5th, 2008 at 05:09 PM.

  3. #3
    Join Date
    Sep 2007
    Location
    Oceanside, CA
    Posts
    187

    Default

    The SqlMapClient.flushDataCache() method is for explicitly clearing any data cached by the iBATIS framework, so unless you are using iBATIS cache models, you shouldn't need to call this method.

    Hibernate will often delay executing database operations until the end of a transaction to minimize the number of database hits and optimize the queries sent to the database (for example, batching operations together), which is why Hibernate Sessions may sometimes need to be explicitly flushed when using Hibernate and plain JDBC in the same transaction.
    Mike Bingham

  4. #4
    Join Date
    Dec 2007
    Posts
    90

    Default it sounds like 2 very different flushing scenarios

    The SqlMapClient.flushDataCache() method is for explicitly clearing any data cached by the iBATIS framework
    We are indeed using iBATIS (many SP's), and in some cases, caching. I have implemented a transaction management strategy via Spring but was not clear/unable to find documentation whether getSqlMapClient().flushDataCache() for iBATIS was necessary as with hybernate. We are purely interacting with ORM, not doing direct JDBC.

    Based on your very helpful explanations, it sounds like 2 very different flushing scenarios.

    thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •