svn commit: r927584 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity: GenericDelegator.java util/SequenceUtil.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r927584 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity: GenericDelegator.java util/SequenceUtil.java

jonesde
Author: jonesde
Date: Thu Mar 25 20:22:55 2010
New Revision: 927584

URL: http://svn.apache.org/viewvc?rev=927584&view=rev
Log:
Small fix so that new SequenceUtil stuff (with no delegtor reference) will work with the multi-tenant extended helper info; before this all tenants would use the SequenceValueItem table from the master (no tenant) database

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=927584&r1=927583&r2=927584&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Thu Mar 25 20:22:55 2010
@@ -2928,9 +2928,8 @@ public class GenericDelegator implements
             if (sequencer == null) {
                 synchronized (this) {
                     if (sequencer == null) {
-                        String helperName = this.getEntityHelperName("SequenceValueItem");
                         ModelEntity seqEntity = this.getModelEntity("SequenceValueItem");
-                        sequencer = new SequenceUtil(helperName, seqEntity, "seqName", "seqId");
+                        sequencer = new SequenceUtil(this.getEntityHelperInfo("SequenceValueItem"), seqEntity, "seqName", "seqId");
                     }
                 }
             }

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java?rev=927584&r1=927583&r2=927584&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/SequenceUtil.java Thu Mar 25 20:22:55 2010
@@ -29,6 +29,7 @@ import javax.transaction.Transaction;
 
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.datasource.GenericHelperInfo;
 import org.ofbiz.entity.jdbc.ConnectionFactory;
 import org.ofbiz.entity.model.ModelEntity;
 import org.ofbiz.entity.model.ModelField;
@@ -44,18 +45,18 @@ public class SequenceUtil {
     public static final String module = SequenceUtil.class.getName();
 
     private final Map<String, SequenceBank> sequences = new Hashtable<String, SequenceBank>();
-    private final String helperName;
+    private final GenericHelperInfo helperInfo;
     private final long bankSize;
     private final String tableName;
     private final String nameColName;
     private final String idColName;
 
-    public SequenceUtil(String helperName, ModelEntity seqEntity, String nameFieldName, String idFieldName) {
-        this.helperName = helperName;
+    public SequenceUtil(GenericHelperInfo helperInfo, ModelEntity seqEntity, String nameFieldName, String idFieldName) {
+        this.helperInfo = helperInfo;
         if (seqEntity == null) {
             throw new IllegalArgumentException("The sequence model entity was null but is required.");
         }
-        this.tableName = seqEntity.getTableName(helperName);
+        this.tableName = seqEntity.getTableName(helperInfo.getHelperBaseName());
 
         ModelField nameField = seqEntity.getField(nameFieldName);
 
@@ -198,7 +199,7 @@ public class SequenceUtil {
                             ResultSet rs = null;
 
                             try {
-                                connection = ConnectionFactory.getConnection(SequenceUtil.this.helperName);
+                                connection = ConnectionFactory.getConnection(SequenceUtil.this.helperInfo);
                             } catch (SQLException sqle) {
                                 Debug.logWarning("[SequenceUtil.SequenceBank.fillBank]: Unable to esablish a connection with the database... Error was:" + sqle.toString(), module);
                                 throw sqle;