These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: My HQL return all date fields with more 3 hours added
PostPosted: Fri Nov 02, 2007 9:46 am 
Newbie

Joined: Fri Nov 02, 2007 9:27 am
Posts: 5
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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 05, 2007 6:48 am 
Newbie

Joined: Fri Nov 02, 2007 9:27 am
Posts: 5
Hi,

Please, Someone could help me? There are some reason for this problem?

Thanks!!!

Claudiney


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.