易截截图软件、单文件、免安装、纯绿色、仅160KB

hibernate根据时间日期来查询oracle数据库

使用模糊查询:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd"); 
Date startdate = sdf.parse(start_date);
Date enddate = sdf.parse(end_date);
List list = sess.createCriteria(MyTabel.class)
               .add( Restrictions.eq("clinid", start_clinId) )
               .add( Restrictions.between("idate", startdate, enddate) ) .list();
使用oracle本身的函数
session.find("from Weather w where w.recordTiime=to_date('"+ datestr +"', 'yyyy-mm-dd hh24:mi:ss')")
其中datestr是形如"2005-03-01 11:30:00"格式的字符串
Spring集成hibernate
public List findResult(final String bankid,final String begintime,final String endtime) {
   log.debug("finding Result Ydopehb instances");
   java.util.Date bd=DateUtil.getDate(begintime);
   java.util.Date ed=DateUtil.getDate(endtime);
  
  
  
   java.sql.Date bdate = new java.sql.Date(bd.getTime());  
   java.sql.Date edate = new java.sql.Date(ed.getTime());
   try {
    String queryString = "from Ydopehb where bankid='"
     + bankid +"' and feetime between :begintime and :endtime ";
    
   
    return getHibernateTemplate().findByNamedParam(queryString, new String[]{"begintime","endtime"}, new java.sql.Date[]{bdate,edate}) ;
   } catch (RuntimeException re) {
    log.error("find Result failed", re);
    throw re;
   }
}
其中DateUtil 是自定义的工具类,用来在Date类型和String类型之间互相转换。


相关文档:

oracle优化

我们要做到不但会写SQL,还要做到写出性能优良的SQL,以下为笔者学习、摘录、并汇总部分资料与大家分享!
(1)选择最有效率的表名顺序(只在基于规则的优化器中有效):
orACLE的解析器按照从右到左的顺序处理from子句中的表名,from子句中写在最后的表(基础表 driving table)将被最先处理,在from子句中包含多个表的情况下, ......

ORACLE标签收藏

@@servername:返回运行SQL Server数据库本地服务器的名称。
@@remserver:返回登录记录中记载的远程SQL Server服务器的名称。
@@connections:返回自上次启动SQL Server以来连接或试图连接的次数,用其可让管理人员方便地了解今天所有试图连接服务器的次数。
@@cursor_rows:返回最后连接上并打开的游标中当前存在的合格 ......

ORACLE 一致读(Consistent Read)的步骤

1. Read the Data Block.
2. Read the Row Header.
3. Check the Lock Byte to determine whether there's an ITL entry.
4. Read the ITL entry to determine the Transaction ID (Xid).
5. Read the Transaction Table using the Transaction ID. If the transaction has been committed and has a System Commit ......

Windows下常见Oracle服务介绍

那些服务需要启动需要看你自己的需求,详见:
Windows下常见Oracle服务介绍:
(1)OracleServiceSID                       
  数据库服务,这个服务会自动地启动和停止数据库。如果安装了 ......

oracle判断对象是否存在

declare    
    v_isexist number(3,0):=0;  
begin  
    select count(1) into v_isexist from sys.all_objects where owner = 'TEST' and object_type = 'TABLE' and object_name = 'TAB1';
    if  v_isexist>0 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号