Start the test. 1. Start TC Server from POC_INSTALL_DIR as follows : mvn tc:start 2. Start POC by running "mvn tc:run" 3. The POC is a user interactive program. 4. The sample application uses HSQLDB version 1.8.0. 5. To start the HSQLDB execute the following command from terminal. java -cp ./hsqldb.jar org.hsqldb.Server -database.0 file:mydb -dbname.0 myrecord POC at work : 1. Application will give user the option to either enter a new record or view existing records. 2. a. Choose 'Enter Record' b. user will be prompted to enter first name and last name. c. Record will be saved successfully. 3. a. Choose 'View Record' b. user will be given to view a record based on either 'First Name' or hibernate generated 'Record ID' c. appropriate record if exists will be displayed to the user. 4. By default second level caching and query cache is enabled with this example. show_sql_queries is also turned on and hence in case of cache hits, users will notice no sql being fired and instead the entities are recovered from the second level ehcache. 5. In case the sme data is viewed twice the application will not print the sql query, i.e. the data will be fetched from the cache. 6. Only at the first run you will see the application firing sql queries. In subsequesnt runs (even after application restart) as the data is cached with terracotta in ehcache. The query gets the data from terracotta clustered ehcache and serves it to the calling thread. Important points : 1. By default ALL_CACHE_MANAGERS field which is a static List in CacheManager.java is clustered. Their is no API in cache manager to access this field directly. 2. By Default the singleton cachemanager field in CacheManager.java is clustered and can be obtained by using CacheManager.getInstance() or CacheManager.create() methods. 3. Beyond 2.7.2 releases of terracotta the propery ehcache.clusterAllCacheManagers when set to false will not cluster the above two roots. In this case teh cachemanagers need to be explicitly be defined inside the tc-config.xml of teh application. 4. non-strict-read-write cache (and not read-write) must be used as the cache level in entiy's hbm files. This is because terracotta inheretently provides correctness and adding an extra level of protection obviously involves a performance hit. Use Cases : 1. The sample application demonstrates a clustered EhCache Manager (which is not a default singleton CacheManager inside CacheManager.java). 2. The sample application demonstrates a non-clustered ehcache manager.