InterviewSolution
| 1. |
What is a hibernate xml mapping document and what does it look like? |
|
Answer» Concurrency strategies act as mediators. They are responsible for storing items to and retrieving them from the cache. If the developer wants to enable a second level cache, the developer MUST decide to do it for each persistent class and collection. The developer must also decide which cache concurrency has to be implemented. The concurrency strategies that can be implemented by the developer are as follows:
These strategies are used with second - level cache. An EXAMPLE of the usage of these strategies is shown in the below example where we add a mapping element to the configuration file to inform Hibernate to cache the persistent class instances using read-write strategy. We are using the Employee class in this example. <hibernate-mapping> <class name = "Employee" table = "EMPLOYEE"> <meta attribute = "class-description"> This class contains the employee DETAIL. </meta> <cache usage = "read-write"/> <id name = "id" type = "int" COLUMN = "id"> <generator class="native"/> </id> <property name = "firstName" column = "first_name" type = "string"/> <property name = "lastName" column = "last_name" type = "string"/> <property name = "salary" column = "salary" type = "int"/> </class> </hibernate-mapping> |
|