We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I want to save an object, but first I need to get its ID to update another property of the same object. I am doing this:
ID
if (instance.validate()) { instance.save() // now I have an id instance.code = String.format("%014d", instance.id) instance.save() }
The domain object is
class Product { final static String DEFAULT_CODE = "XXXX-XXXX-XXXX" String code = DEFAULT_CODE String description static constraints = { code size: 14..14 } }
But when I get the object from the data base, the code property doesn't have the new value. I created an integration test to show this:
code
void "test double saved"() { given: RestBuilder rest = new RestBuilder() when: "save a new product" RestResponse response = rest.post("http://localhost:${serverPort}/product") { json([ description: "screw" ]) } then: "the code will be different to default value" response.status == 201 Product product = Product.getAll().first() product product.code != Product.DEFAULT_CODE cleanup: Product.withNewSession { Product.withNewTransaction { Product.getAll()*.delete() } } }
The second call to save() is ignored.
Here is the sample app: https://github.com/AmaliaMV/neo4j-doubleSaved
The versions I am using are:
grailsVersion=3.3.5 gormVersion=6.1.10.BUILD-SNAPSHOT grailsNeo4jPluginVersion=6.2.0.BUILD-SNAPSHOT
However, I checked that this is happening too if I use hibernate instead of neo4j.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I want to save an object, but first I need to get its
ID
to update another property of the same object. I am doing this:The domain object is
But when I get the object from the data base, the
code
property doesn't have the new value. I created an integration test to show this:The second call to save() is ignored.
Here is the sample app: https://github.com/AmaliaMV/neo4j-doubleSaved
The versions I am using are:
However, I checked that this is happening too if I use hibernate instead of neo4j.
The text was updated successfully, but these errors were encountered: