Hibernate的原生SQL查询
折腾了我半天终于搞定了
参考了这个文章:http://doc.javanb.com/hibernate-reference-3-2-0-zh/ch16.html
final static String querySql = "select {enterprise.*}, {dict.*} ,{balancd.*}, {weightinfo.*} "
+ "from weight_info weightinfo left outer join t_dict dict on {weightinfo}.productcode={dict}.code join "
+ "t_balancecode {balancd} on {weightinfo}.balancecode={balancd}.balancecode join t_enterprise enterprise "
+ "on {enterprise}.id={balancd}.enterpriseid where "
+ " {weightinfo}.operdate>TO_TIMESTAMP('2009-11-2 04:12:32.0', 'yyyy-mm-dd hh24:mi:ssxff')";
public List loadByQuerySql(final String querySql, final Map params) {
try {
return (List) getHibernateTemplate().execute(
new HibernateCallback() {
public Object doInHibernate(Session session)
throws HibernateException, SQLException {
// Connection c= session.connection();
Query query = session.createSQLQuery(querySql)
.addEntity("weightinfo",WeightInfo.class)
.addEntity("dict",Dict.class)
.addEntity("balancd",BalanceCode.class)
.addEntity("enterprise",Enterprise.class);
// fillParams(query,params);
return query.list();
}
});
} catch (HibernateException e) {
e.printStackTrace();
}
return new ArrayList();
}
如果不是全部参与的table都返回值,那么
public Object doInHibern
相关文档:
Maximizing SQL*Loader Performance
SQL*Loader is flexible and offers many options that should be considered to maximize the speed of data loads. These include:
● Use Direct Path Loads - The conventional path loader essentially loads the data by usin ......
SQL数据恢复软件 Log Explorer for SQL Server v4.0
log explorer使用的几个问题
1)对数据库做了完全 差异 和日志备份
备份时选用了删除事务日志中不活动的条目
再用Log explorer打试图看日志时
提示No log recorders found that match the filter,would you like to view unfiltered ......
在我们做数据库程序开发的时候,经常会遇到这种情况:需要将一个数据库服务器中的数据导入到另一个数据库服务器的表中。通常我们会使用这种方法:先把一个数据库中的数据取出来放到某出,然后再把这些数据一条条插入到目的数据库中,这种方法效率较低,写起程序来也很繁琐,容易出错。另外一种方法是使用bcp或BULK IN ......
Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM
Select CONVERT(varchar(100), GETDATE(), 1): 05/16/06
Select CONVERT(varchar(100), GETDATE(), 2): 06.05.16
Select CONVERT(varchar(100), GETDATE(), 3): 16/05/06
Select CONVERT(varchar(100), GETDATE(), 4): 16.05.06
Select CONVERT ......