Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » Weird problems while saving and reading Calendar in jpa(Weird problems while saving and reading Calendar in jpa(eclipslink))
Weird problems while saving and reading Calendar in jpa [message #905575] Thu, 30 August 2012 13:03 Go to next message
Eclipse UserFriend
I am running in weird situation with java Calendar in jpa. The problem is while saving and reading back java.Calendar I not getting consistent date?
Re: Weird problems while saving and reading Calendar in jpa [message #905577 is a reply to message #905575] Thu, 30 August 2012 13:05 Go to previous messageGo to next message
Eclipse UserFriend
The problem was in caching of entities . So I disabled caching by using the following annotation on entities :

@Cacheable(false)

I used that annotation on entities with java.Calendar field
Re: Weird problems while saving and reading Calendar in jpa [message #905661 is a reply to message #905577] Thu, 30 August 2012 16:34 Go to previous messageGo to next message
Eclipse UserFriend
Calendars are scary things, because they are mutable.

Tom


On 2012-08-30 19:05, Khurshed Salimov wrote:
> The problem was in caching of entities . So I disabled caching by using the following annotation on entities :
>
> @Cacheable(false)
>
> I used that annotation on entities with java.Calendar field
Re: Weird problems while saving and reading Calendar in jpa [message #909039 is a reply to message #905661] Thu, 06 September 2012 08:56 Go to previous messageGo to next message
Eclipse UserFriend
You could also try the persistence unit property,

"eclipselink.temporal.mutable"="true"
Re: Weird problems while saving and reading Calendar in jpa [message #912543 is a reply to message #905577] Thu, 13 September 2012 14:39 Go to previous messageGo to next message
Eclipse UserFriend
java.util.Date fields have this problem too?
Re: Weird problems while saving and reading Calendar in jpa [message #916058 is a reply to message #912543] Tue, 18 September 2012 09:17 Go to previous messageGo to next message
Eclipse UserFriend
The method on java.util.Date are mainly deprecated, so should not have this issue. In general, you should ensure you create a new Date/Calendar for a new Date/Calendar, not modify the existing one.
Re: Weird problems while saving and reading Calendar in jpa [message #962625 is a reply to message #905575] Mon, 29 October 2012 03:52 Go to previous message
Eclipse UserFriend
"eclipselink.temporal.mutable"="true" only makes changes to mutable data or Calendar to be able to track by persistence context. But problem was in shared cache. Because when inserting entity it will added to shared cache and while reading back from shared cache copy of calendar is created. That is the real cause of problem since here we are making new copy of calendar instance not building new one after executing database query.
Previous Topic:EntityListener not called (SOLVED)
Next Topic:Cannot generate SQL tables when @NoSQL entities are present
Goto Forum:
  


Current Time: Tue Jul 22 18:51:53 EDT 2025

Powered by FUDForum. Page generated in 0.04871 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top