Hibernate in connection holder is null error, could not execute query error solution

Understand, you can correct me wrong

Add, modify frequent operation, data is too large, good times and bad method will, had good yesterday, today has been an error, just refresh the original release Cached

1. Increase follows in Hibernate

public  void the flush () { 
        the getHibernateTemplate () the flush ();. 
    } // flush the cache 
public  void The evict (Entity Object) { 
        the getHibernateTemplate () The evict (Entity);. 
    } // flush the cache

2. Add, modify or process as follows

// definition of type int count

int a = 0;

for(int i = 0; i<list.size();i++){

// every add, modify or add 1

a++;

// each new or modified 100 to refresh the cache and empty the cache

if(a%100 == 0){

  // call the method to refresh the cache

  列:getHibernateTemplate().flush();

  // clear the cache method invocation

     列:getHibernateTemplate().evict(entity);

}

}

 

Each add, edit 100 data cache is emptied it would not report this wrong.

Guess you like

Origin www.cnblogs.com/yanchaohui/p/11350470.html
Recommended