cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aristedes Maniatis <...@maniatis.org>
Subject Re: Copy/Clone Mutable Objects?
Date Mon, 08 Sep 2014 07:39:45 GMT
And https://github.com/ThreeTen/threetenbp for Java 6/7 users.

Ari


On 8/09/2014 4:42pm, Andrus Adamchik wrote:
> 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 <johnthuss@gmail.com> wrote:
> 
>> Sure, use Joda time.
>> On Sep 6, 2014 8:15 PM, "Michael Gentry" <mgentry@masslight.net> wrote:
>>
>>> Is that a realistic option?
>>>
>>>
>>> On Sat, Sep 6, 2014 at 6:55 PM, John Huss <johnthuss@gmail.com> wrote:
>>>
>>>> My thoughts are: don't use Date.
>>>> On Sep 6, 2014 4:58 PM, "Michael Gentry" <mgentry@masslight.net> 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
>>>>>
>>>>
>>>
> 

-- 
-------------------------->
Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Mime
View raw message