details: /erp/devel/pi/rev/d98f5745a830
changeset: 10467:d98f5745a830
user: Stefan Hühner <stefan.huehner <at> openbravo.com>
date: Wed Feb 09 15:12:04 2011 +0100
summary: Fixed 15900. Change getTables() to only return tables usable with
DAL.
This changes the list of tables returned by ModelProvider.getTables() to only
return the list of tables usable with dal and not all the tables which are
defined in ad_table. Difference between those are tables not supported by dal
i.e. which do not have any column defined which is marked as primary key.
diffstat:
src/org/openbravo/base/model/ModelProvider.java | 22 +++++-----------------
1 files changed, 5 insertions(+), 17 deletions(-)
diffs (35 lines):
diff -r 0e5e7efe3769 -r d98f5745a830
src/org/openbravo/base/model/ModelProvider.java
--- a/src/org/openbravo/base/model/ModelProvider.java Wed Feb 09 13:53:35
2011 +0100
+++ b/src/org/openbravo/base/model/ModelProvider.java Wed Feb 09 15:12:04
2011 +0100
@@ -331,26 +331,14 @@
}
/**
- * Returns the tables in the database, is usefull for debugging purposes.
+ * Returns list of tables known in the dal in memory model.
*
- * @return list of tables in the database
+ * This excludes i.e. tables which do not have any column defined with
iskey='Y'
+ *
+ * @return list of tables known by dal in no particular stable order
*/
public List<Table> getTables() {
- final SessionFactoryController sessionFactoryController = new
ModelSessionFactoryController();
- final Session session =
sessionFactoryController.getSessionFactory().openSession();
- final Transaction tx = session.beginTransaction();
- try {
- tables = list(session, Table.class);
- // read the columns in one query and assign them to the table
- final List<Column> cols = readColumns(session);
- assignColumnsToTable(cols);
- return tables;
- } finally {
- log.debug("Closing session and sessionfactory used during model read");
- tx.commit();
- session.close();
- sessionFactoryController.getSessionFactory().close();
- }
+ return new ArrayList<Table>(tablesByTableName.values());
}
/**
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits