Hello,
As I userstand correctly from my experience, Session.get() will load the object if it exists. in this case it will result in loading the object twice:
1. DAO.findByPrimaryKey loads object, returns object primary key, discards the loaded object
2. beans ejbLoad() loads object again
In findByPrimaryKey all I need to know is if the specified object exists and not load them and waste precious time. I thought using JDBC query just to check if the specified id exists would be fastest way for findByPrimaryKey, but perhaps there is a better way to do it in Hibernate? Like lazy loading of objects queried for or something?
_________________ ---
Best Regards,
Tomasz Luczynski
|