OFBiz使用小的注意点
delegator是与数据库交互的对象
GenericDelegatordelegator = GenericDelegator.getGenericDelegator("default");//过期,但有效
Delegator delegator = (GenericDelegator)request.getAttribute("delegator");//通过ofbiz的请求时有效
EntityComparisonOperator已经不可用了,用EntityOperator代替
String module = TrustsgMallGeneralServices.class.getName();//用于DEBUG写方法名GenericValue? 通用实体对象(定义于entity_model.xml映射到数据库)
内置验证方法 org.ofbiz.base.util.UtilValidate
查数据,查出来的也是对象
condition = new EntityExpr("planetId", EntityOperator.EQUALS, "EARTH");data = delegator.findByCondition("Planet", condition, null, null);以上代码等价于SELECT * FROM Planet WHERE planetId = "EARTH"其中EntityOperator 为ofbiz逻辑操作符号类。EQUALSNOT_EQUALLESS_THANGREATER_THANLESS_THAN_EQUAL_TO (less than or equal to)GREATER_THAN_EQUAL_TOINNOT_INBETWEENLIKENOT_LIKENOT?
?
Ofbiz 的return 在org.ofbiz.webapp.event.CoreEvents 中有 returnSuccess等方法
findByConditin 方法已经过期,现在可以用findList代替?