cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Gentry <mgen...@masslight.net>
Subject Copy/Clone Mutable Objects?
Date Sat, 06 Sep 2014 21:57:20 GMT
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message