Improved: Replace all delegator findByAnd and findOne method calling by EntityQuery methods (OFBIZ-10029)
Applied slightly modified patch, rearrange import properly, Thanks Suraj Khurana for your contribution git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1818003 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -33,7 +33,7 @@ if (security.hasPermission("ENTITY_MAINT", session)) {
|
||||
calls = 1000
|
||||
startTime = System.currentTimeMillis()
|
||||
for (int i = 0; i < calls; i++) {
|
||||
dummy = delegator.findOne("JobSandbox", [jobId : "PURGE_OLD_JOBS"], false)
|
||||
dummy = from("JobSandbox").where("jobId", "PURGE_OLD_JOBS").queryOne();
|
||||
}
|
||||
totalTime = System.currentTimeMillis() - startTime
|
||||
callsPerSecond = calls / (totalTime/1000)
|
||||
@@ -50,7 +50,7 @@ if (security.hasPermission("ENTITY_MAINT", session)) {
|
||||
calls = 10000
|
||||
startTime = System.currentTimeMillis()
|
||||
for (int i = 0; i < calls; i++) {
|
||||
dummy = delegator.findOne("JobSandbox", [jobId : "PURGE_OLD_JOBS"], true)
|
||||
dummy = from("JobSandbox").where("jobId", "PURGE_OLD_JOBS").cache().queryOne();
|
||||
}
|
||||
totalTime = System.currentTimeMillis() - startTime
|
||||
callsPerSecond = calls / (totalTime / 1000)
|
||||
@@ -67,7 +67,7 @@ if (security.hasPermission("ENTITY_MAINT", session)) {
|
||||
calls = 1000
|
||||
startTime = System.currentTimeMillis()
|
||||
for (int i = 0; i < calls; i++) {
|
||||
dummy = delegator.findOne("DataSourceType", [dataSourceTypeId : "ADMIN_ENTRY"], false)
|
||||
dummy = from("DataSourceType").where("dataSourceTypeId", "ADMIN_ENTRY").queryOne();
|
||||
}
|
||||
totalTime = System.currentTimeMillis() - startTime
|
||||
callsPerSecond = calls / (totalTime / 1000)
|
||||
@@ -84,7 +84,7 @@ if (security.hasPermission("ENTITY_MAINT", session)) {
|
||||
calls = 10000
|
||||
startTime = System.currentTimeMillis()
|
||||
for (int i=0; i < calls; i++) {
|
||||
dummy = delegator.findOne("DataSourceType", [dataSourceTypeId : "ADMIN_ENTRY"], true)
|
||||
dummy = from("DataSourceType").where("dataSourceTypeId", "ADMIN_ENTRY").cache().queryOne()
|
||||
}
|
||||
totalTime = System.currentTimeMillis() - startTime
|
||||
callsPerSecond = calls / (totalTime / 1000)
|
||||
|
||||
@@ -81,7 +81,7 @@ context.put("curFindString", curFindString)
|
||||
GenericValue value = null
|
||||
//only try to find it if this is a valid primary key...
|
||||
if (findByPK.isPrimaryKey()) {
|
||||
value = delegator.findOne(findByPK.getEntityName(), findByPK, false)
|
||||
value = from("findByPK.getEntityName()").where(findByPK).queryOne();
|
||||
}
|
||||
context.put("value", value)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user