mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-10-25 07:57:39 +00:00
FIX: do not hit database if inherited entity has no children (#974)
* FIX: do not hit database if inherited entity has no children * ADD: Testcase for creating references of inherited beans
This commit is contained in:
committed by
Rob Bygrave
parent
7632910027
commit
40ca179509
@@ -612,7 +612,7 @@ public final class DefaultServer implements SpiServer, SpiEbeanServer {
|
||||
}
|
||||
|
||||
InheritInfo inheritInfo = desc.getInheritInfo();
|
||||
if (inheritInfo == null) {
|
||||
if (inheritInfo == null || inheritInfo.getChildren().isEmpty()) {
|
||||
return (T) desc.contextRef(pc, null, false, id);
|
||||
}
|
||||
|
||||
|
||||
@@ -164,7 +164,14 @@ public class InheritInfo {
|
||||
public BeanProperty[] localProperties() {
|
||||
return descriptor.propertiesLocal();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the children.
|
||||
*/
|
||||
public ArrayList<InheritInfo> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the bean property additionally looking in the sub types.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user