Issue Details (XML | Word | Printable)

Key: CORE-3557
Type: Bug Bug
Status: Closed Closed
Resolution: Cannot Reproduce
Priority: Minor Minor
Assignee: Unassigned
Reporter: Wesley Biggs
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
JPOX Core (ARCHIVED)

CLONE -Exception on attempting add duplicate SCO to HashSet

Created: 08/Jan/09 05:02 AM   Updated: 20/Jul/09 11:43 AM   Resolved: 20/Jul/09 11:43 AM
Component/s: JDO
Affects Version/s: None
Fix Version/s: None

File Attachments: 1. Java Source File Main.java (3 kB)

Environment: MySQL

Forum Thread URL: http://www.jpox.org/servlet/forum/viewthread?thread=2900
Datastore: MySQL


 Description  « Hide
JPOX attempts to insert duplicate item into database for persisted HashSet of SCO instead of following HashSet semantics and not doing the insertion and returning false to HashSet.add()

This causes an exception of the form: java.sql.SQLException: Duplicate entry

TestCase to follow.


Sort Order: Ascending order - Click to sort in descending order
Wesley Biggs added a comment - 08/Jan/09 05:10 AM
This is a clone of #CORE-2599 and appears to be a regression.

I can't edit the version data having cloned this (sorry if this is not the right way to go about it), but this is against the DataNucleus 1.0.3 release.

In summary, if you add duplicate elements to a persistent Set field, you will get a SQL duplicate key exception.

The workaround is to always check .contains() on the Set before doing an add() operation.

I'll upload the code from the original example converted to datanucleus packages.


Wesley Biggs added a comment - 08/Jan/09 05:13 AM
This is the same test case from bug 2599, just converted to use the datanucleus packages. The A.java POJO and related schema are unchanged from the previous issue.

Wesley Biggs added a comment - 08/Jan/09 05:18 AM
Further note -- for clarity, this affects FCO Sets as well as SCO Sets. (The test case uses an SCO but I ran into the issue using a Set<FCO>.)

Andy Jefferson added a comment - 08/Jan/09 07:30 AM
JPOX is no longer developed

Wesley Biggs added a comment - 08/Jan/09 08:26 AM
Andy,

Per my other comments, this is affecting DataNucleus 1.0.3.

Sorry for the confusion -- the other version fields got copied in from the "clone issue" functionality and I wasn't able to edit them.


Andy Jefferson added a comment - 08/Jan/09 08:35 AM
Wes,
so if you have a problem with DataNucleus then you raise an issue (new issue) on DataNucleus (project NUCCORE) not on JPOX. JIRA has "resolved" and "closed" for a reason; you don't attempt to reopen old issues - they are closed and there as a permanent record of something being fixed in release XXX, and so alway appear in release notes. If some problem comes up at some later date that has some resemblance to something ancient then a new issue is the only logical option.

Either way I've got plenty to be doing for the next 6 months so if you want such things urgently you're advised to investigate yourself. Classes org.datanucleus.sco.* are where to start.