Project:
View Revisions: Issue #33200 | [ Back to Issue ] | ||
Summary | 0033200: getId in DAL proxy loads object in memory | ||
Revision | 2016-07-13 15:08 by alostale | ||
Steps To Reproduce | 1. Enable Hibernate debug SQL logging 2. Execute the following code: Order proxy = OBDal.getInstance().getProxy(Order.class, SOME_KNOWN_ORDER_ID); proxy.getId(); 3. Check when 2nd line is executed the object is loaded in memory: select to c_order is executed |
||
Revision | 2016-06-14 09:03 by alostale | ||
Steps To Reproduce | 1. Enable Hibernate debug SQL logging 2. Execute the following code: Order proxy = OBDal.getInstance().getProxy(Order.class, SOME_UNKNOWN_ORDER_ID); proxy.getId(); 3. Check when 2nd line is executed the object is loaded in memory: select to c_order is executed |
||
Revision | 2016-06-09 09:43 by alostale | ||
Steps To Reproduce | 1. Enable Hibernate debug SQL logging 2. Execute the following code: Order proxy = OBDal.getInstance().getProxy(Order.class, SOME_KNOWN_ORDER_ID); proxy.getId(); 3. Check when 2nd line is executed the object is loaded in memory: select to c_order is executed |
||
Revision | 2016-06-09 09:41 by alostale | ||
Description | Getting id from a DAL proxy causes Hibernate object initialization: DB query and object to be loaded in memory. Which penalizes in performance in case the only property to be read is the id. This can be workarounded by using DalUtil.getId utility method which retrieves the id without loading the DAL object if the parameter was an uninitialized proxy. This workaround has two disadvantages: 1. Developers must keep it always in mind not to forget it when it is needed. Sometimes it is not obvious whether an object is initialized at some point or not. 2. It pollutes the code by adding boilerplate, ie.: String id; id = proxy.getId(); // this is what we want id = (String) DalUtil.getId(proxy); // this is what we need to write instead |
||
Revision | 2016-06-09 09:34 by alostale | ||
Description | Getting id from a DAL proxy causes Hibernate object initialization: DB query and object to be loaded in memory. Which penalizes in performance in case the only property to be read is the id. This can be workarounded by using DalUtil.getId utility method which retrieves the id without loading the DAL object if the parameter was an uninitialized proxy. This workaround has two disadvantages: 1. Developers must keep it always in mind not to forget it when it is needed. Sometimes it is not obvious whether an object is initialized at some point or not. 2. It pollutes the code by adding boilerplate, ie.: String id; id = proxy.getId(); // this is what we want id = (String) DalUtil.getId(proxy); // this is what we need to write instead |
Copyright © 2000 - 2009 MantisBT Group |