I also checked with the single point of truth - the database.
For those interested...

Mapping:
 <select id="getRegisteredAction" resultClass="registeredAction">
   SELECT REAC_ID as id
   ,      REAC_NAME as name
   ,      REAC_DESCRIPTION as description
   ,      REAC_IND_ACTIVE as active
   FROM   CXF_REGISTERED_ACTIONS
   WHERE  REAC_ID = #value#
 </select>

Mini tester:

public static void main(String[] args) throws SQLException {
  SqlMapClient sqlMap = SqlMapConfig.getSqlMapInstance();
  PreparedStatement stmt = sqlMap.getCurrentConnection().
    prepareStatement("alter system set sql_trace=true");
  stmt.execute();

sqlMap.queryForObject ("getRegisteredAction", new Long(1)); sqlMap.queryForObject ("getRegisteredAction", new Long(2));
}

Execute the above on a freshly started database instance.

Interpretation of Oracle trace file:

1st occurrence:

PARSING IN CURSOR #3 len=190 dep=0 uid=57 oct=3 lid=57 tim=2640378680 hv=2472912027 ad='69e65bc8' SELECT REAC_ID as id , REAC_NAME as name , REAC_DESCRIPTION as description , REAC_IND_ACTIVE as active FROM CXF_REGISTERED_ACTIONS WHERE REAC_ID = *:1* END OF STMT
PARSE #3:c=0,*e=353*,p=0,cr=0,cu=0,*mis=1*,r=0,dep=0,og=1,tim=2640378675

2nd occurrence:

PARSING IN CURSOR #4 len=190 dep=0 uid=57 oct=3 lid=57 tim=2640557676 hv=2472912027 ad='69e65bc8' SELECT REAC_ID as id , REAC_NAME as name , REAC_DESCRIPTION as description , REAC_IND_ACTIVE as active FROM CXF_REGISTERED_ACTIONS WHERE REAC_ID = :1 END OF STMT
PARSE #4:c=0,*e=59*,p=0,cr=0,cu=0,*mis=0*,r=0,dep=0,og=1,tim=2640557673

Notice that:

  1. Bind variables are actually used   *:1*
  2. 1st occurence is an Oracle hard parse indicated by a library cache
     mis  *mis=1*
  3. 2nd occurence is an Oracle soft parse indicated by a library cache
     hit  *mis=0*
  4. Hard parses are (obviously) more expensive than soft, *353 vs. 59*

-J.

Sven Boden wrote:

Sorry for that... the difference between # and $... # results in
parameter markers. It's getting too late for me (for the developers...
at
com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser)

Back to the thinking board.

Regards,
Sven






--
Cumquat Information Technology
De Dreef 19
3706 BR Zeist
T +31 (0)30 - 6940490
F +31 (0)10 - 6940499
http://www.cumquat.nl

[EMAIL PROTECTED]
M +31 6 51 169 556


Reply via email to