Support @ManyToOne inside @Embeddables - fix for #52 (#1608)

* #52 - @ManyToOne support inside @Embeddables

Initial test and work

* #52 - @ManyToOne support inside @Embeddables

Initial test and work

* #52 - @ManyToOne support inside @Embeddables

Initial test and work

* #52 - @ManyToOne support inside @Embeddables

Initial test and work

* #52 - @ManyToOne support inside @Embeddables

Initial test and work

* #52 - @ManyToOne support inside @Embeddables

Initial test and work

* #52 - @ManyToOne support inside @Embeddables

Update test with sql capture

* #52 - @ManyToOne support inside @Embeddables

Update test with cache clearing before hand (such that we hit DB on lazy load)
This commit is contained in:
Rob Bygrave
2019-01-10 03:40:02 +13:00
committed by GitHub
parent 2b0669c2ae
commit 6b27a9d280
20 changed files with 356 additions and 69 deletions
@@ -17,9 +17,16 @@ abstract class AssocOneHelp {
protected final BeanDescriptor<?> target;
private final String path;
AssocOneHelp(BeanPropertyAssocOne<?> property) {
this(property, null);
}
AssocOneHelp(BeanPropertyAssocOne<?> property, String embeddedPrefix) {
this.property = property;
this.target = property.targetDescriptor;
this.path = (embeddedPrefix == null) ? property.name : embeddedPrefix + "." + property.name;
}
/**
@@ -67,7 +74,7 @@ abstract class AssocOneHelp {
boolean disableLazyLoading = ctx.isDisableLazyLoading();
Object ref = target.contextRef(pc, ctx.isReadOnly(), disableLazyLoading, id);
if (!disableLazyLoading) {
ctx.register(property.name, ((EntityBean) ref)._ebean_getIntercept());
ctx.register(path, ((EntityBean) ref)._ebean_getIntercept());
}
return ref;
}