Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 17:03 Go to next message
Khurshed Salimov is currently offline Khurshed SalimovFriend
Messages: 7
Registered: July 2012
Junior Member
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 17:05 Go to previous messageGo to next message
Khurshed Salimov is currently offline Khurshed SalimovFriend
Messages: 7
Registered: July 2012
Junior Member
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 20:34 Go to previous messageGo to next message
Tom Eugelink is currently offline Tom EugelinkFriend
Messages: 817
Registered: July 2009
Senior Member
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 12:56 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

You could also try the persistence unit property,

"eclipselink.temporal.mutable"="true"


James : Wiki : Book : Blog : Twitter
Re: Weird problems while saving and reading Calendar in jpa [message #912543 is a reply to message #905577] Thu, 13 September 2012 18:39 Go to previous messageGo to next message
Eduardo Frazão is currently offline Eduardo FrazãoFriend
Messages: 123
Registered: January 2012
Senior Member
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 13:17 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

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.

James : Wiki : Book : Blog : Twitter
Re: Weird problems while saving and reading Calendar in jpa [message #962625 is a reply to message #905575] Mon, 29 October 2012 07:52 Go to previous message
Khurshed Salimov is currently offline Khurshed SalimovFriend
Messages: 7
Registered: July 2012
Junior Member
"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: Thu Mar 28 22:38:45 GMT 2024

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

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

Back to the top