|
@@ -4,6 +4,7 @@ import org.hswebframework.ezorm.rdb.mapping.EntityColumnMapping;
|
|
|
import org.hswebframework.ezorm.rdb.mapping.MappingFeatureType;
|
|
|
import org.hswebframework.ezorm.rdb.metadata.RDBColumnMetadata;
|
|
|
import org.hswebframework.ezorm.rdb.metadata.TableOrViewMetadata;
|
|
|
+import org.hswebframework.web.api.crud.entity.EntityFactory;
|
|
|
|
|
|
import java.util.Map;
|
|
|
import java.util.Optional;
|
|
@@ -12,12 +13,15 @@ class DetectEntityColumnMapping implements EntityColumnMapping {
|
|
|
private final String id;
|
|
|
private final Class<?> type;
|
|
|
private final EntityColumnMapping mapping;
|
|
|
+ private final EntityFactory entityFactory;
|
|
|
|
|
|
public DetectEntityColumnMapping(Class<?> type,
|
|
|
- EntityColumnMapping mapping) {
|
|
|
+ EntityColumnMapping mapping,
|
|
|
+ EntityFactory entityFactory) {
|
|
|
this.id = MappingFeatureType.columnPropertyMapping.createFeatureId(type);
|
|
|
this.type = type;
|
|
|
this.mapping = mapping;
|
|
|
+ this.entityFactory = entityFactory;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -50,6 +54,11 @@ class DetectEntityColumnMapping implements EntityColumnMapping {
|
|
|
return mapping.getTable();
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Object newInstance() {
|
|
|
+ return entityFactory.newInstance(getEntityType());
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public String getId() {
|
|
|
return id;
|