Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Collection shows different data between database and cache after two inserts
Collection shows different data between database and cache after two inserts [message #1835548] Sun, 06 December 2020 17:00 Go to next message
Alfonso Luna is currently offline Alfonso LunaFriend
Messages: 14
Registered: March 2010
Junior Member
I am mapping the storage of an object "fleet" as follows:

@ElementCollection(fetch = FetchType.LAZY)
    @CollectionTable(name="storage", joinColumns=@JoinColumn(name="fleet"))
    @Column(name="units")
    @MapKeyJoinColumn(name="object_type", referencedColumnName="id")
	private Map<ObjectType,Long> storage = new TreeMap<>();


I open a new transaction that makes two changes in the storage:
1. inserts objects A, B, C, D, E
2. inserts A, B, F, G

Debugging the transaction I can see that the storage now has objects: A, B, C, D, E, F and G.

Databe also show objects A, B, C, D, E, F and G.

BUT... when I open the object fleet in other different transaction it shows the objects: C, D, E.

It is like somehow those objects that were in BOTH inserts were deleted from the persistance cache. They exist in the database, If I reboot the app the storage show the correct collection A, B, C, D, E, F and G.

Any idea why the persistance cache gets this corrupted data?

Thanks in advance

Re: Collection shows different data between database and cache after two inserts [message #1835596 is a reply to message #1835548] Mon, 07 December 2020 23:14 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1389
Registered: July 2009
Senior Member
What are the exact operations you are putting on the Storage map? I don't see how two transactions can insert the same A and B pairs without getting an exception as it can only work once. I would assume one transaction clears the list/map and then inserts all it has, and it might be this initial clear operation (and how it is implemented on the container in the shared cache) that causes the issue.
Previous Topic:Java Data Type mapping for DB data type that support timezone
Next Topic:Dynamically adding entities to eclipselink persistence
Goto Forum:
  


Current Time: Thu Apr 25 15:14:47 GMT 2024

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

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

Back to the top