Bug 293 : Issue with Embedded Id's with some properties updatable
Priority 
High
Reported Version 
 
Logged By 
Rob
Status 
Fixed
Fixed Version 
2.7.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
12/05/2010
Updated 
12/05/2010
Type 
Bug
 
Attachments 
No attachments

Patch from Rien:

Index: src/main/java/com/avaje/ebeaninternal/server/deploy/id/ImportedIdEmbedded.java
===================================================================
--- src/main/java/com/avaje/ebeaninternal/server/deploy/id/ImportedIdEmbedded.java (revision 1038)
+++ src/main/java/com/avaje/ebeaninternal/server/deploy/id/ImportedIdEmbedded.java (working copy)
@@ -113,14 +113,18 @@

if (embeddedId == null){
for (int i = 0; i < imported.length; i++) {
+ if (imported[i].owner.isUpdateable()) {
request.bind(null, imported[i].foreignProperty, imported[i].localDbColumn, true);
+ }
}

} else {

for (int i = 0; i < imported.length; i++) {
+ if (imported[i].owner.isUpdateable()) {
Object scalarValue = imported[i].foreignProperty.getValue(embeddedId);
request.bind(scalarValue, imported[i].foreignProperty, imported[i].localDbColumn, true);
+ }
}
}
}
Index: src/main/java/com/avaje/ebeaninternal/server/deploy/id/ImportedIdMultiple.java
===================================================================
--- src/main/java/com/avaje/ebeaninternal/server/deploy/id/ImportedIdMultiple.java (revision 1038)
+++ src/main/java/com/avaje/ebeaninternal/server/deploy/id/ImportedIdMultiple.java (working copy)
@@ -89,7 +89,9 @@

for (int i = 0; i < imported.length; i++) {
Object scalarValue = imported[i].foreignProperty.getValue(bean);
- request.bind(scalarValue, imported[i].foreignProperty, imported[i].localDbColumn, true);
+ if (imported[i].owner.isUpdateable()) {
+ request.bind(scalarValue, imported[i].foreignProperty, imported[i].localDbColumn, true);
+ }
}
}

 
Rob 12 May 08:02
Applied Patch as is:

Fixed in HEAD.

woResponse

Upload a file