提交 8d2d9cd7 编写于 作者: R roo00

修改动态表名称,为了统一去掉了首字母大写.

上级 208606b6
......@@ -54,16 +54,17 @@ public class DynamicEntity extends GsonPropertyObject {
if (StringUtils.isEmpty(name)) {
throw new Exception("name is empty.");
}
return StringUtils.capitalize(name);
return name;
}
public String className() throws Exception {
if (StringUtils.isEmpty(name)) {
throw new Exception("name is empty.");
}
return CLASS_PACKAGE + "." + StringUtils.capitalize(name);
return CLASS_PACKAGE + "." + name;
}
@SuppressWarnings("unchecked")
public Class<? extends JpaObject> getObjectClass() throws Exception {
return (Class<? extends JpaObject>) Class.forName(this.className());
}
......
......@@ -52,11 +52,11 @@ import com.x.base.core.entity.dynamic.DynamicEntity.StringMapField;
import com.x.base.core.entity.dynamic.DynamicEntity.TimeField;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.ListTools;
public class DynamicEntityBuilder {
public static final String FIELDNAME_SUFFIX = "_FIELDNAME";
public static final String DOT_CLASS = ".class";
private DynamicEntity dynamicEntity;
private File dir;
......@@ -353,15 +353,21 @@ public class DynamicEntityBuilder {
.build();
AnnotationSpec persistentCollection = AnnotationSpec.builder(PersistentCollection.class)
.addMember("fetch", "javax.persistence.FetchType.EAGER").build();
.addMember("fetch", "javax.persistence.FetchType.EAGER")
.addMember("elementType", typeClass.getSimpleName() + DOT_CLASS).build();
AnnotationSpec orderColumn = AnnotationSpec.builder(OrderColumn.class).addMember("name", "ORDERCOLUMNCOLUMN")
.build();
AnnotationSpec elementColumn = AnnotationSpec.builder(ElementColumn.class).addMember("length", "length_255B")
.addMember("name", "ColumnNamePrefix + " + field.fieldName()).build();
ClassName type = ClassName.get(String.class);
AnnotationSpec elementColumn = null;
if (CharSequence.class.isAssignableFrom(typeClass)) {
elementColumn = AnnotationSpec.builder(ElementColumn.class).addMember("length", "length_255B")
.addMember("name", "ColumnNamePrefix + " + field.fieldName()).build();
} else {
elementColumn = AnnotationSpec.builder(ElementColumn.class)
.addMember("name", "ColumnNamePrefix + " + field.fieldName()).build();
}
ClassName type = ClassName.get(typeClass);
ClassName list = ClassName.get(List.class);
TypeName list_type = ParameterizedTypeName.get(list, type);
......
package com.x.query.assemble.designer.jaxrs.table;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;
......
......@@ -32,7 +32,7 @@ import net.sf.ehcache.Element;
public class Business {
private static Ehcache cache = ApplicationCache.instance().getCache(Query.class, View.class, Stat.class,
Reveal.class);
Reveal.class, Table.class, Statement.class);
public Ehcache cache() {
return cache;
......@@ -95,7 +95,7 @@ public class Business {
@SuppressWarnings("unchecked")
public <T extends JpaObject> T pick(String flag, Class<T> cls) throws Exception {
String cacheKey = ApplicationCache.concreteCacheKey(flag);
String cacheKey = ApplicationCache.concreteCacheKey(cls, flag);
Element element = cache.get(cacheKey);
if ((null != element) && (null != element.getObjectValue())) {
return (T) element.getObjectValue();
......@@ -103,7 +103,7 @@ public class Business {
T t = this.entityManagerContainer().flag(flag, cls);
if (null != t) {
entityManagerContainer().get(cls).detach(t);
cache.put(new Element(flag, t));
cache.put(new Element(cacheKey, t));
return t;
}
return null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册