java存储过程的创建与调用
create or replace procedure updateProject is
begin
update project p set p.total_intend_gather =
(select sum(ig.gather_sum) from intend_gather ig where ig.project_number=p.project_number);
update project p set p.total_actual_gather =
(select sum(ag.gahter_sum) from actual_gather ag where ag.project_number=p.project_number);
update project p set p.total_invoice=
(select sum(invoice.invoice_sum) from invoice invoice
where invoice.intend_id in
(select ig.intend_id from intend_gather ig where ig.project_number=p.project_number));
end updateProject;
Session session = this.getSession();
Transaction tx =null;
try {
tx = session.beginTransaction();
Connection con = session.connection();
String procedure = "{call updateproject() }";
CallableStatement cstmt = con.prepareCall(procedure);
cstmt.executeUpdate();
tx.commit();
} catch (Exception e) {
tx.rollback();
}
相关文档:
String[] ips = ipValue.split("\\.");
String binaryVal = "";
for (int i = 0; i < ips.length; i++)
{
String binaryStr = Integer.toBinaryString(Integer.parseInt(ips[i]));
Integer times = 8 - binaryStr.length();
......
面向对象编程有三个特征,即封装、继承和多态。
封装隐藏了类的内部实现机制,从而可以在不影响使用者的前提下改变类的内部结构,同时保护了数据。
继承是为了重用父类代码,同时为实现多态性作准备。那么什么是多态呢?
方法的重写 ......
今天遇到一个很诡异的bug,调试了半天也没有看出来有什么问题,抽象一下代码如下:
public class Instance
{
public static Instance instance = new Instance();
public static Map<String, String> map = new HashMap<String, String>();
public static Instance instance()
{
r ......
现在UrlRewriter技术有两个技术平台的,一个就是在Java方向的,另一个就是.NET方向的。这次是Java方向的应用。
首先让我们了解它的工作原理,说白了它就是一个简单的过滤器(Filter),看看源码你就会很快的明白,它就是通过我们在jsp中常用的两个方法实现的forward(),sendRedirect().
下面我们就快速的为你的网站搭建U ......
public class Regex {
/**
* 检查email输入是否正确
* 正确的书写格式为 username@domain
* @param value
* @return
*/
public boolean checkEmail(String value, int length) {
return value.matches("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)* ......