Level cache: session, hibernate cache autonomy
2 cache (Ehcache)
Read-write (key issues)
Transactional (transactional cache <Ehcache This mode is not supported >)
JbossCache have 2 cache, and it supports the transactional cache, but very difficult to get information on Jboss, or open-source Ehcache of my tastes, and he, as the default hibernate caching strategy, the performance is also very good J
Spring + hibernate at Ehcache applications are very simple, as long as the statement Ehcache the Cache Manager, and the definition of the xml file ehcache it.
Hibernate lock strategy
Hibernate internal locking mechanism
LockMode.NONE without locking mechanism
LockMode.WRITE hibernate to save and update automatically when the use of the lock mechanism.
Read LockMode.READ hibernate record mechanism
Deal with the entire data process, data is locked
State . Pessimistic locking implementation often depend on the database lock mechanism provided
Mechanisms for implementation are as follows:
Why optimistic locking?
More relaxed locking mechanisms, pessimistic lock on the long transaction, the cost often can not afford; avoid deadlock.
Main Introduction Version
Official recommend implementation of optimistic locking strategy, widely used, can draw on experience of
Implementation, for example: at every time out to read the version number in operation during refresh to update the version number at the same time, updates can only update the version of data low, thereby locking strategy to achieve. Hibernate Session will be waiting for user interaction at the time, Session disconnected database connection. Services at the entire application process, Hibernate Example use of a single Session and a single category to achieve Example.
<class name="mtn.gfkd.spring.model.TUser" table="T_USER" schema="SPRINGDEV" optimistic-lock="version">
column = "version"
name = "version"
type = "java.lang.Integer"
At the same time increase the field of database table àversion
Summary: At the general affairs, it can lock mechanism will not set aside, so that it can not be denied an increase of complexity, you have to face a lot of abnormal version information, and only in relation to key business such as payment for online shopping such as the need for locking on the management, of course, recommend the optimistic locking based on version management.
Hibernate data load
Session.createQuery. Iterate () à traversal , sql statement execution 1,1,1 him so why should we choose?
Session.get / Load
What is the difference?
Session cache / 1, secondary cache
Hibernate batch data processing
The primary problem is the volume after the operation cache problem!
Bulk delete example:
Query query = session.createQuery (delete TUser)
Int ret = query.executeUpdate ();
JDBC interface through efficient batch data delete, Session of the cache, secondary cache has not cleared! !
At this point the session.load (TUser, 1) have data, a clear need for manual handling.
The rules a little
One-many configuration, inverse property will be many of the settings are always set up mainly of the prosecution side (inverse = false)
To distinguish the difference between cascade with the inverse
Even the relationship between class Cascade à
Maintaining control of the direction of the relationship between Inverse à
n there is no instrument can restrict us to restrict the U.S. alone are more than our own imagination.
The above is one of my lectures ppt by hibernate organize, it is inevitable that some unclear, since there is time to slowly filled the J
Related Posts of Hibernate depth
Build flex + spring + blazeds + hibernate application First, set up the project blazeds 1, will blazeds.war extract to a directory, such as: myflex /; 2, set up java works were such as: MyFlex, in the orientation of selection create project from exis ...
Hibernate connection pool configuration <! - Jdbc -> <property name="connection.driver_class"> oracle.jdbc.driver.OracleDriver </ property> <property name="connection.url"> jdbc: oracle: thin: @ 10.203.14.132:15
The use of hibernate, implementation of data persistence. Has the following several processes. One configuration database connection information. Hibernate.config 2 configuration mapping. 3 use: the use of the process are the following steps: 3.1: Ge ...
package org.lzpeng.dao; import java.io.Serializable; import java.util.List; import org.hibernate.Criteria; import org.hibernate.Query; import org.hibernate.criterion.Criterion; import org.springside.modules.orm.hibernate.Page; /** * * @version 2009-1-10 *
spring struts2.0 hibernate environmental structures .. despair carried out more than one hour only with good.
http://www.qqread.com/java/2008/06/f413762.html Look here. . Note added myeclipse support spring when necessary add the commons-dbcp database connection pool package. And to add hibernate support. . Finally add struts2 support. . Oh the lazy point. . . fu
dao layer services layer action jsp <tr> <td align="center"> <b> user name: </ b> </ td> <td> <s: textfield name = "czyNumber" cssClass = "textstyle" theme = "simple" size = &q
Hibernate cache: 2-bit cache, also known as process-level cache or SessionFactory level cache, secondary cache can be shared by all of the session Cache configuration and the use of: Will echcache.xml (the document code in hibernate package directory ...
Hibernate cache level: (1) a cache is very short and the session life cycle consistent, also known as session-level cache-level cache or transaction-level cache (2) Ways of Supporting level cache: get (); load (); iterator (); only entity object cach ...
hibernate Lazy strategy can be used in: <class> tag, it can be true / false Tags can <PROPERTY> values true / false type of necessary tools to enhance <set> <list> can tag values true / false / extra <many-to-one> <on ...
1, object-oriented features of what has 1. Abstract: Abstract is that it has overlooked a subject has nothing to do with the current goal of those aspects in order to more fully with the current objectives of the attention-related aspects. Abstract does n