2

SimpleJdbcDaoSupport オブジェクトを使用して DB リソースにアクセスしています。特定のキーを持つレコードを見つけるために、データベースに対して頻繁に実行されるクエリがあります。何らかの理由で、同じクエリを数回実行した後、データベースにレコードが存在するにもかかわらず、空の結果が得られ始めました。

この動作を引き起こす可能性のあるアイデアはありますか?

daoSupport.getJdbcTemplate().query(this.getConsumerTokenQueryStatement(),params, this.rowMapper); 
 public static class TokenServicesRowMapper implements RowMapper {  
   public Object mapRow(ResultSet rs, int rowNum) throws SQLException { 
     DefaultLobHandler lobHandler = new DefaultLobHandler(); 
     return lobHandler.getBlobAsBytes(rs, 1); 
   } 
}
4

1 に答える 1

1

If this is not related to your code one reason can be the fact that another transaction is doing something (like an update) to the row you search and due do the isolation between transactions you cannot see your row. One transaction can change but not commit your row yet while in the same time the other one is searching for it but as it can only see committed rows it does not see your row.

于 2011-08-17T07:25:31.657 に答える