Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
1) I have configured cache on simple POJO with following attributes
id
name
value
2) Implemented one test case that does the following
a)loads all rows of BasisPoint from database using session.loadAll(BasisPoint.class) and records the count;
b)Inserts 2 rows in the database through jdbc
c)reads all rows of BasisPoint from database using session.loadAll(BasisPoint.class); and compares the count with the one recorded in step a)
The count differs as hibernate executes select query the second time and reads data inserted into the database through jdbc. Any help will be highly appreciated.
Hibernate version:
2.1.8
Mapping documents:
BasisPoint.hbm.xml
<hibernate-mapping>
<class name="com.example.domain.BasisPoint" table="BASISPOINT" mutable="false">
<cache usage="read-only"/>
<id name="id" column="id" type="java.lang.Long">
<generator class="assigned"/>
</id>
<property name="name" type="java.lang.String" column="NAME"/>
<property name="value" type="java.lang.String" column="VALUE"/>
</class>
</hibernate-mapping>
ehcache.xml
<ehcache>
<defaultCache
maxElementsInMemory="1"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="true"
/>
<cache name="com.example.domain.BasisPoint"
maxElementsInMemory="500"
eternal="true"
timeToIdleSeconds="0"
timeToLiveSeconds="0"
overflowToDisk="false"
/>
</ehcache>
spring-config.xml
<beans default-autowire="byName">
<bean id="hibernateTemplate"
class="org.springframework.orm.hibernate.HibernateTemplate">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="jdbcTemplate"
class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource">
<ref bean="dataSource" />
</property>
</bean>
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>org.hsqldb.jdbcDriver</value>
</property>
<property name="url">
<value>jdbc:hsqldb:hsql://localhost/xdb</value>
</property>
<property name="username">
<value>sa</value>
</property>
<property name="password">
<value></value>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
<property name="hibernateProperties">
<props>
<prop key="hibernate.connection.driver_class">
org.hsqldb.jdbcDriver
</prop>
<prop key="hibernate.connection.url">
jdbc:hsqldb:hsql://localhost/xdb
</prop>
<prop key="hibernate.connection.username">sa</prop>
<prop key="hibernate.connection.password"></prop>
<prop key="hibernate.dialect">
net.sf.hibernate.dialect.HSQLDialect
</prop>
<prop key="hibernate.cache.provider_class">net.sf.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
</props>
</property>
<property name="mappingDirectoryLocations">
<list>
<value>classpath:/</value>
</list>
</property>
</bean>
<bean id="basisPointDAO" class="com.example.dao.BasisPointDAO">
<constructor-arg>
<ref bean="hibernateTemplate" />
</constructor-arg>
</bean>
</beans>
Code between sessionFactory.openSession() and session.close():
BasisPointDAO.java
package com.example.dao;
import com.example.domain.BasisPoint;
import org.springframework.orm.hibernate.HibernateTemplate;
import java.util.Collection;
public class BasisPointDAO {
private HibernateTemplate session;
public BasisPointDAO(HibernateTemplate hibernateTemplate) {
session = hibernateTemplate;
}
public BasisPoint getBasisPoint(Long id) {
return (BasisPoint) session.load(BasisPoint.class, id);
}
public Collection getAllBasisPoints() {
return session.loadAll(BasisPoint.class);
}
}
package test.com.example.dao;
import java.util.Collection;
import junit.framework.TestCase;
import org.apache.log4j.BasicConfigurator;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;
import com.example.dao.BasisPointDAO;
public class TestBasisPointDAO extends TestCase{
private BasisPointDAO dao = null;
private JdbcTemplate jdbc = null;
public TestBasisPointDAO(String name)
{
super(name);
BasicConfigurator.configure();
ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
dao = (BasisPointDAO) context.getBean("basisPointDAO");
jdbc = (JdbcTemplate) context.getBean("jdbcTemplate");
}
public void setUp()
{
jdbc.execute("insert into BasisPoint(id,name,value) values(1,'first', 'firstValue')");
jdbc.execute("insert into BasisPoint(id,name,value) values(2,'second', 'secondValue')");
}
public void testLoadAllCache()
{
Collection basisPoints = (Collection) dao.getAllBasisPoints();
int initialLength = basisPoints.size();
//Enter data manually
jdbc.execute("insert into BasisPoint(id,name,value) values(3,'third', 'thirdValue')");
jdbc.execute("insert into BasisPoint(id,name,value) values(4,'fourth', 'fourthValue')");
basisPoints = (Collection) dao.getAllBasisPoints();
int finalLength = basisPoints.size();
assertEquals(initialLength, finalLength);
}
public void tearDown()
{
jdbc.execute("delete from BasisPoint");
}
}
Name and version of the database you are using:
Hypersonic
Debug level Hibernate log excerpt:
235 [main] INFO net.sf.hibernate.cfg.Environment - Hibernate 2.1.8
235 [main] INFO net.sf.hibernate.cfg.Environment - hibernate.properties not found
235 [main] INFO net.sf.hibernate.cfg.Environment - using CGLIB reflection optimizer
235 [main] INFO net.sf.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
250 [main] INFO net.sf.hibernate.cfg.Configuration - Mapping file: C:\eclipse\workspace\HibernateCache\bin\BasisPoint.hbm.xml
282 [main] DEBUG net.sf.hibernate.util.DTDEntityResolver - trying to locate
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
282 [main] DEBUG net.sf.hibernate.util.DTDEntityResolver - found
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
375 [main] INFO net.sf.hibernate.cfg.Binder - Mapping class: com.example.domain.BasisPoint -> BASISPOINT
375 [main] DEBUG net.sf.hibernate.cache.CacheFactory - cache for: com.example.domain.BasisPoint usage strategy: read-only
422 [main] DEBUG net.sf.hibernate.cfg.Binder - Mapped property: id -> id, type: long
422 [main] DEBUG net.sf.hibernate.cfg.Binder - Mapped property: name -> NAME, type: string
422 [main] DEBUG net.sf.hibernate.cfg.Binder - Mapped property: value -> VALUE, type: string
422 [main] INFO org.springframework.orm.hibernate.LocalSessionFactoryBean - Building new Hibernate SessionFactory
422 [main] INFO net.sf.hibernate.cfg.Configuration - processing one-to-many association mappings
422 [main] INFO net.sf.hibernate.cfg.Configuration - processing one-to-one association property references
422 [main] INFO net.sf.hibernate.cfg.Configuration - processing foreign key constraints
453 [main] INFO net.sf.hibernate.dialect.Dialect - Using dialect: net.sf.hibernate.dialect.HSQLDialect
453 [main] DEBUG net.sf.hibernate.exception.SQLExceptionConverterFactory - Using dialect defined converter
453 [main] INFO net.sf.hibernate.cfg.SettingsFactory - Use outer join fetching: true
453 [main] INFO net.sf.hibernate.connection.ConnectionProviderFactory - Initializing connection provider: org.springframework.orm.hibernate.LocalDataSourceConnectionProvider
469 [main] INFO net.sf.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
563 [main] INFO net.sf.hibernate.cfg.SettingsFactory - Use scrollable result sets: true
563 [main] INFO net.sf.hibernate.cfg.SettingsFactory - Use JDBC3 getGeneratedKeys(): false
563 [main] INFO net.sf.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: false
563 [main] INFO net.sf.hibernate.cfg.SettingsFactory - Query language substitutions: {}
563 [main] INFO net.sf.hibernate.cfg.SettingsFactory - cache provider: net.sf.hibernate.cache.EhCacheProvider
563 [main] INFO net.sf.hibernate.cfg.SettingsFactory - query cache factory: net.sf.hibernate.cache.StandardQueryCacheFactory
563 [main] DEBUG net.sf.hibernate.cfg.SettingsFactory - Wrap result sets enabled? : false
563 [main] INFO net.sf.hibernate.cfg.Configuration - instantiating and configuring caches
578 [main] DEBUG net.sf.ehcache.CacheManager - Creating new CacheManager with default config
578 [main] DEBUG net.sf.ehcache.CacheManager - Configuring ehcache from classpath.
578 [main] DEBUG net.sf.ehcache.config.Configurator - Configuring ehcache from ehcache.xml found in the classpath: file:/C:/eclipse/workspace/HibernateCache/bin/ehcache.xml
625 [main] DEBUG net.sf.ehcache.config.Configuration$DiskStore - Disk Store Path: C:/
625 [main] DEBUG net.sf.ehcache.store.MemoryStore - com.example.domain.BasisPoint Cache: Using SpoolingLinkedHashMap implementation
625 [main] DEBUG net.sf.ehcache.store.MemoryStore - initialized MemoryStore for com.example.domain.BasisPoint
625 [main] DEBUG net.sf.hibernate.cfg.Configuration - instantiating cache com.example.domain.BasisPoint
719 [main] INFO net.sf.hibernate.impl.SessionFactoryImpl - building session factory
719 [main] DEBUG net.sf.hibernate.impl.SessionFactoryImpl - instantiating session factory with properties: {hibernate.connection.password=, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, hibernate.cache.provider_class=net.sf.hibernate.cache.EhCacheProvider, sun.boot.library.path=C:\Program Files\Java\j2re1.4.2_03\bin, java.vm.version=1.4.2_03-b02, hibernate.connection.username=sa, java.vm.vendor=Sun Microsystems Inc., java.vendor.url=http://java.sun.com/, hibernate.cache.use_query_cache=true, path.separator=;, java.vm.name=Java HotSpot(TM) Client VM, file.encoding.pkg=sun.io, user.country=US, sun.os.patch.level=Service Pack 2, java.vm.specification.name=Java Virtual Machine Specification, user.dir=C:\eclipse\workspace\HibernateCache, java.runtime.version=1.4.2_03-b02, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=C:\Program Files\Java\j2re1.4.2_03\lib\endorsed, os.arch=x86, java.io.tmpdir=C:\DOCUME~1\GOPESH~1\LOCALS~1\Temp\, line.separator=
, java.vm.specification.vendor=Sun Microsystems Inc., user.variant=, os.name=Windows XP, sun.java2d.fontpath=, java.library.path=C:\Program Files\Java\j2re1.4.2_03\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\PROGRA~1\COMMON~1\SONICS~1\;C:\Tools\maven\bin;C:\jwsdp-1.5\jaxrpc\bin;C:\Tools\ant\bin;C:\jwsdp-1.5\jwsdp-shared\bin, java.specification.name=Java Platform API Specification, java.class.version=48.0, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, os.version=5.1, user.home=C:\Documents and Settings\Gopesh Desai, user.timezone=, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=Cp1252, java.specification.version=1.4, hibernate.connection.driver_class=org.hsqldb.jdbcDriver, user.name=Gopesh Desai, java.class.path=/c:/eclipse/plugins/org.eclipse.jdt.junit_3.0.1/junitsupport.jar;/c:/eclipse/plugins/org.eclipse.jdt.junit.runtime_3.0.2/junitruntime.jar;C:\eclipse\workspace\HibernateCache\bin;C:\Gopesh\frameworks\spring-framework-1.1.5\dist\spring.jar;C:\Gopesh\frameworks\hibernate-2.1.8\hibernate-2.1\hibernate2.jar;C:\Tools\junit\junit.jar;C:\Gopesh\Server\jboss-4.0.2\server\default\lib\commons-logging.jar;C:\Gopesh\Server\jboss-4.0.2\server\default\lib\log4j.jar;C:\Gopesh\Server\jboss-4.0.2\server\default\lib\jboss-transaction.jar;C:\Gopesh\Server\jboss-4.0.2\server\default\lib\jboss-j2ee.jar;C:\Gopesh\Server\jboss-4.0.2\server\default\lib\dom4j-1.4.jar;C:\Gopesh\Server\jboss-4.0.2\server\default\lib\hsqldb.jar;C:\Gopesh\Server\jboss-4.0.2\server\default\lib\ehcache-0.7.jar;C:\Gopesh\Server\jboss-4.0.2\server\default\lib\cglib-full-2.0.1.jar;C:\Gopesh\Server\jboss-4.0.2\server\default\lib\commons-collections.jar;C:\Gopesh\Server\jboss-4.0.2\server\default\lib\commons-dbcp-1.1.jar;C:\Gopesh\Server\jboss-4.0.2\server\default\lib\commons-pool-1.1.jar, java.vm.specification.version=1.0, java.home=C:\Program Files\Java\j2re1.4.2_03, sun.arch.data.model=32, hibernate.connection.url=jdbc:hsqldb:hsql://localhost/xdb, hibernate.dialect=net.sf.hibernate.dialect.HSQLDialect, user.language=en, java.specification.vendor=Sun Microsystems Inc., awt.toolkit=sun.awt.windows.WToolkit, hibernate.cglib.use_reflection_optimizer=true, java.vm.info=mixed mode, java.version=1.4.2_03, java.ext.dirs=C:\Program Files\Java\j2re1.4.2_03\lib\ext, sun.boot.class.path=C:\Program Files\Java\j2re1.4.2_03\lib\rt.jar;C:\Program Files\Java\j2re1.4.2_03\lib\i18n.jar;C:\Program Files\Java\j2re1.4.2_03\lib\sunrsasign.jar;C:\Program Files\Java\j2re1.4.2_03\lib\jsse.jar;C:\Program Files\Java\j2re1.4.2_03\lib\jce.jar;C:\Program Files\Java\j2re1.4.2_03\lib\charsets.jar;C:\Program Files\Java\j2re1.4.2_03\classes, java.vendor=Sun Microsystems Inc., file.separator=\, hibernate.connection.provider_class=org.springframework.orm.hibernate.LocalDataSourceConnectionProvider, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, sun.cpu.isalist=pentium i486 i386}
953 [main] DEBUG net.sf.hibernate.impl.SessionFactoryObjectFactory - initializing class SessionFactoryObjectFactory
953 [main] DEBUG net.sf.hibernate.impl.SessionFactoryObjectFactory - registered: 402880830503191b010503191cc70000 (unnamed)
953 [main] INFO net.sf.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
953 [main] DEBUG net.sf.hibernate.impl.SessionFactoryImpl - instantiated session factory
953 [main] INFO net.sf.hibernate.cache.UpdateTimestampsCache - starting update timestamps cache at region: net.sf.hibernate.cache.UpdateTimestampsCache
953 [main] WARN net.sf.hibernate.cache.EhCacheProvider - Could not find configuration [net.sf.hibernate.cache.UpdateTimestampsCache]; using defaults.
953 [main] DEBUG net.sf.ehcache.store.MemoryStore - net.sf.hibernate.cache.UpdateTimestampsCache Cache: Using SpoolingLinkedHashMap implementation
953 [main] DEBUG net.sf.ehcache.store.MemoryStore - initialized MemoryStore for net.sf.hibernate.cache.UpdateTimestampsCache
953 [main] DEBUG net.sf.hibernate.cache.EhCacheProvider - started EHCache region: net.sf.hibernate.cache.UpdateTimestampsCache
969 [main] INFO net.sf.hibernate.cache.StandardQueryCache - starting query cache at region: net.sf.hibernate.cache.StandardQueryCache
969 [main] WARN net.sf.hibernate.cache.EhCacheProvider - Could not find configuration [net.sf.hibernate.cache.StandardQueryCache]; using defaults.
969 [main] DEBUG net.sf.ehcache.store.MemoryStore - net.sf.hibernate.cache.StandardQueryCache Cache: Using SpoolingLinkedHashMap implementation
969 [main] DEBUG net.sf.ehcache.store.MemoryStore - initialized MemoryStore for net.sf.hibernate.cache.StandardQueryCache
969 [main] DEBUG net.sf.hibernate.cache.EhCacheProvider - started EHCache region: net.sf.hibernate.cache.StandardQueryCache
1141 [main] DEBUG net.sf.hibernate.impl.SessionImpl - opened session
1141 [main] DEBUG net.sf.hibernate.impl.SessionImpl - flushing session
1141 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Flushing entities and processing referenced collections
1141 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Processing unreferenced collections
1141 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Scheduling collection removes/(re)creates/updates
1141 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Flushed: 0 insertions, 0 updates, 0 deletions to 0 objects
1141 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
1141 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Dont need to execute flush
1141 [main] DEBUG net.sf.hibernate.impl.BatcherImpl - about to open: 0 open PreparedStatements, 0 open ResultSets
1141 [main] DEBUG net.sf.hibernate.SQL - select this.id as id0_, this.NAME as NAME0_, this.VALUE as VALUE0_ from BASISPOINT this where 1=1
1141 [main] DEBUG net.sf.hibernate.impl.BatcherImpl - preparing statement
1157 [main] DEBUG net.sf.hibernate.loader.Loader - processing result set
1157 [main] DEBUG net.sf.hibernate.type.LongType - returning '1' as column: id0_
1157 [main] DEBUG net.sf.hibernate.loader.Loader - result row: 1
1157 [main] DEBUG net.sf.hibernate.loader.Loader - Initializing object from ResultSet: 1
1157 [main] DEBUG net.sf.hibernate.loader.Loader - Hydrating entity: com.example.domain.BasisPoint#1
1157 [main] DEBUG net.sf.hibernate.type.StringType - returning 'first' as column: NAME0_
1157 [main] DEBUG net.sf.hibernate.type.StringType - returning 'firstValue' as column: VALUE0_
1157 [main] DEBUG net.sf.hibernate.type.LongType - returning '2' as column: id0_
1157 [main] DEBUG net.sf.hibernate.loader.Loader - result row: 2
1157 [main] DEBUG net.sf.hibernate.loader.Loader - Initializing object from ResultSet: 2
1157 [main] DEBUG net.sf.hibernate.loader.Loader - Hydrating entity: com.example.domain.BasisPoint#2
1157 [main] DEBUG net.sf.hibernate.type.StringType - returning 'second' as column: NAME0_
1157 [main] DEBUG net.sf.hibernate.type.StringType - returning 'secondValue' as column: VALUE0_
1157 [main] DEBUG net.sf.hibernate.loader.Loader - done processing result set (2 rows)
1172 [main] DEBUG net.sf.hibernate.impl.BatcherImpl - done closing: 0 open PreparedStatements, 0 open ResultSets
1172 [main] DEBUG net.sf.hibernate.impl.BatcherImpl - closing statement
1172 [main] DEBUG net.sf.hibernate.loader.Loader - total objects hydrated: 2
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - resolving associations for [com.example.domain.BasisPoint#1]
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - adding entity to second-level cache [com.example.domain.BasisPoint#1]
1172 [main] DEBUG net.sf.hibernate.cache.ReadOnlyCache - Caching: 1
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - done materializing entity [com.example.domain.BasisPoint#1]
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - resolving associations for [com.example.domain.BasisPoint#2]
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - adding entity to second-level cache [com.example.domain.BasisPoint#2]
1172 [main] DEBUG net.sf.hibernate.cache.ReadOnlyCache - Caching: 2
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - done materializing entity [com.example.domain.BasisPoint#2]
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - initializing non-lazy collections
1172 [main] DEBUG org.springframework.orm.hibernate.HibernateTemplate - Eagerly flushing Hibernate session
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - flushing session
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Flushing entities and processing referenced collections
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Processing unreferenced collections
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Scheduling collection removes/(re)creates/updates
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Flushed: 0 insertions, 0 updates, 0 deletions to 2 objects
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
1172 [main] DEBUG net.sf.hibernate.impl.Printer - listing entities:
1172 [main] DEBUG net.sf.hibernate.impl.Printer - com.example.domain.BasisPoint{value=secondValue, name=second, id=2}
1172 [main] DEBUG net.sf.hibernate.impl.Printer - com.example.domain.BasisPoint{value=firstValue, name=first, id=1}
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - executing flush
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - post flush
1172 [main] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Closing Hibernate session
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - closing session
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - disconnecting session
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - transaction completion
2
1172 [main] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Opening Hibernate session
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - opened session
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - loading [com.example.domain.BasisPoint#1]
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - attempting to resolve [com.example.domain.BasisPoint#1]
1172 [main] DEBUG net.sf.hibernate.cache.EhCache - key: 1
1172 [main] DEBUG net.sf.ehcache.store.MemoryStore - com.example.domain.BasisPointCache: MemoryStore hit for 1
1172 [main] DEBUG net.sf.hibernate.cache.ReadOnlyCache - Cache hit: 1
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - resolved object in second-level cache [com.example.domain.BasisPoint#1]
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Cached Version: null
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - initializing non-lazy collections
1172 [main] DEBUG org.springframework.orm.hibernate.HibernateTemplate - Eagerly flushing Hibernate session
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - flushing session
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Flushing entities and processing referenced collections
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Processing unreferenced collections
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Scheduling collection removes/(re)creates/updates
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
1172 [main] DEBUG net.sf.hibernate.impl.Printer - listing entities:
1172 [main] DEBUG net.sf.hibernate.impl.Printer - com.example.domain.BasisPoint{value=firstValue, name=first, id=1}
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - executing flush
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - post flush
1172 [main] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Closing Hibernate session
1172 [main] DEBUG net.sf.hibernate.impl.SessionImpl - closing session
Id=1,name=first,value=firstValue
1172 [main] DEBUG org.springframework.jdbc.core.JdbcTemplate - Executing SQL statement [insert into BasisPoint(id,name,value) values(3,'third', 'thirdValue')]
1172 [main] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Opening JDBC connection
1188 [main] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Closing JDBC connection
1188 [main] DEBUG org.springframework.jdbc.core.JdbcTemplate - Executing SQL statement [insert into BasisPoint(id,name,value) values(4,'fourth', 'fourthValue')]
1188 [main] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Opening JDBC connection
1188 [main] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Closing JDBC connection
1188 [main] DEBUG org.springframework.jdbc.core.JdbcTemplate - Executing SQL statement [update BasisPoint set name='New Value' where id = 1]
1188 [main] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Opening JDBC connection
1188 [main] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Closing JDBC connection
1188 [main] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Opening Hibernate session
1188 [main] DEBUG net.sf.hibernate.impl.SessionImpl - opened session
1188 [main] DEBUG net.sf.hibernate.impl.SessionImpl - flushing session
1188 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Flushing entities and processing referenced collections
1188 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Processing unreferenced collections
1188 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Scheduling collection removes/(re)creates/updates
1188 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Flushed: 0 insertions, 0 updates, 0 deletions to 0 objects
1188 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
1188 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Dont need to execute flush
1188 [main] DEBUG net.sf.hibernate.impl.BatcherImpl - about to open: 0 open PreparedStatements, 0 open ResultSets
1188 [main] DEBUG net.sf.hibernate.SQL - select this.id as id0_, this.NAME as NAME0_, this.VALUE as VALUE0_ from BASISPOINT this where 1=1
1188 [main] DEBUG net.sf.hibernate.impl.BatcherImpl - preparing statement
1203 [main] DEBUG net.sf.hibernate.loader.Loader - processing result set
1203 [main] DEBUG net.sf.hibernate.type.LongType - returning '2' as column: id0_
1203 [main] DEBUG net.sf.hibernate.loader.Loader - result row: 2
1203 [main] DEBUG net.sf.hibernate.loader.Loader - Initializing object from ResultSet: 2
1203 [main] DEBUG net.sf.hibernate.loader.Loader - Hydrating entity: com.example.domain.BasisPoint#2
1203 [main] DEBUG net.sf.hibernate.type.StringType - returning 'second' as column: NAME0_
1203 [main] DEBUG net.sf.hibernate.type.StringType - returning 'secondValue' as column: VALUE0_
1203 [main] DEBUG net.sf.hibernate.type.LongType - returning '3' as column: id0_
1203 [main] DEBUG net.sf.hibernate.loader.Loader - result row: 3
1203 [main] DEBUG net.sf.hibernate.loader.Loader - Initializing object from ResultSet: 3
1203 [main] DEBUG net.sf.hibernate.loader.Loader - Hydrating entity: com.example.domain.BasisPoint#3
1203 [main] DEBUG net.sf.hibernate.type.StringType - returning 'third' as column: NAME0_
1203 [main] DEBUG net.sf.hibernate.type.StringType - returning 'thirdValue' as column: VALUE0_
1203 [main] DEBUG net.sf.hibernate.type.LongType - returning '4' as column: id0_
1203 [main] DEBUG net.sf.hibernate.loader.Loader - result row: 4
1203 [main] DEBUG net.sf.hibernate.loader.Loader - Initializing object from ResultSet: 4
1203 [main] DEBUG net.sf.hibernate.loader.Loader - Hydrating entity: com.example.domain.BasisPoint#4
1203 [main] DEBUG net.sf.hibernate.type.StringType - returning 'fourth' as column: NAME0_
1203 [main] DEBUG net.sf.hibernate.type.StringType - returning 'fourthValue' as column: VALUE0_
1203 [main] DEBUG net.sf.hibernate.type.LongType - returning '1' as column: id0_
1203 [main] DEBUG net.sf.hibernate.loader.Loader - result row: 1
1203 [main] DEBUG net.sf.hibernate.loader.Loader - Initializing object from ResultSet: 1
1203 [main] DEBUG net.sf.hibernate.loader.Loader - Hydrating entity: com.example.domain.BasisPoint#1
1203 [main] DEBUG net.sf.hibernate.type.StringType - returning 'New Value' as column: NAME0_
1203 [main] DEBUG net.sf.hibernate.type.StringType - returning 'firstValue' as column: VALUE0_
1203 [main] DEBUG net.sf.hibernate.loader.Loader - done processing result set (4 rows)
1203 [main] DEBUG net.sf.hibernate.impl.BatcherImpl - done closing: 0 open PreparedStatements, 0 open ResultSets
1203 [main] DEBUG net.sf.hibernate.impl.BatcherImpl - closing statement
1203 [main] DEBUG net.sf.hibernate.loader.Loader - total objects hydrated: 4
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - resolving associations for [com.example.domain.BasisPoint#2]
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - adding entity to second-level cache [com.example.domain.BasisPoint#2]
1203 [main] DEBUG net.sf.hibernate.cache.ReadOnlyCache - Caching: 2
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - done materializing entity [com.example.domain.BasisPoint#2]
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - resolving associations for [com.example.domain.BasisPoint#3]
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - adding entity to second-level cache [com.example.domain.BasisPoint#3]
1203 [main] DEBUG net.sf.hibernate.cache.ReadOnlyCache - Caching: 3
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - done materializing entity [com.example.domain.BasisPoint#3]
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - resolving associations for [com.example.domain.BasisPoint#4]
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - adding entity to second-level cache [com.example.domain.BasisPoint#4]
1203 [main] DEBUG net.sf.hibernate.cache.ReadOnlyCache - Caching: 4
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - done materializing entity [com.example.domain.BasisPoint#4]
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - resolving associations for [com.example.domain.BasisPoint#1]
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - adding entity to second-level cache [com.example.domain.BasisPoint#1]
1203 [main] DEBUG net.sf.hibernate.cache.ReadOnlyCache - Caching: 1
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - done materializing entity [com.example.domain.BasisPoint#1]
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - initializing non-lazy collections
1203 [main] DEBUG org.springframework.orm.hibernate.HibernateTemplate - Eagerly flushing Hibernate session
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - flushing session
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Flushing entities and processing referenced collections
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Processing unreferenced collections
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Scheduling collection removes/(re)creates/updates
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Flushed: 0 insertions, 0 updates, 0 deletions to 4 objects
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
1203 [main] DEBUG net.sf.hibernate.impl.Printer - listing entities:
1203 [main] DEBUG net.sf.hibernate.impl.Printer - com.example.domain.BasisPoint{value=thirdValue, name=third, id=3}
1203 [main] DEBUG net.sf.hibernate.impl.Printer - com.example.domain.BasisPoint{value=secondValue, name=second, id=2}
1203 [main] DEBUG net.sf.hibernate.impl.Printer - com.example.domain.BasisPoint{value=firstValue, name=New Value, id=1}
1203 [main] DEBUG net.sf.hibernate.impl.Printer - com.example.domain.BasisPoint{value=fourthValue, name=fourth, id=4}
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - executing flush
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - post flush
1203 [main] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Closing Hibernate session
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - closing session
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - disconnecting session
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - transaction completion
4
1203 [main] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Opening Hibernate session
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - opened session
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - loading [com.example.domain.BasisPoint#1]
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - attempting to resolve [com.example.domain.BasisPoint#1]
1203 [main] DEBUG net.sf.hibernate.cache.EhCache - key: 1
1203 [main] DEBUG net.sf.ehcache.store.MemoryStore - com.example.domain.BasisPointCache: MemoryStore hit for 1
1203 [main] DEBUG net.sf.hibernate.cache.ReadOnlyCache - Cache hit: 1
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - resolved object in second-level cache [com.example.domain.BasisPoint#1]
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Cached Version: null
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - initializing non-lazy collections
1203 [main] DEBUG org.springframework.orm.hibernate.HibernateTemplate - Eagerly flushing Hibernate session
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - flushing session
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Flushing entities and processing referenced collections
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Processing unreferenced collections
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Scheduling collection removes/(re)creates/updates
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Flushed: 0 insertions, 0 updates, 0 deletions to 1 objects
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
1203 [main] DEBUG net.sf.hibernate.impl.Printer - listing entities:
1203 [main] DEBUG net.sf.hibernate.impl.Printer - com.example.domain.BasisPoint{value=firstValue, name=New Value, id=1}
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - executing flush
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - post flush
1203 [main] DEBUG org.springframework.orm.hibernate.SessionFactoryUtils - Closing Hibernate session
1203 [main] DEBUG net.sf.hibernate.impl.SessionImpl - closing session
Id=1,name=New Value,value=firstValue
1203 [main] DEBUG org.springframework.jdbc.core.JdbcTemplate - Executing SQL statement [delete from BasisPoint]
1203 [main] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Opening JDBC connection
1203 [main] DEBUG org.springframework.jdbc.datasource.DataSourceUtils - Closing JDBC connection