Monday, March 21, 2016

hibernate improve database performance

hibernate improve database performance


  1. In the query string, you should use jdbc placeholder? Or use named parameters: Do not use the query string value instead of the very values.
  2. Flush affect performance, frequently refreshed affect performance, minimize unnecessary refresh. 
  3. Cascade strategy, a few to several relationships set correctly cascade strategy, to think clearly in the operation target A cascade operation, while the need for an object B, such as one to many relationship between father and son, the father removed one, required level United delete child many, this time can be set to one end of this cascade = "delete", so when you delete one, the child is automatically deleted, but the pair does not affect the parent. Cascade has other property values, as long as the settings are correct, you can improve performance. 
  4. Lazy policy set correctly delay loading strategy will also enhance the performance, one to many or many to many, the total delay should normally be loaded into the memory of many of the party. Set lazy = "true", first send sql statements to load itself into memory only when needed to load Cascading objects; lazy = "false", is simultaneously loaded into memory objects themselves and cascade. 
  5. In addition to the performance of the collection (set, list, map, array ), should be set up correctly. 
  6.  The proper use of third-party cache, read frequently writes small operating conditions, the use of third-party cache can significantly improve performance, such as ehcache caching strategies have: read-only, read-write and notstrict-read-write.

No comments:

Post a Comment