mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-05-19 05:26:41 +00:00
fix[orm]: The primary key must be named as id, otherwise an error will occur. #issue(108)
This commit is contained in:
@@ -418,6 +418,10 @@ public class OrmManager implements IOrmManager {
|
||||
throw new RunException("orm only supports int long float double String");
|
||||
}
|
||||
|
||||
if (!idField.getName().equals("id")) {
|
||||
throw new RunException("@Id filed must name with id");
|
||||
}
|
||||
|
||||
ReflectionUtils.makeAccessible(idField);
|
||||
ReflectionUtils.setField(idField, entityInstance, idFiledValue);
|
||||
var idMethodOptional = Arrays.stream(ReflectionUtils.getAllMethods(clazz)).filter(it -> it.getName().equalsIgnoreCase("id"))
|
||||
|
||||
Reference in New Issue
Block a user