Return-Path: X-Original-To: apmail-cayenne-dev-archive@www.apache.org Delivered-To: apmail-cayenne-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 324C311FA6 for ; Mon, 8 Sep 2014 06:42:43 +0000 (UTC) Received: (qmail 39719 invoked by uid 500); 8 Sep 2014 06:42:43 -0000 Delivered-To: apmail-cayenne-dev-archive@cayenne.apache.org Received: (qmail 39697 invoked by uid 500); 8 Sep 2014 06:42:43 -0000 Mailing-List: contact dev-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cayenne.apache.org Delivered-To: mailing list dev@cayenne.apache.org Received: (qmail 39686 invoked by uid 99); 8 Sep 2014 06:42:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Sep 2014 06:42:42 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [208.78.103.231] (HELO vorsha.objectstyle.org) (208.78.103.231) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 08 Sep 2014 06:42:17 +0000 Received: (qmail 6646 invoked from network); 8 Sep 2014 07:00:10 -0000 Received: from unknown (HELO ?192.168.1.68?) (212.98.191.4) by vorsha.objectstyle.org with SMTP; 8 Sep 2014 07:00:10 -0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: Copy/Clone Mutable Objects? From: Andrus Adamchik In-Reply-To: Date: Mon, 8 Sep 2014 09:42:13 +0300 Content-Transfer-Encoding: 7bit Message-Id: References: To: dev@cayenne.apache.org X-Mailer: Apple Mail (2.1878.6) X-Virus-Checked: Checked by ClamAV on apache.org Also Java 8 Date and Time if Java 8 is an option: http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html Andrus On Sep 8, 2014, at 4:17 AM, John Huss wrote: > Sure, use Joda time. > On Sep 6, 2014 8:15 PM, "Michael Gentry" wrote: > >> Is that a realistic option? >> >> >> On Sat, Sep 6, 2014 at 6:55 PM, John Huss wrote: >> >>> My thoughts are: don't use Date. >>> On Sep 6, 2014 4:58 PM, "Michael Gentry" wrote: >>> >>>> Should Cayenne copy/clone mutable objects, such as Date? >>>> >>>> For example, if I modify a date after setting it in a Cayenne object >>>> (person), it modifies the value stored by Cayenne: >>>> >>>> SimpleDateFormat timeFormat = new SimpleDateFormat ("yyyy-MM-dd"); >>>> Date d1 = timeFormat.parse("2014-02-01"); >>>> person.setStartDate(d1); >>>> d1.setYear(2013 - 1900); // Date hackery >>>> System.out.println("Start Date = " + person.getStartDate()); >>>> >>>> This outputs: >>>> >>>> Start Date = Fri Feb 01 00:00:00 EST 2013 >>>> >>>> I've never actually experienced an issue with Cayenne not copying a >>>> Date/etc, but was wondering your thoughts on this. >>>> >>>> Thanks, >>>> >>>> mrg >>>> >>> >>