1 Reply Latest reply on Jan 3, 2007 6:44 AM by chrismm

    Why findByPrimaryKey issues ?SELECT  pkey from TABLE where p

    anbuselvan

      Why findByPrimaryKey issues ?SELECT pkey from TABLE where pkey=??

      We use jboss-4.0.0 in 2 node cluster configuration with ?Standard CMP 2.x EntityBean with cache invalidation?, commit option A.

      Whenever our application invokes ?findByPrimaryKey? on CMPs, JBOSS issues ?SELECT pkey from TABLE where pkey=??. This ?SELECT? makes sense when entity is loaded for first time, I am not sure why ?findByPrimaryKey? issues ?SELECT pkey from TABLE where pkey=?? on subsequent request for the same entity(for same primary key) instead of getting it from cache.

      We are trying to optimize DB access by cutting down on the number of ?SELECT? queries issued.

      Is it possible to avoid the ?SELECT? issued by findByPrimaryKey on subsequent invocation on already loaded entity? If yes, please provide me some pointers on how to do this.