Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id CAD3E200ACA for ; Thu, 9 Jun 2016 12:12:39 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C9794160A58; Thu, 9 Jun 2016 10:12:39 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1C9EE160A2B for ; Thu, 9 Jun 2016 12:12:38 +0200 (CEST) Received: (qmail 80768 invoked by uid 500); 9 Jun 2016 10:12:38 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 80757 invoked by uid 99); 9 Jun 2016 10:12:38 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Jun 2016 10:12:38 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 7CAF71A0351 for ; Thu, 9 Jun 2016 10:12:37 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.299 X-Spam-Level: X-Spam-Status: No, score=0.299 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id F564cfPMFMmf for ; Thu, 9 Jun 2016 10:12:34 +0000 (UTC) Received: from mail-03.1984.is (mail-03.1984.is [93.95.224.70]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 6B2BF5F36F for ; Thu, 9 Jun 2016 10:12:34 +0000 (UTC) Received: from localhost by mail-03.1984.is with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.84) (envelope-from ) id 1bAwwt-00088s-WC for user@cayenne.apache.org; Thu, 09 Jun 2016 10:12:28 +0000 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: Ordering by date on a timestamp field From: Hugi Thordarson In-Reply-To: Date: Thu, 9 Jun 2016 10:12:22 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <068F24B1-D354-4075-A3B9-17905F0D6AF7@karlmenn.is> References: To: user@cayenne.apache.org X-Mailer: Apple Mail (2.3124) archived-at: Thu, 09 Jun 2016 10:12:40 -0000 Hi Frank, we solved this in one of our apps by creating a separate date-only = column in the DB and mapping it to java.time.LocalTime in our model = class. Then we just modified the setter for the dateTime value to also = set the date-only value. Cheers, - hugi // Hugi Thordarson // http://www.loftfar.is/ // s. 895-6688 > On 8. j=C3=BAn. 2016, at 20:49, Frank Herrmann = wrote: >=20 > Views in mysql do not take advantage of indexes. We would like to = avoid > views and would prefer a Cayenne solution. Also, having a view with a > formula is not very efficient, especially when dealing with hundreds = of > thousands of records. >=20 > -Frank >=20 > On Wed, Jun 8, 2016 at 4:42 PM, Adam Boyle = wrote: >=20 >> I can't speak to what Cayenne is able to do solely when using an >> ObjectQuery, but from a database perspective it sounds like you want = to be >> using a view that provides the date-only version of your datetime = column. >> Then you could query it just like a table and do your sort on the = date-only >> column. You can probably use the Query object type in your project = model to >> achieve this if you aren't keen on adding SQL objects to your model = outside >> of Cayenne Modeler. >>=20 >>=20 >> -Adam >>=20 >> ________________________________ >> From: Frank Herrmann >> Sent: Wednesday, June 8, 2016 4:07:44 PM >> To: user@cayenne.apache.org >> Subject: Ordering by date on a timestamp field >>=20 >> Hello all, >>=20 >> Is there a way in Cayenne, when adding an ordering to a query, to = order by >> only the date portion of a timestamp (including time) field? = Basically, the >> timestamp includes hour, minutes, seconds, etc. I only want to sort = on the >> date portion (month, day, year), or any other such criteria. >>=20 >> The reason for this is, if we include other fields to sort by, we = would >> want the second sort field to group on the date, not the full = timestamp. >>=20 >> Thanks, >>=20 >> -Frank >>=20 >> -- >> FRANK HERRMANN >> SOFTWARE ENGINEER >>=20 >> T: 561-880-2998 x1563 >>=20 >> E: frank.herrmann@modmed.com >>=20 >>=20 >>=20 >> [image: [ Modernizing Medicine ]] >> [image: [ Facebook ]] >> [image: >> [ LinkedIn ]] >> [image: >> [ YouTube ]] = [image: [ >> Twitter ]] [image: [ Blog ]] >> [image: [ Instagram ]] >> >>=20 >=20 >=20 >=20 > --=20 > FRANK HERRMANN > SOFTWARE ENGINEER >=20 > T: 561-880-2998 x1563 >=20 > E: frank.herrmann@modmed.com >=20 >=20 >=20 > [image: [ Modernizing Medicine ]] > [image: [ Facebook ]] = [image: > [ LinkedIn ]] = [image: > [ YouTube ]] [image: = [ > Twitter ]] [image: [ Blog ]] > [image: [ Instagram ]] >