mybatis配置按时间查询oracle数据
1.mybatis中查询sql配置
<select id="findArticleByid" parameterType="com.hehe.ParaBean" resultType="com.hehe.bean.Page">
select * from table p where p.time <;= #{time}
and p.id = #{id}
</select>
public void test(){
SqlSessionFactory sqlSessionFactory = DBSqlSessionFactory.getInstance("DBname");
SqlSession sqlSession = sqlSessionFactory.openSession();
ParaBean paraBean = new ParaBean();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Date date = format.parse("2011-01-01 00:00:00");
paraBean.setId(111840);
paraBean.setTime(date);
} catch (ParseException e) {
e.printStackTrace();
}
List<Page> list = sqlSession.selectList("com.heh