Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Revisions: Issue #33200 All Revisions ] Back to Issue ]
Summary 0033200: getId in DAL proxy loads object in memory
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
Powered by Mantis Bugtracker