Announcement Announcement Module
Collapse
No announcement yet.
hibernate criteria for a time range seach on a Date field Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • hibernate criteria for a time range seach on a Date field

    I have an object with a Date attribute (corresponding to a column in a table in a postgres db of type timestamp). I want to write a hibernate criteria that returns all matches within a time range independent of the date. For example, give me all matches that have a time between 2 and 4pm on any date.

    Any suggestions on building the correct hibernate criteria?

  • #2
    How does the question relate to spring data access (current forum name)?

    Comment


    • #3
      Originally posted by WarwickBaker View Post
      I have an object with a Date attribute (corresponding to a column in a table in a postgres db of type timestamp). I want to write a hibernate criteria that returns all matches within a time range independent of the date. For example, give me all matches that have a time between 2 and 4pm on any date.

      Any suggestions on building the correct hibernate criteria?
      Hi Warwick,

      I did not know postgres, but when I have similar problems ( queries that I do not know how to create the criteria ) I wrote then in sql, test it in some db client and then try to transform the query in some criterias. If not able to do it ( transform for criteria, maybe some especific db function ) then I create a named query to solve it.

      But I also thing that this is not a Hibernate forum. Sorry if Im causing trouble answering this.

      Regards

      Leo

      Comment


      • #4
        Leo,

        Thanks for the help, I appreciate it. I know this is not the hibernate forum but have always found the spring forums full of people willing to help.

        Dennis, yes current forum name landed me here, and yes I am doing this within the context of a spring based dao framework, and if you don't think it appropriate I posted here thats fine, I'll take my pill and move on.

        Comment

        Working...
        X