-
Notifications
You must be signed in to change notification settings - Fork 202
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
Skip insert/update for @GeneratedValue annotated fields in @Embedded #3344
Changes from all commits
bf36827
2bac50f
9835e38
2cf69b2
371cec0
c238f20
0cf1e90
f0463c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,7 @@ | |
import io.micronaut.data.model.Pageable; | ||
import io.micronaut.data.model.Pageable.Mode; | ||
import io.micronaut.data.model.PersistentEntity; | ||
import io.micronaut.data.model.PersistentEntityUtils; | ||
import io.micronaut.data.model.PersistentProperty; | ||
import io.micronaut.data.model.PersistentPropertyPath; | ||
import io.micronaut.data.model.naming.NamingStrategy; | ||
|
@@ -1026,7 +1027,8 @@ public int getParameterIndex() { | |
|
||
for (PersistentProperty prop : persistentProperties) { | ||
traversePersistentProperties(prop, (associations, property) -> { | ||
if (prop.isGenerated()) { | ||
boolean generated = PersistentEntityUtils.isPropertyGenerated(entity, prop, property); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we somehow fix the prop.isGenerated to return true? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does not look like. We have for example |
||
if (generated) { | ||
String columnName = getMappedName(namingStrategy, associations, property); | ||
if (escape) { | ||
columnName = quote(columnName); | ||
|
@@ -1035,7 +1037,7 @@ public int getParameterIndex() { | |
return; | ||
} | ||
|
||
addWriteExpression(values, prop); | ||
addWriteExpression(values, property); | ||
|
||
String key = String.valueOf(values.size()); | ||
String[] path = asStringPath(associations, property); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -861,7 +861,8 @@ public JsonDataType getJsonDataType() { | |
|
||
for (PersistentProperty prop : persistentProperties) { | ||
PersistentEntityUtils.traversePersistentProperties(Collections.emptyList(), prop, (associations, property) -> { | ||
if (prop.isGenerated()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like this check was not valid There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right |
||
boolean generated = PersistentEntityUtils.isPropertyGenerated(entity, prop, property); | ||
if (generated) { | ||
String columnName = getMappedName(namingStrategy, associations, property); | ||
if (escape) { | ||
columnName = quote(columnName); | ||
|
@@ -870,7 +871,7 @@ public JsonDataType getJsonDataType() { | |
return; | ||
} | ||
|
||
addWriteExpression(values, prop); | ||
addWriteExpression(values, property); | ||
|
||
String key = String.valueOf(values.size()); | ||
String[] path = asStringPath(associations, property); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is code that filters persistent properties before building update query, but one of these are embedded and we need to check each fields inside embedded here.