Hi,
I am with a date problem with Hibernate. There are no exceptions and the code works fine!
The problem is:
1. If I have the following date stored in the database: 2007-10-10 08:10:22.
2. When I run a HQL query, this date is added 3 hours. The date will be 2007-10-10 11:10:22.
I already have tested with MySQL and Firefox and the problem persists.
Could be a configuration issue? Database and Tomcat server is running at same machine.
Below is my sample code:
Code:
...
@Column(name="PAGDATACRIACAO", nullable=false)
private Date createdDate;
...
Code:
@SuppressWarnings("unchecked")
public List<Page> findPages(boolean visible, String order, String key) {
List list;
String str_query = "select p from Page p where p.visible = :visible and (p.name like :key or p.title like :key)";
str_query+=" order by p."+order;
try {
Session session = getSession(false);
Query query = session.createQuery(str_query);
query.setParameter("visible", visible);
query.setParameter("key", "%"+key+"%");
list = query.list();
} catch (HibernateException e) {
throw convertHibernateAccessException(e);
}
return list;
}
Thanks in advance!!!
Claudiney