details: https://code.openbravo.com/erp/devel/pi/rev/28081bd3f4d0
changeset: 17701:28081bd3f4d0
user: Augusto Mauch <augusto.mauch <at> openbravo.com>
date: Fri Aug 17 09:24:49 2012 +0200
summary: Related to issue 21215: Change the way of retrieving the connection
diffstat:
src/org/openbravo/base/OBSchedulerInitializerListener.java | 20 +++----------
1 files changed, 5 insertions(+), 15 deletions(-)
diffs (47 lines):
diff -r 8f50e2b6343a -r 28081bd3f4d0
src/org/openbravo/base/OBSchedulerInitializerListener.java
--- a/src/org/openbravo/base/OBSchedulerInitializerListener.java Thu Aug
16 18:11:54 2012 +0200
+++ b/src/org/openbravo/base/OBSchedulerInitializerListener.java Fri Aug
17 09:24:49 2012 +0200
@@ -11,7 +11,6 @@
import static
org.quartz.ee.servlet.QuartzInitializerListener.QUARTZ_FACTORY_KEY;
import java.sql.Connection;
-import java.sql.DriverManager;
import java.sql.Statement;
import javax.servlet.ServletContext;
@@ -19,7 +18,7 @@
import javax.servlet.ServletContextListener;
import org.apache.log4j.Logger;
-import org.openbravo.base.session.OBPropertiesProvider;
+import org.openbravo.dal.service.OBDal;
import org.openbravo.scheduling.OBScheduler;
import org.quartz.Scheduler;
import org.quartz.impl.StdSchedulerFactory;
@@ -119,22 +118,13 @@
// Update Interrupted Process Instance's End time with current time.
try {
- String dburl =
OBPropertiesProvider.getInstance().getOpenbravoProperties()
- .getProperty("bbdd.url");
- String database =
OBPropertiesProvider.getInstance().getOpenbravoProperties()
- .getProperty("bbdd.sid");
- String systemUser =
OBPropertiesProvider.getInstance().getOpenbravoProperties()
- .getProperty("bbdd.systemUser");
- String systemPassword =
OBPropertiesProvider.getInstance().getOpenbravoProperties()
- .getProperty("bbdd.systemPassword");
- Class.forName("org.postgresql.Driver");
- Connection connection = DriverManager.getConnection(dburl + "/" +
database, systemUser,
- systemPassword);
+ Connection connection = OBDal.getInstance().getConnection();
if (connection != null) {
Statement s = connection.createStatement();
String query = "UPDATE AD_PROCESS_RUN SET
END_TIME=NOW(),STATUS='SYR' WHERE END_TIME IS NULL";
- int executeUpdate = s.executeUpdate(query);
- log.info("Number of rows updated" + executeUpdate);
+ s.executeUpdate(query);
+ OBDal.getInstance().flush();
+ OBDal.getInstance().getConnection().commit();
} else {
System.out.println("Connection Failed!");
}
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits