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:
lt;?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?gt;
lt;beans xmlns=quot;schema/beansquot;
xmlns:xsi=quot;2001/XMLSchema-instancequot;
xmlns:tx=quot;schema/txquot;
xsi:schemaLocation=quot;schema/beans schem...-beans-2.5.xsd
schema/tx schema/tx/spring-tx-2.5.xsdquot;gt;lt;bean id=quot;sessionFactoryquot;
class=quot;org..orm.hibernate3.annotati on.AnnotationSessionFactoryBeanquot;gt;
lt;property name=quot;dataSourcequot; ref=quot;dataSourcequot; /gt;
lt;property name=quot;hibernatePropertiesquot;gt;
lt;propsgt;
lt;prop key=quot;hibernate.dialectquot;gt;${hibernate.dialect}lt;/propgt;
lt;prop key=quot;hibernate.hbm2ddl.autoquot;gt;${hibernate.hbm2ddl.a uto}lt;/propgt;
lt;prop key=quot;hibernate.transaction.factory_classquot;gt;${hibern ate.transaction.factory}lt;/propgt;
lt;prop key=quot;hibernate.show_sqlquot;gt;${hibernate.show_sql}lt;/propgt;
lt;prop key=quot;hibernate.connection.autocommitquot;gt;${hibernate. autocommit}lt;/propgt;
lt;prop key=quot;hibernate.current_session_context_classquot;gt;${hi bernate.session.context.class}lt;/propgt;
lt;!-- lt;prop key=quot;hibernate.cache.provider_classquot;gt;${hibernate.c ache.provider}lt;/propgt;
lt;prop key=quot;hibernate.cache.use_second_level_cachequot;gt;${hib ernate.cache.use_second_level_cache}lt;/propgt;
lt;prop key=quot;hibernate.cache.use_second_level_cachequot;gt;${hib ernate.cache.use_second_level_cache}lt;/propgt;
lt;prop key=quot;hibernate.cache.use_structured_entriesquot;gt;${hib ernate.cache.use_structured_entries}lt;/propgt; --gt;
lt;/propsgt;
lt;/propertygt;
lt;property name=quot;annotatedClassesquot;gt;
lt;listgt;
lt;valuegt;com.entity.Testlt;/valuegt;
lt;valuegt;com.entity.Userlt;/valuegt;
lt;valuegt;com.entity.Branchlt;/valuegt;
lt;valuegt;com.entity.Departmentlt;/valuegt;
lt;valuegt;com.entity.IssueTicketlt;/valuegt;
lt;valuegt;com.entity.ChangeLoglt;/valuegt;
lt;/listgt;
lt;/propertygt;
lt;/beangt;
lt;!-- The transaction manager --gt;
lt;bean id=quot;transactionManagerquot; depends-on=quot;sessionFactoryquot;
class=quot;org..orm.hibernate3.Hibernat eTransactionManagerquot;gt;
lt;property name=quot;sessionFactoryquot; ref=quot;sessionFactoryquot; /gt;
lt;/beangt;
lt;!-- We will use annotation based transactions. --gt;
lt;!-- lt;tx:annotation-driven transaction-manager=quot;transactionManagerquot; /gt; --gt;
lt;bean id=quot;sessionListenerTransactionTemplatequot; class=quot;org..transaction.support.Tra nsactionTemplatequot;gt;
lt;property name=quot;transactionManagerquot; ref=quot;transactionManagerquot; /gt;
lt;property name=quot;readOnlyquot; value=quot;falsequot; /gt;
lt;/beangt;
lt;/beansgt;
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! |