mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-17 22:56:28 +00:00
* #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:
1 parent
2b0669c2ae
commit
6b27a9d280
20 files changed
+356
-69
No files matched your search
@@ -28,7 +28,7 @@ public class FactoryBaseProperties {
|
||||
|
||||
for (BeanProperty prop : desc.propertiesBaseScalar()) {
|
||||
if (!prop.isImportedPrimaryKey()) {
|
||||
Bindable item = factoryProperty.create(prop, mode, withLobs);
|
||||
Bindable item = factoryProperty.create(prop, mode, withLobs, false);
|
||||
if (item != null) {
|
||||
list.add(item);
|
||||
}
|
||||
|
||||
@@ -24,13 +24,11 @@ public class FactoryEmbedded {
|
||||
*/
|
||||
public void create(List<Bindable> list, BeanDescriptor<?> desc, DmlMode mode, boolean withLobs) {
|
||||
|
||||
BeanPropertyAssocOne<?>[] embedded = desc.propertiesEmbedded();
|
||||
|
||||
for (BeanPropertyAssocOne<?> anEmbedded : embedded) {
|
||||
for (BeanPropertyAssocOne<?> anEmbedded : desc.propertiesEmbedded()) {
|
||||
BeanProperty[] props = anEmbedded.getProperties();
|
||||
List<Bindable> bindList = new ArrayList<>(props.length);
|
||||
for (BeanProperty prop : props) {
|
||||
Bindable item = factoryProperty.create(prop, mode, withLobs);
|
||||
Bindable item = factoryProperty.create(prop, mode, withLobs, true);
|
||||
if (item != null) {
|
||||
bindList.add(item);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package io.ebeaninternal.server.persist.dmlbind;
|
||||
|
||||
import io.ebeaninternal.server.deploy.BeanProperty;
|
||||
import io.ebeaninternal.server.deploy.BeanPropertyAssocOne;
|
||||
import io.ebeaninternal.server.persist.dml.DmlMode;
|
||||
|
||||
/**
|
||||
@@ -14,14 +15,14 @@ public class FactoryProperty {
|
||||
|
||||
private final boolean bindEncryptDataFirst;
|
||||
|
||||
public FactoryProperty(boolean bindEncryptDataFirst) {
|
||||
FactoryProperty(boolean bindEncryptDataFirst) {
|
||||
this.bindEncryptDataFirst = bindEncryptDataFirst;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Bindable for the property given the mode and withLobs flag.
|
||||
*/
|
||||
public Bindable create(BeanProperty prop, DmlMode mode, boolean withLobs) {
|
||||
public Bindable create(BeanProperty prop, DmlMode mode, boolean withLobs, boolean allowManyToOne) {
|
||||
|
||||
if (DmlMode.INSERT == mode && !prop.isDbInsertable()) {
|
||||
return null;
|
||||
@@ -30,15 +31,18 @@ public class FactoryProperty {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (prop.isLob()) {
|
||||
if (!withLobs) {
|
||||
// Lob exclusion
|
||||
return null;
|
||||
} else {
|
||||
return prop.isDbEncrypted() ? new BindableEncryptedProperty(prop, bindEncryptDataFirst) : new BindableProperty(prop);
|
||||
}
|
||||
if (prop.isLob() && !withLobs) {
|
||||
// Lob exclusion
|
||||
return null;
|
||||
}
|
||||
if (prop.isDbEncrypted()){
|
||||
return new BindableEncryptedProperty(prop, bindEncryptDataFirst);
|
||||
}
|
||||
|
||||
return prop.isDbEncrypted() ? new BindableEncryptedProperty(prop, bindEncryptDataFirst) : new BindableProperty(prop);
|
||||
if (allowManyToOne && prop instanceof BeanPropertyAssocOne) {
|
||||
return new BindableAssocOne((BeanPropertyAssocOne<?>)prop);
|
||||
}
|
||||
|
||||
return new BindableProperty(prop);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user