易截截图软件、单文件、免安装、纯绿色、仅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 constraints(2)

oracle 约束的状态
  oracle在创建约束后默认状态是enabled VALIDATED
SQL> create table T2
2 (
3 VID NUMBER,
4 VNAME VARCHAR2(10) not null,
5 VSEX VARCHAR2(10) not null
6 )
7 /

Table created

SQL> alter table t2 add constraints PK_T primary key (vid); ......

Linux下的Oracle 10g安装及配置

一.资源需要:
至少1024 MB物理内存
1024-2048 需1.5倍的交互空间
2048-8192 需1倍的交互空间
8192- 需0.75倍的交互空间
至少400 MB /tmp 临时目录空间
oracle软件需要1.5 GB 到 3.5 GB 磁盘空间
默认数据库需要1.2 GB
二.查看系统资源相关语 ......

Windows下常见Oracle服务介绍

那些服务需要启动需要看你自己的需求,详见:
Windows下常见Oracle服务介绍:
(1)OracleServiceSID                       
  数据库服务,这个服务会自动地启动和停止数据库。如果安装了 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号