Failure to generate getI* shouldn't be fatal. Also, the current algorithm use to discover the reference tablename is by no mean fool proof.
This commit is contained in:
parent
6b33b0ab59
commit
4022504df5
|
@ -397,8 +397,8 @@ public class ModelClassGenerator
|
|||
String referenceClassName = "I_"+columnName.substring(0, columnName.length()-3);
|
||||
|
||||
MTable table = MTable.get(Env.getCtx(), tableName);
|
||||
if (table == null)
|
||||
throw new RuntimeException("No table found for "+tableName);
|
||||
if (table != null)
|
||||
{
|
||||
String entityType = table.getEntityType();
|
||||
if (!"D".equals(entityType))
|
||||
{
|
||||
|
@ -424,11 +424,11 @@ public class ModelClassGenerator
|
|||
.append(" ").append(referenceClassName).append(" result = null;").append(NL)
|
||||
.append(" try {").append(NL)
|
||||
.append(" Constructor<?> constructor = null;").append(NL)
|
||||
// .append(" try {").append(NL)
|
||||
// .append(" try {").append(NL)
|
||||
.append(" constructor = clazz.getDeclaredConstructor(new Class[]{Properties.class, int.class, String.class});").append(NL)
|
||||
// .append(" } catch (NoSuchMethodException e) {").append(NL)
|
||||
// .append(" log.warning(\"No transaction Constructor for \" + clazz + \" Exception[\" + e.toString() + \"]\");").append(NL)
|
||||
// .append(" }").append(NL)
|
||||
// .append(" } catch (NoSuchMethodException e) {").append(NL)
|
||||
// .append(" log.warning(\"No transaction Constructor for \" + clazz + \" Exception[\" + e.toString() + \"]\");").append(NL)
|
||||
// .append(" }").append(NL)
|
||||
// TODO - here we can implement Lazy loading or Cache of record. Like in Hibernate, objects can be loaded on demand or when master object is loaded.
|
||||
.append(" result = ("+referenceClassName+")constructor.newInstance(new Object[] {getCtx(), new Integer(get"+columnName+"()), get_TrxName()});").append(NL)
|
||||
.append(" } catch (Exception e) {").append(NL)
|
||||
|
@ -439,6 +439,7 @@ public class ModelClassGenerator
|
|||
.append(" return result;").append(NL)
|
||||
.append(" }").append(NL)
|
||||
;
|
||||
}
|
||||
// Add imports:
|
||||
addImportClass(java.lang.reflect.Constructor.class);
|
||||
addImportClass(java.util.logging.Level.class);
|
||||
|
|
|
@ -360,6 +360,7 @@ public class ModelInterfaceGenerator
|
|||
String tableName = columnName.substring(0, columnName.length()-3);
|
||||
|
||||
MTable table = MTable.get(Env.getCtx(), tableName);
|
||||
if (table != null) {
|
||||
String entityType = table.getEntityType();
|
||||
if (!"D".equals(entityType))
|
||||
{
|
||||
|
@ -381,6 +382,7 @@ public class ModelInterfaceGenerator
|
|||
sb.append("\n")
|
||||
.append("\tpublic "+referenceClassName+" get").append(tableName).append("() throws RuntimeException;")
|
||||
;
|
||||
}
|
||||
} else {
|
||||
// TODO - Handle other types
|
||||
//sb.append("\tpublic I_"+columnName+" getI_").append(columnName).append("(){return null; };");
|
||||
|
|
Loading…
Reference in New Issue