-->
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.  [ 1 post ] 
Author Message
 Post subject: EJB3 comparing Date and Timestamp
PostPosted: Thu Dec 14, 2006 6:20 pm 
Newbie

Joined: Tue Jan 11, 2005 12:58 pm
Posts: 15
I have a ejb3 entity bean with the following property with an oracle database

Code:
    @Column(name = "UPDTIME")
    @Temporal(TemporalType.TIMESTAMP)
    private Date updtime;


The actual database column is a DATE field.

I am trying to find the sum all entities that occurred today with the following HQL
Code:
Query query = entityManager.createQuery("select sum(u.topupAmt) from TransactionTable u where u.updtime=?");
            query.setParameter(1, new Date(Utilities.currentTime()));


but it keeps returning multiple records. My assumption is that it is finding many timestamps instead of one date.

How can this be solved?


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

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.