Skip to content

Unique constraint ignores transient group in parent/child save #14532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
3 tasks done
rmorrise opened this issue Jan 16, 2019 · 0 comments
Open
3 tasks done

Unique constraint ignores transient group in parent/child save #14532

rmorrise opened this issue Jan 16, 2019 · 0 comments

Comments

@rmorrise
Copy link
Contributor

rmorrise commented Jan 16, 2019

Task List

  • Steps to reproduce provided
  • Example that reproduces the problem uploaded to Github
  • Full description of the issue provided (see below)

Steps to Reproduce

  1. Clone the example repo:
    https://github.com/rmorrise/grails-unique-child
  2. grails run-app
  3. POST the following JSON data:
    http://localhost:8080/MasterThing
    Content-Type application/json
{
	"details": [
		{
			"itemName": "Foo"
		}
	]
}
  1. Repeat the same POST request again.

Expected Behaviour

Both requests should be OK.

Validation of the unique constraint on DetailItem should be scoped to the master object that is being posted.

Actual Behaviour

HTTP error 422:
Property [itemName] of class [class grails.unique.child.DetailItem] with value [Foo] must be unique

The unique constraint is validated globally for the itemName properly only.

Environment Information

  • Operating System: Windows 7 x64
  • GORM Version: 6.1.10.RELEASE
  • Grails Version (if using Grails): 3.3.8
  • JDK Version: 1.8.0_121

Example Application

@jdaugherty jdaugherty transferred this issue from apache/grails-data-mapping Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants