-
May 18th, 2009, 02:05 AM
#1
Hibernate MySql Timestamp Inconsistency
Hi all, please help me with my problem. The scenario is in the mysql table the time for data creation is say for example 11Am. When I retrieve it to my POJO the created on time advances and becomes 11Pm.
What would be the possible approaches for this problem?
Here is my hibernate.xml together with the properties:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schem...-beans-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotati on.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.a uto}</prop>
<prop key="hibernate.transaction.factory_class">${hibern ate.transaction.factory}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.connection.autocommit">${hibernate. autocommit}</prop>
<prop key="hibernate.current_session_context_class">${hi bernate.session.context.class}</prop>
<!-- <prop key="hibernate.cache.provider_class">${hibernate.c ache.provider}</prop>
<prop key="hibernate.cache.use_second_level_cache">${hib ernate.cache.use_second_level_cache}</prop>
<prop key="hibernate.cache.use_second_level_cache">${hib ernate.cache.use_second_level_cache}</prop>
<prop key="hibernate.cache.use_structured_entries">${hib ernate.cache.use_structured_entries}</prop> -->
</props>
</property>
<property name="annotatedClasses">
<list>
<value>com.entity.Test</value>
<value>com.entity.User</value>
<value>com.entity.Branch</value>
<value>com.entity.Department</value>
<value>com.entity.IssueTicket</value>
<value>com.entity.ChangeLog</value>
</list>
</property>
</bean>
<!-- The transaction manager -->
<bean id="transactionManager" depends-on="sessionFactory"
class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- We will use annotation based transactions. -->
<!-- <tx:annotation-driven transaction-manager="transactionManager" /> -->
<bean id="sessionListenerTransactionTemplate" class="org.springframework.transaction.support.Tra nsactionTemplate">
<property name="transactionManager" ref="transactionManager" />
<property name="readOnly" value="false" />
</bean>
</beans>
hibernate.hbm2ddl.auto=update
hibernate.show_sql=true
hibernate.cache.provider_class=org.hibernate.cache .EhCacheProvider
net.sf.ehcache.configurationResourceName=/ehcache.xml
hibernate.session.context.class=thread
hibernate.autocommit=true
hibernate.transaction.factory=org.hibernate.transa ction.JDBCTransactionFactory
hibernate.cache.provider=org.hibernate.cache.NoCac heProvider
hibernate.cache.use_second_level_cache=false
hibernate.cache.use_structured_entries=false
hibernate.dialect=org.hibernate.dialect.MySQLDiale ct
Thanks all!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules