1. Configure sessionFactory in applicationContext.xml to use second level cache:
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan" value="pl.mkrajewski.test.cache" />
<property name="hibernateProperties">
<props>
...
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</prop>
</props>
</property>
</bean>
2. Entities to save:
cache version:
@Entity
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Table(name = "SLO_MKRAJEWSKI")
public class CacheMkrajewski {
private Long id;
@Id
@Column(name = "COLUMN2", nullable = false, precision = 10, scale = 0)
@SequenceGenerator(name = "seq_mkrajewski", sequenceName = "seq_mkrajewski", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_mkrajewski")
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
private Date dataOd;
@Temporal(TemporalType.DATE)
@Column(name = "COLUMN1")
public Date getDataOd() {
return this.dataOd;
}
public void setDataOd(Date dataOd) {
this.dataOd = dataOd;
}
@Override
public String toString() {
return "CacheMkrajewski [id=" + this.id + ", dataOd=" + this.dataOd + "]";
}
}
no cache version:
@Entity
@Table(name = "SLO_MKRAJEWSKI")
public class NoCacheMkrajewski {
private Long id;
@Id
@Column(name = "COLUMN2", nullable = false, precision = 10, scale = 0)
@SequenceGenerator(name = "seq_mkrajewski", sequenceName = "seq_mkrajewski", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_mkrajewski")
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
private Date dataOd;
@Temporal(TemporalType.DATE)
@Column(name = "COLUMN1")
public Date getDataOd() {
return this.dataOd;
}
public void setDataOd(Date dataOd) {
this.dataOd = dataOd;
}
@Override
public String toString() {
return "NoCacheMkrajewski [id=" + this.id + ", dataOd=" + this.dataOd + "]";
}
}
you can see that difference is only in removing @Cache adnotation for no cache class definition
3. Injecting sessionFactory in DAO:
@Autowired
private SessionFactory sessionFactory;
private Session getSession() {
return this.sessionFactory.getCurrentSession();
}
4. Creating model in DAO:
cache version
public void save(CacheMkrajewski model) {
getSession().persist(model);
}
or no cache version:
public void save(NoCacheMkrajewski model) {
getSession().persist(model);
}
same way
5. Loading model in DAO:
cache version
public CacheMkrajewski loadCache(Long id) {
return (CacheMkrajewski) getSession().get(CacheMkrajewski.class, id);
}
no cache version
public NoCacheMkrajewski loadNoCache(Long id) {
return (NoCacheMkrajewski) getSession().get(NoCacheMkrajewski.class, id);
}
6. Injection DAO in business layer:
business interface
public interface ITestBusiness {
CacheMkrajewski loadCache(Long id);
void save(CacheMkrajewski model);
NoCacheMkrajewski loadNoCache(Long id);
void save(NoCacheMkrajewski model);
}
Business impl
@Component
@Transactional
public class TestBusiness implements ITestBusiness {
@Autowired
private TestDao dao;
@Override
public CacheMkrajewski loadCache(Long id) {
return this.dao.loadCache(id);
}
@Override
public void save(CacheMkrajewski model) {
this.dao.save(model);
}
@Override
public NoCacheMkrajewski loadNoCache(Long id) {
return this.dao.loadNoCache(id);
}
@Override
public void save(NoCacheMkrajewski model) {
this.dao.save(model);
}
}
7. invoke JUnit
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:/mkrajewski/applicationContext-cache.xml" })
public class DateCacheTest {
@Autowired
private ITestBusiness testBusiness;
@Before
public void before() {
}
@Test
public void cacheTest() {
CacheMkrajewski cached = cacheEntity();
this.testBusiness.save(cached);
cached = this.testBusiness.loadCache(cached.getId());
CacheMkrajewski loaded = this.testBusiness.loadCache(61L);
System.out.println();
System.out.println("Cache " + cached);
System.out.println("Loaded " + loaded);
System.out.println();
}
@Test
public void noCacheTest() {
NoCacheMkrajewski noCached = noCacheEntity();
this.testBusiness.save(noCached);
noCached = this.testBusiness.loadNoCache(noCached.getId());
NoCacheMkrajewski loaded = this.testBusiness.loadNoCache(61L);
System.out.println();
System.out.println("No cache " + noCached);
System.out.println("Loaded " + loaded);
System.out.println();
}
private CacheMkrajewski cacheEntity() {
CacheMkrajewski cache = new CacheMkrajewski();
cache.setDataOd(dateWithNoTime());
return cache;
}
private NoCacheMkrajewski noCacheEntity() {
NoCacheMkrajewski noCache = new NoCacheMkrajewski();
noCache.setDataOd(dateWithNoTime());
return noCache;
}
private Date dateWithNoTime() {
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.set(Calendar.YEAR, 2014);
calendar.set(Calendar.MONTH, 10);
calendar.set(Calendar.DAY_OF_MONTH, 20);
return calendar.getTime();
}
}
we can assume that in database exists object with ID 61
8. Differences in System.outs - toString() difference:
cache version
Cache CacheMkrajewski [id=130, dataOd=Thu Nov 20 00:00:00 CET 2014]
Loaded CacheMkrajewski [id=61, dataOd=2014-11-20]
no cache version
No cache NoCacheMkrajewski [id=131, dataOd=2014-11-20]
Loaded NoCacheMkrajewski [id=61, dataOd=2014-11-20]
When we read object created in the same session using second level cache - there is problem with date object. In new object minutes, seconds and CEST is added. When read object created in previous session (id 61) problem disappear.
Problem does not exists if we use entity with disabled @Cache
9. Full date objects from eclipse DEBUGGER:
CACHE OBJECT
"dataOd Date (id=72) " Thu Nov 20 00:00:00 CET 2014
" cdate Gregorian$Date (id=82) " 2014-11-20T00:00:00.000+0100
" cachedFixedDateJan1 735234 " 735234
" cachedFixedDateNextJan1 735599 " 735599
" cachedYear 2014 " 2014
" daylightSaving 0 " 0
" dayOfMonth 20 " 20
" dayOfWeek 5 " 5
" era null " null
" forceStandardTime false " FALSE
" fraction 0 " 0
" hours 0 " 0
" leapYear false " FALSE
" locale null " null
" millis 0 " 0
" minutes 0 " 0
" month 11 " 11
" normalized true " TRUE
" seconds 0 " 0
" year 2014 " 2014
" zoneinfo ZoneInfo (id=86) " sun.util.calendar.ZoneInfo[id="Europe/Warsaw",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=165,lastRule=java.util.SimpleTimeZone[id=Europe/Warsaw,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]]
" checksum -1578751392 " -1578751392
" dirty false " FALSE
" dstSavings 3600000 " 3600000
" ID ""Europe/Warsaw"" (id=92) " Europe/Warsaw
" count 13 " 13
" hash 826225934 " 826225934
" offset 0 " 0
" value (id=100) " [E, u, r, o, p, e, /, W, a, r, s, a, w]
" [0] E " E
" [1] u " u
" [2] r " r
" [3] o " o
" [4] p " p
" [5] e " e
" [6] / " /
" [7] W " W
" [8] a " a
" [9] r " r
" [10] s " s
" [11] a " a
" [12] w " w
" lastRule null " null
" offsets (id=95) " [3600000, 5040000, 7200000, 3600000, 10800000]
" [0] 3600000 " 3600000
" [1] 5040000 " 5040000
" [2] 7200000 " 7200000
" [3] 3600000 " 3600000
" [4] 10800000 " 10800000
" rawOffset 3600000 " 3600000
" rawOffsetDiff 0 " 0
" simpleTimeZoneParams (id=97) " [2, -1, 1, 3600000, 2, 9, -1, 1, 3600000, 2]
" [0] 2 " 2
" [1] -1 " -1
" [2] 1 " 1
" [3] 3600000 " 3600000
" [4] 2 " 2
" [5] 9 " 9
" [6] -1 " -1
" [7] 1 " 1
" [8] 3600000 " 3600000
" [9] 2 " 2
" transitions (id=98) " [-9048018124799999, -7032964055040000, -6937421414399950, -6883260825600000, -6813514137599950, -6759014400000000, -6684696575999950, -6630196838399998, -6555539865599948, -6501040127999998, -6151068057600000, -3816382463999950, -3511325491200000, -3459303014399950, -3392416972800000, -3328008191999950, -3262906368000000, -3189664972799950, -3123855360000000, -3065801932799950, -3003487027200000, -2929523097599950, -2875023360000000, -2805660057599950, -2746205798400000, -2679319756799950, -2617388236800000, -1626498662399950, -1584385228800000, -1519976447999950, -1455567667200000, -1368863539199950, -1324272844800000, -1259864063999950, -1195455283200000, -1111228415999950, -1066637721600000, -982410854399950, -937820160000000, -853593292799950, -809002598400000, -722298470399950, -680185036800000, 937466265600050, 999397785600000, 1066283827200050, 1130692608000000, 1195101388800050, 1259510169600000, 1326396211200050, 1388327731200000, 1452736512000050, 1517145292800000, 1581554073600050, 1645962854400000, 1710371635200050, 1774780416000000, 1839189196800050, 1906075238400000, 1970484019200050, 2034892800000000, 2099301580800050, 2163710361600000, 2228119142400050, 2292527923200000, 2356951449600050, 2421360230400000, 2485769011200050, 2550177792000000, 2614586572800050, 2681472614400000, 2745881395200050, 2810290176000000, 2874698956800050, 2939107737600000, 3003516518400050, 3067925299200000, 3132334080000050, 3196742860800000, 3261151641600050, 3325560422400000, 3392446464000050, 3466764288000000, 3521264025600050, 3595581849600000, 3650081587200050, 3724399411200000, 3778899148800050, 3855694233600000, 3907716710400050, 3984511795200000, 4036534272000050, 4113329356800000, 4167829094400050, 4242146918400000, 4296646656000050, 4370964480000000, 4425464217600050, 4502259302400000, 4554281779200050, 4631076864000000, 4683099340800050, 4759894425600000, 4811916902400050, 4888711987200000, 4943211724800050, 5017529548800000, 5072029286400050, 5146347110400000, 5200846848000050, 5277641932800000, 5329664409600050, 5406459494400000, 5458481971200050, 5535277056000000, 5589776793600050, 5664094617600000, 5718594355200050, 5792912179200000, 5847411916800050, 5921729740800000, 5976229478400050, 6053024563200000, 6105047040000050, 6181842124800000, 6233864601600050, 6310659686400000, 6365159424000050, 6439477248000000, 6493976985600050, 6568294809600000, 6622794547200050, 6699589632000000, 6751612108800050, 6828407193600000, 6880429670400050, 6957224755200000, 7011724492800050, 7086042316800000, 7140542054400050, 7214859878400000, 7269359616000050, 7343677440000000, 7398177177600050, 7474972262400000, 7526994739200050, 7603789824000000, 7655812300800050, 7732607385600000, 7787107123200050, 7861424947200000, 7915924684800050, 7990242508800000, 8044742246400050, 8121537331200000, 8173559808000050, 8250354892800000, 8302377369600050, 8379172454400000, 8431194931200050, 8507990016000000, 8562489753600050, 8636807577600000, 8691307315200050, 8765625139200000]
" [0...99] "
" [0] -9048018124799999 " -9048018124800000
" [1] -7032964055040000 " -7032964055040000
" [2] -6937421414399950 " -6937421414399950
" [3] -6883260825600000 " -6883260825600000
" [4] -6813514137599950 " -6813514137599950
" [5] -6759014400000000 " -6759014400000000
" [6] -6684696575999950 " -6684696575999950
" [7] -6630196838399998 " -6630196838400000
" [8] -6555539865599948 " -6555539865599950
" [9] -6501040127999998 " -6501040128000000
" [10] -6151068057600000 " -6151068057600000
" [11] -3816382463999950 " -3816382463999950
" [12] -3511325491200000 " -3511325491200000
" [13] -3459303014399950 " -3459303014399950
" [14] -3392416972800000 " -3392416972800000
" [15] -3328008191999950 " -3328008191999950
" [16] -3262906368000000 " -3262906368000000
" [17] -3189664972799950 " -3189664972799950
" [18] -3123855360000000 " -3123855360000000
" [19] -3065801932799950 " -3065801932799950
" [20] -3003487027200000 " -3003487027200000
" [21] -2929523097599950 " -2929523097599950
" [22] -2875023360000000 " -2875023360000000
" [23] -2805660057599950 " -2805660057599950
" [24] -2746205798400000 " -2746205798400000
" [25] -2679319756799950 " -2679319756799950
" [26] -2617388236800000 " -2617388236800000
" [27] -1626498662399950 " -1626498662399950
" [28] -1584385228800000 " -1584385228800000
" [29] -1519976447999950 " -1519976447999950
" [30] -1455567667200000 " -1455567667200000
" [31] -1368863539199950 " -1368863539199950
" [32] -1324272844800000 " -1324272844800000
" [33] -1259864063999950 " -1259864063999950
" [34] -1195455283200000 " -1195455283200000
" [35] -1111228415999950 " -1111228415999950
" [36] -1066637721600000 " -1066637721600000
" [37] -982410854399950 " -982410854399950
" [38] -937820160000000 " -937820160000000
" [39] -853593292799950 " -853593292799950
" [40] -809002598400000 " -809002598400000
" [41] -722298470399950 " -722298470399950
" [42] -680185036800000 " -680185036800000
" [43] 937466265600050 " 937466265600050
" [44] 999397785600000 " 999397785600000
" [45] 1066283827200050 " 1066283827200050
" [46] 1130692608000000 " 1130692608000000
" [47] 1195101388800050 " 1195101388800050
" [48] 1259510169600000 " 1259510169600000
" [49] 1326396211200050 " 1326396211200050
" [50] 1388327731200000 " 1388327731200000
" [51] 1452736512000050 " 1452736512000050
" [52] 1517145292800000 " 1517145292800000
" [53] 1581554073600050 " 1581554073600050
" [54] 1645962854400000 " 1645962854400000
" [55] 1710371635200050 " 1710371635200050
" [56] 1774780416000000 " 1774780416000000
" [57] 1839189196800050 " 1839189196800050
" [58] 1906075238400000 " 1906075238400000
" [59] 1970484019200050 " 1970484019200050
" [60] 2034892800000000 " 2034892800000000
" [61] 2099301580800050 " 2099301580800050
" [62] 2163710361600000 " 2163710361600000
" [63] 2228119142400050 " 2228119142400050
" [64] 2292527923200000 " 2292527923200000
" [65] 2356951449600050 " 2356951449600050
" [66] 2421360230400000 " 2421360230400000
" [67] 2485769011200050 " 2485769011200050
" [68] 2550177792000000 " 2550177792000000
" [69] 2614586572800050 " 2614586572800050
" [70] 2681472614400000 " 2681472614400000
" [71] 2745881395200050 " 2745881395200050
" [72] 2810290176000000 " 2810290176000000
" [73] 2874698956800050 " 2874698956800050
" [74] 2939107737600000 " 2939107737600000
" [75] 3003516518400050 " 3003516518400050
" [76] 3067925299200000 " 3067925299200000
" [77] 3132334080000050 " 3132334080000050
" [78] 3196742860800000 " 3196742860800000
" [79] 3261151641600050 " 3261151641600050
" [80] 3325560422400000 " 3325560422400000
" [81] 3392446464000050 " 3392446464000050
" [82] 3466764288000000 " 3466764288000000
" [83] 3521264025600050 " 3521264025600050
" [84] 3595581849600000 " 3595581849600000
" [85] 3650081587200050 " 3650081587200050
" [86] 3724399411200000 " 3724399411200000
" [87] 3778899148800050 " 3778899148800050
" [88] 3855694233600000 " 3855694233600000
" [89] 3907716710400050 " 3907716710400050
" [90] 3984511795200000 " 3984511795200000
" [91] 4036534272000050 " 4036534272000050
" [92] 4113329356800000 " 4113329356800000
" [93] 4167829094400050 " 4167829094400050
" [94] 4242146918400000 " 4242146918400000
" [95] 4296646656000050 " 4296646656000050
" [96] 4370964480000000 " 4370964480000000
" [97] 4425464217600050 " 4425464217600050
" [98] 4502259302400000 " 4502259302400000
" [99] 4554281779200050 " 4554281779200050
" [100...164] "
" [100] 4631076864000000 " 4631076864000000
" [101] 4683099340800050 " 4683099340800050
" [102] 4759894425600000 " 4759894425600000
" [103] 4811916902400050 " 4811916902400050
" [104] 4888711987200000 " 4888711987200000
" [105] 4943211724800050 " 4943211724800050
" [106] 5017529548800000 " 5017529548800000
" [107] 5072029286400050 " 5072029286400050
" [108] 5146347110400000 " 5146347110400000
" [109] 5200846848000050 " 5200846848000050
" [110] 5277641932800000 " 5277641932800000
" [111] 5329664409600050 " 5329664409600050
" [112] 5406459494400000 " 5406459494400000
" [113] 5458481971200050 " 5458481971200050
" [114] 5535277056000000 " 5535277056000000
" [115] 5589776793600050 " 5589776793600050
" [116] 5664094617600000 " 5664094617600000
" [117] 5718594355200050 " 5718594355200050
" [118] 5792912179200000 " 5792912179200000
" [119] 5847411916800050 " 5847411916800050
" [120] 5921729740800000 " 5921729740800000
" [121] 5976229478400050 " 5976229478400050
" [122] 6053024563200000 " 6053024563200000
" [123] 6105047040000050 " 6105047040000050
" [124] 6181842124800000 " 6181842124800000
" [125] 6233864601600050 " 6233864601600050
" [126] 6310659686400000 " 6310659686400000
" [127] 6365159424000050 " 6365159424000050
" [128] 6439477248000000 " 6439477248000000
" [129] 6493976985600050 " 6493976985600050
" [130] 6568294809600000 " 6568294809600000
" [131] 6622794547200050 " 6622794547200050
" [132] 6699589632000000 " 6699589632000000
" [133] 6751612108800050 " 6751612108800050
" [134] 6828407193600000 " 6828407193600000
" [135] 6880429670400050 " 6880429670400050
" [136] 6957224755200000 " 6957224755200000
" [137] 7011724492800050 " 7011724492800050
" [138] 7086042316800000 " 7086042316800000
" [139] 7140542054400050 " 7140542054400050
" [140] 7214859878400000 " 7214859878400000
" [141] 7269359616000050 " 7269359616000050
" [142] 7343677440000000 " 7343677440000000
" [143] 7398177177600050 " 7398177177600050
" [144] 7474972262400000 " 7474972262400000
" [145] 7526994739200050 " 7526994739200050
" [146] 7603789824000000 " 7603789824000000
" [147] 7655812300800050 " 7655812300800050
" [148] 7732607385600000 " 7732607385600000
" [149] 7787107123200050 " 7787107123200050
" [150] 7861424947200000 " 7861424947200000
" [151] 7915924684800050 " 7915924684800050
" [152] 7990242508800000 " 7990242508800000
" [153] 8044742246400050 " 8044742246400050
" [154] 8121537331200000 " 8121537331200000
" [155] 8173559808000050 " 8173559808000050
" [156] 8250354892800000 " 8250354892800000
" [157] 8302377369600050 " 8302377369600050
" [158] 8379172454400000 " 8379172454400000
" [159] 8431194931200050 " 8431194931200050
" [160] 8507990016000000 " 8507990016000000
" [161] 8562489753600050 " 8562489753600050
" [162] 8636807577600000 " 8636807577600000
" [163] 8691307315200050 " 8691307315200050
" [164] 8765625139200000 " 8765625139200000
" willGMTOffsetChange false " FALSE
" zoneOffset 3600000 " 3600000
" fastTime 1416438000000 " 1416438000000
NO CACHE OBJECT
"dataOd Date (id=123) " 2014-11-20
" cdate Gregorian$Date (id=129) " 2014-11-20T00:00:00.000+0100
" cachedFixedDateJan1 735234 " 735234
" cachedFixedDateNextJan1 735599 " 735599
" cachedYear 2014 " 2014
" daylightSaving 0 " 0
" dayOfMonth 20 " 20
" dayOfWeek 5 " 5
" era null " null
" forceStandardTime false " FALSE
" fraction 0 " 0
" hours 0 " 0
" leapYear false " FALSE
" locale null " null
" millis 0 " 0
" minutes 0 " 0
" month 11 " 11
" normalized true " TRUE
" seconds 0 " 0
" year 2014 " 2014
" zoneinfo ZoneInfo (id=86) " sun.util.calendar.ZoneInfo[id="Europe/Warsaw",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=165,lastRule=java.util.SimpleTimeZone[id=Europe/Warsaw,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]]
" checksum -1578751392 " -1578751392
" dirty false " FALSE
" dstSavings 3600000 " 3600000
" ID ""Europe/Warsaw"" (id=92) " Europe/Warsaw
" count 13 " 13
" hash 826225934 " 826225934
" offset 0 " 0
" value (id=100) " [E, u, r, o, p, e, /, W, a, r, s, a, w]
" [0] E " E
" [1] u " u
" [2] r " r
" [3] o " o
" [4] p " p
" [5] e " e
" [6] / " /
" [7] W " W
" [8] a " a
" [9] r " r
" [10] s " s
" [11] a " a
" [12] w " w
" lastRule null " null
" offsets (id=95) " [3600000, 5040000, 7200000, 3600000, 10800000]
" [0] 3600000 " 3600000
" [1] 5040000 " 5040000
" [2] 7200000 " 7200000
" [3] 3600000 " 3600000
" [4] 10800000 " 10800000
" rawOffset 3600000 " 3600000
" rawOffsetDiff 0 " 0
" simpleTimeZoneParams (id=97) " [2, -1, 1, 3600000, 2, 9, -1, 1, 3600000, 2]
" [0] 2 " 2
" [1] -1 " -1
" [2] 1 " 1
" [3] 3600000 " 3600000
" [4] 2 " 2
" [5] 9 " 9
" [6] -1 " -1
" [7] 1 " 1
" [8] 3600000 " 3600000
" [9] 2 " 2
" transitions (id=98) " [-9048018124799999, -7032964055040000, -6937421414399950, -6883260825600000, -6813514137599950, -6759014400000000, -6684696575999950, -6630196838399998, -6555539865599948, -6501040127999998, -6151068057600000, -3816382463999950, -3511325491200000, -3459303014399950, -3392416972800000, -3328008191999950, -3262906368000000, -3189664972799950, -3123855360000000, -3065801932799950, -3003487027200000, -2929523097599950, -2875023360000000, -2805660057599950, -2746205798400000, -2679319756799950, -2617388236800000, -1626498662399950, -1584385228800000, -1519976447999950, -1455567667200000, -1368863539199950, -1324272844800000, -1259864063999950, -1195455283200000, -1111228415999950, -1066637721600000, -982410854399950, -937820160000000, -853593292799950, -809002598400000, -722298470399950, -680185036800000, 937466265600050, 999397785600000, 1066283827200050, 1130692608000000, 1195101388800050, 1259510169600000, 1326396211200050, 1388327731200000, 1452736512000050, 1517145292800000, 1581554073600050, 1645962854400000, 1710371635200050, 1774780416000000, 1839189196800050, 1906075238400000, 1970484019200050, 2034892800000000, 2099301580800050, 2163710361600000, 2228119142400050, 2292527923200000, 2356951449600050, 2421360230400000, 2485769011200050, 2550177792000000, 2614586572800050, 2681472614400000, 2745881395200050, 2810290176000000, 2874698956800050, 2939107737600000, 3003516518400050, 3067925299200000, 3132334080000050, 3196742860800000, 3261151641600050, 3325560422400000, 3392446464000050, 3466764288000000, 3521264025600050, 3595581849600000, 3650081587200050, 3724399411200000, 3778899148800050, 3855694233600000, 3907716710400050, 3984511795200000, 4036534272000050, 4113329356800000, 4167829094400050, 4242146918400000, 4296646656000050, 4370964480000000, 4425464217600050, 4502259302400000, 4554281779200050, 4631076864000000, 4683099340800050, 4759894425600000, 4811916902400050, 4888711987200000, 4943211724800050, 5017529548800000, 5072029286400050, 5146347110400000, 5200846848000050, 5277641932800000, 5329664409600050, 5406459494400000, 5458481971200050, 5535277056000000, 5589776793600050, 5664094617600000, 5718594355200050, 5792912179200000, 5847411916800050, 5921729740800000, 5976229478400050, 6053024563200000, 6105047040000050, 6181842124800000, 6233864601600050, 6310659686400000, 6365159424000050, 6439477248000000, 6493976985600050, 6568294809600000, 6622794547200050, 6699589632000000, 6751612108800050, 6828407193600000, 6880429670400050, 6957224755200000, 7011724492800050, 7086042316800000, 7140542054400050, 7214859878400000, 7269359616000050, 7343677440000000, 7398177177600050, 7474972262400000, 7526994739200050, 7603789824000000, 7655812300800050, 7732607385600000, 7787107123200050, 7861424947200000, 7915924684800050, 7990242508800000, 8044742246400050, 8121537331200000, 8173559808000050, 8250354892800000, 8302377369600050, 8379172454400000, 8431194931200050, 8507990016000000, 8562489753600050, 8636807577600000, 8691307315200050, 8765625139200000]
" [0...99] "
" [0] -9048018124799999 " -9048018124800000
" [1] -7032964055040000 " -7032964055040000
" [2] -6937421414399950 " -6937421414399950
" [3] -6883260825600000 " -6883260825600000
" [4] -6813514137599950 " -6813514137599950
" [5] -6759014400000000 " -6759014400000000
" [6] -6684696575999950 " -6684696575999950
" [7] -6630196838399998 " -6630196838400000
" [8] -6555539865599948 " -6555539865599950
" [9] -6501040127999998 " -6501040128000000
" [10] -6151068057600000 " -6151068057600000
" [11] -3816382463999950 " -3816382463999950
" [12] -3511325491200000 " -3511325491200000
" [13] -3459303014399950 " -3459303014399950
" [14] -3392416972800000 " -3392416972800000
" [15] -3328008191999950 " -3328008191999950
" [16] -3262906368000000 " -3262906368000000
" [17] -3189664972799950 " -3189664972799950
" [18] -3123855360000000 " -3123855360000000
" [19] -3065801932799950 " -3065801932799950
" [20] -3003487027200000 " -3003487027200000
" [21] -2929523097599950 " -2929523097599950
" [22] -2875023360000000 " -2875023360000000
" [23] -2805660057599950 " -2805660057599950
" [24] -2746205798400000 " -2746205798400000
" [25] -2679319756799950 " -2679319756799950
" [26] -2617388236800000 " -2617388236800000
" [27] -1626498662399950 " -1626498662399950
" [28] -1584385228800000 " -1584385228800000
" [29] -1519976447999950 " -1519976447999950
" [30] -1455567667200000 " -1455567667200000
" [31] -1368863539199950 " -1368863539199950
" [32] -1324272844800000 " -1324272844800000
" [33] -1259864063999950 " -1259864063999950
" [34] -1195455283200000 " -1195455283200000
" [35] -1111228415999950 " -1111228415999950
" [36] -1066637721600000 " -1066637721600000
" [37] -982410854399950 " -982410854399950
" [38] -937820160000000 " -937820160000000
" [39] -853593292799950 " -853593292799950
" [40] -809002598400000 " -809002598400000
" [41] -722298470399950 " -722298470399950
" [42] -680185036800000 " -680185036800000
" [43] 937466265600050 " 937466265600050
" [44] 999397785600000 " 999397785600000
" [45] 1066283827200050 " 1066283827200050
" [46] 1130692608000000 " 1130692608000000
" [47] 1195101388800050 " 1195101388800050
" [48] 1259510169600000 " 1259510169600000
" [49] 1326396211200050 " 1326396211200050
" [50] 1388327731200000 " 1388327731200000
" [51] 1452736512000050 " 1452736512000050
" [52] 1517145292800000 " 1517145292800000
" [53] 1581554073600050 " 1581554073600050
" [54] 1645962854400000 " 1645962854400000
" [55] 1710371635200050 " 1710371635200050
" [56] 1774780416000000 " 1774780416000000
" [57] 1839189196800050 " 1839189196800050
" [58] 1906075238400000 " 1906075238400000
" [59] 1970484019200050 " 1970484019200050
" [60] 2034892800000000 " 2034892800000000
" [61] 2099301580800050 " 2099301580800050
" [62] 2163710361600000 " 2163710361600000
" [63] 2228119142400050 " 2228119142400050
" [64] 2292527923200000 " 2292527923200000
" [65] 2356951449600050 " 2356951449600050
" [66] 2421360230400000 " 2421360230400000
" [67] 2485769011200050 " 2485769011200050
" [68] 2550177792000000 " 2550177792000000
" [69] 2614586572800050 " 2614586572800050
" [70] 2681472614400000 " 2681472614400000
" [71] 2745881395200050 " 2745881395200050
" [72] 2810290176000000 " 2810290176000000
" [73] 2874698956800050 " 2874698956800050
" [74] 2939107737600000 " 2939107737600000
" [75] 3003516518400050 " 3003516518400050
" [76] 3067925299200000 " 3067925299200000
" [77] 3132334080000050 " 3132334080000050
" [78] 3196742860800000 " 3196742860800000
" [79] 3261151641600050 " 3261151641600050
" [80] 3325560422400000 " 3325560422400000
" [81] 3392446464000050 " 3392446464000050
" [82] 3466764288000000 " 3466764288000000
" [83] 3521264025600050 " 3521264025600050
" [84] 3595581849600000 " 3595581849600000
" [85] 3650081587200050 " 3650081587200050
" [86] 3724399411200000 " 3724399411200000
" [87] 3778899148800050 " 3778899148800050
" [88] 3855694233600000 " 3855694233600000
" [89] 3907716710400050 " 3907716710400050
" [90] 3984511795200000 " 3984511795200000
" [91] 4036534272000050 " 4036534272000050
" [92] 4113329356800000 " 4113329356800000
" [93] 4167829094400050 " 4167829094400050
" [94] 4242146918400000 " 4242146918400000
" [95] 4296646656000050 " 4296646656000050
" [96] 4370964480000000 " 4370964480000000
" [97] 4425464217600050 " 4425464217600050
" [98] 4502259302400000 " 4502259302400000
" [99] 4554281779200050 " 4554281779200050
" [100...164] "
" [100] 4631076864000000 " 4631076864000000
" [101] 4683099340800050 " 4683099340800050
" [102] 4759894425600000 " 4759894425600000
" [103] 4811916902400050 " 4811916902400050
" [104] 4888711987200000 " 4888711987200000
" [105] 4943211724800050 " 4943211724800050
" [106] 5017529548800000 " 5017529548800000
" [107] 5072029286400050 " 5072029286400050
" [108] 5146347110400000 " 5146347110400000
" [109] 5200846848000050 " 5200846848000050
" [110] 5277641932800000 " 5277641932800000
" [111] 5329664409600050 " 5329664409600050
" [112] 5406459494400000 " 5406459494400000
" [113] 5458481971200050 " 5458481971200050
" [114] 5535277056000000 " 5535277056000000
" [115] 5589776793600050 " 5589776793600050
" [116] 5664094617600000 " 5664094617600000
" [117] 5718594355200050 " 5718594355200050
" [118] 5792912179200000 " 5792912179200000
" [119] 5847411916800050 " 5847411916800050
" [120] 5921729740800000 " 5921729740800000
" [121] 5976229478400050 " 5976229478400050
" [122] 6053024563200000 " 6053024563200000
" [123] 6105047040000050 " 6105047040000050
" [124] 6181842124800000 " 6181842124800000
" [125] 6233864601600050 " 6233864601600050
" [126] 6310659686400000 " 6310659686400000
" [127] 6365159424000050 " 6365159424000050
" [128] 6439477248000000 " 6439477248000000
" [129] 6493976985600050 " 6493976985600050
" [130] 6568294809600000 " 6568294809600000
" [131] 6622794547200050 " 6622794547200050
" [132] 6699589632000000 " 6699589632000000
" [133] 6751612108800050 " 6751612108800050
" [134] 6828407193600000 " 6828407193600000
" [135] 6880429670400050 " 6880429670400050
" [136] 6957224755200000 " 6957224755200000
" [137] 7011724492800050 " 7011724492800050
" [138] 7086042316800000 " 7086042316800000
" [139] 7140542054400050 " 7140542054400050
" [140] 7214859878400000 " 7214859878400000
" [141] 7269359616000050 " 7269359616000050
" [142] 7343677440000000 " 7343677440000000
" [143] 7398177177600050 " 7398177177600050
" [144] 7474972262400000 " 7474972262400000
" [145] 7526994739200050 " 7526994739200050
" [146] 7603789824000000 " 7603789824000000
" [147] 7655812300800050 " 7655812300800050
" [148] 7732607385600000 " 7732607385600000
" [149] 7787107123200050 " 7787107123200050
" [150] 7861424947200000 " 7861424947200000
" [151] 7915924684800050 " 7915924684800050
" [152] 7990242508800000 " 7990242508800000
" [153] 8044742246400050 " 8044742246400050
" [154] 8121537331200000 " 8121537331200000
" [155] 8173559808000050 " 8173559808000050
" [156] 8250354892800000 " 8250354892800000
" [157] 8302377369600050 " 8302377369600050
" [158] 8379172454400000 " 8379172454400000
" [159] 8431194931200050 " 8431194931200050
" [160] 8507990016000000 " 8507990016000000
" [161] 8562489753600050 " 8562489753600050
" [162] 8636807577600000 " 8636807577600000
" [163] 8691307315200050 " 8691307315200050
" [164] 8765625139200000 " 8765625139200000
" willGMTOffsetChange false " FALSE
" zoneOffset 3600000 " 3600000
" fastTime 1416438000000 " 1416438000000
After comparing them in diff viewer - the difference is only in first two lines:
"dataOd Date (id=72) "
|
Thu Nov 20 00:00:00 CET 2014
|
"dataOd Date (id=123) "
|
2014-11-20
|
" cdate Gregorian$Date (id=82) "
|
2014-11-20T00:00:00.000+0100
|
" cdate Gregorian$Date (id=129) "
|
2014-11-20T00:00:00.000+0100
|
in first line - toString and id, in second line - only id
Why date in object read from cache (after creating in same session) has different toString than read from no cache - objects in debugger looks same, so I really don't know what is the problem
|