IDEMPIERE-4045 Allow to create model from view (FHCA-1057)

This commit is contained in:
Carlos Ruiz 2019-09-06 17:51:12 +02:00
parent 7d0101fcee
commit c2a1aea45c
2 changed files with 16 additions and 7 deletions

View File

@ -895,20 +895,24 @@ public class ModelClassGenerator
file.mkdirs();
// complete sql
String filterViews = null;
if (tableLike.toString().contains("%")) {
filterViews = "AND (TableName IN ('RV_WarehousePrice','RV_BPartner') OR IsView='N')"; // special views
}
StringBuilder sql = new StringBuilder();
sql.append("SELECT AD_Table_ID ")
.append("FROM AD_Table ")
.append("WHERE (TableName IN ('RV_WarehousePrice','RV_BPartner')") // special views
.append(" OR IsView='N')")
.append(" AND IsActive = 'Y' AND TableName NOT LIKE '%_Trl' ");
.append("WHERE IsActive = 'Y' AND TableName NOT LIKE '%_Trl' ");
// Autodetect if we need to use IN or LIKE clause - teo_sarca [ 3020640 ]
if (tableLike.indexOf(",") == -1)
sql.append(" AND TableName LIKE ").append(tableLike);
else
sql.append(" AND TableName IN (").append(tableLike).append(")"); // only specific tables
sql.append(" AND ").append(entityTypeFilter.toString());
if (filterViews != null) {
sql.append(filterViews);
}
sql.append(" ORDER BY TableName");
//
PreparedStatement pstmt = null;
ResultSet rs = null;

View File

@ -813,18 +813,23 @@ public class ModelInterfaceGenerator
file.mkdirs();
// complete sql
String filterViews = null;
if (tableLike.toString().contains("%")) {
filterViews = "AND (TableName IN ('RV_WarehousePrice','RV_BPartner') OR IsView='N')"; // special views
}
StringBuilder sql = new StringBuilder();
sql.append("SELECT AD_Table_ID ")
.append("FROM AD_Table ")
.append("WHERE (TableName IN ('RV_WarehousePrice','RV_BPartner')") // special views
.append(" OR IsView='N')")
.append(" AND IsActive = 'Y' AND TableName NOT LIKE '%_Trl' ");
.append("WHERE IsActive = 'Y' AND TableName NOT LIKE '%_Trl' ");
// Autodetect if we need to use IN or LIKE clause - teo_sarca [ 3020640 ]
if (tableLike.indexOf(",") == -1)
sql.append(" AND TableName LIKE ").append(tableLike);
else
sql.append(" AND TableName IN (").append(tableLike).append(")"); // only specific tables
sql.append(" AND ").append(entityTypeFilter.toString());
if (filterViews != null) {
sql.append(filterViews);
}
sql.append(" ORDER BY TableName");
//