The purpose of this post is to review database query best practices for iDempiere customization/plugin development. The core iDempiere developers do a great job of keeping iDempiere fast as stable. When you start customizing iDempiere with plugins, you can compromise this stability if you are not careful. Creating queries against a database is an area where you can start leaking resources quickly. There are two approaches for quick and easy queries:
- DB class static methods
- Query class for tables with existing models
If you need a quick, one-off query, the DB class => getSQLValueEx… static methods are great resources. They offer two benefits: (a) you can execute a query in two clean lines of code, and (b) you can view the method source to see how to use lower level resources when needed. You can see an example of getSQLValueEx(…) here. If you do not have a database transaction, just pass in null, and a new transaction will be created and destroyed for you.
If you want to quickly interact with a model, the Query class is a great tool. You can write java code to load data from a database directly into a java class. You can see an example of Query in MOrder.getLines(…).
iDempiere is full of examples of best practices; however, finding them is hard. I support the ERP Academy. I spend much of my time helping developers understand the code base and finding examples to support their specific needs. I hope for the opportunity to help you. You can learn more about the ERP Academy here. I hope this helps!
What is the best way to Learn iDempiere and ADempiere?
I teach an on-line class that covers how to learn, configure and audit open source ERP. It uses iDempiere as the reference ERP. Here are the course frequently asked questions. I have learned much over the last fourteen years, and I have much to share. I look forward to seeing you there!!
Why consider Open Source ERP?
Open source ERP gives you every opportunity to prove or disprove its ability to support your company’s ERP needs on a timeline that satisfies your organizational needs. With open source ERP, you do not face the same financial constraints nor do you face the same conflicts of interest as with commercial ERP. Instead, you invest in the appropriate skills and knowledge for your people and processes. Best of all – if open source ERP cannot solve your company’s needs, you can safely justify spending the additional $2K to $5K per person per year for life of your commercial ERP to help drive your organization’s success.
Open Source ERP Round Rug Effect
Open Source ERP has what I call a “Round Rug Effect”. If you were to liken the ERP evaluation process to a 10′ x 10′ room, the story would go something like this:
- Oracle, SAP, and Microsoft are a 10′ x 10′ ERP rug in a ten by ten foot room. They cover the room nicely. You will be hard pressed to find a feature or a use case that they do not cover.
- Open Source ERP is like a 10′ round rug in a ten by ten foot room. It will cover the vast majority of the room; however, it will leave the corners bare. The questions are: “Do you live and operate in the corners?” or “Is open source ERP good enough?”. For most, the answers are “sometimes” and “yes”.
If you are in the ERP evaluation mode, you should ask yourself “Should I include open source ERP in my evaluation process?” If you are less than $300M USD revenue, your answer should probably be yes! This answer comes from these concepts:
- Pillars of Cost – Since open source ERP is free, that means that all the cost of proprietary ERP should be allocated to the corners. If you use height to illustrate this allocated cost, the corners turn into tall pillers of cost.
- Cost of Innovation – At first look, the price tag of free open source ERP is the most appealing benefit; however, this benefit soon becomes overshadowed by the flexibility of open source ERP. If organizational leaders take just some of the cost that would otherwise be spent on Oracle or SAP, and they invest it back into the organization’s skills and knowledge of how ERP works, operational efficiency will never look the same again. If you know how to change the system for the better, and you know it will work. Why would you not?
- Monday to Monday Cycle – Business leaders drive innovation in a company. This innovation is no more apparent than in the traditional Monday morning business meeting where a CEO comes in and paints a picture of the next greatest thing. His or her next comments are “Will it work?” and “Make it happen!”. Open source ERP helps your business and IT teams say yes more often. You are no longer completely dependent on a high-priced Oracle Integrators. You are no longer dependent on spending 18% every year to Oracle for software that you have little control over. Your team applies its knowledge of the system and the knowledge of its world-wide resources to create a proof of concept that paints the real picture the following Monday.
- Right Pay Grade – Open source ERP puts the right tools in the right person’s hands at the right pay-grade. there is little more wasteful that paying a $150/hr integrator for something a Jr IT professional should be doing. Open Source ERP removes the artificial barriers that exist in proprietary ERP.
- ERP for Everyone – User licenses/seats are no longer a consideration. This point cannot be stated strongly enough. At first look, you might think this point is about saving money. It is much more than that. You now have the freedom and flexibility of allowing everyone in your company to interact the system that drives your operations. You simply assign the right roles to the right people to give them access to the appropriate information.
ADempiere vs iDempiere vs Openbravo vs Compiere
The ADempiere, iDempiere, Openbravo and Compiere environments are amazingly similar. iDempiere came from ADempiere. ADempiere and Openbravo came from Compiere. Compiere came from Jorg Janke. Jorg came from Oracle. As a result, iDempiere and ADempiere have much in common with Oracle’s ERP in terms of the financial feature set.
This is both good and bad. Good because iDempiere and ADempiere are quite capable to help a company grow beyond $500M USD. Bad because they tend to be more complex in that they account for multiple languages, accounting schemas, currencies, calendars, costing types, costing methods, etc…. If you are a growing organization, and you need a system that will grow with you, and you have the right internal talent/resources, iDempiere or ADempiere will be a big asset for you.
The biggest difference between these products is that ADempiere and iDempiere are pure open source. ADempiere and iDempiere make all feature available for free. Compiere and Openbravo hold back features behind a commercial or paid license.
Here is an article that discusses the differences between iDempiere and ADempiere.
iDempiere and ADempiere vs Odoo
iDempiere/ADempiere (iD/AD) and Odoo (formerly OpenERP) approach ERP from two very different directions. Odoo comes out of the box with very simple options. If you are coming from QuickBooks, and you need a simple ERP system help you manage your business, Odoo will look and feel comfortable.
iD/AD comes out of the box with every feature installed and configured to run a $200M+ USD business. If your business is growing rapidly, and you are willing to invest the time to learn an enterprise accounting system, then iD/AD will give you confidence.
Which one is best for you depends on your internal talent, growth and business complexity. Here is a post to help you learn more.