I have a simple CMP EntityBean run on Weblogic Server 7.0, and I write these code:
TestEJB test = home.findByPrimaryKey(strKrimaryKey);
String detail = test.getDetail();
and the Server will print these lines:
It seems each function call on an EJB method will cause 2 database access and totally 4 database access, Will this cause performance issue? in my opinion, one "ejbLoad" can handle all these.
Check the weblogic docs for concurrency strategies and CACHE_BETWEEN_TRANSACTIONS settings. Depending on what you
plan to do with the EB you could set the various stategies to offset database hits using the servers caching options
You can also have the CMT of the EB set to Required and have it join the Transaction of the Session Bean calling method.
In WLS, all of the CMP persistence fields are grouped into different field groups. A field group is a grouping of fields that are loaded into memory when ANY one of the fields in the group is initially accessed. WLS creates a default group for the persistence fields that are not part of field group.
If you access any persistence field, all the persistence fields will be brought into memory.(Thats what happening with you).
If you create a custom field groups in the weblogic-cmp-rdbms-jar.xml file, WLS will institute LAZY loading. WLS will set the default group as a catch-all field group and use your fields groups as a priority instead. You can use the LAZY loading to optimize performance.