import java.math.BigDecimal;
import java.util.Collections;
import javax.sql.DataSource;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jdbc.core.simple.SimpleJdbcCall;
class Main {
public static void main(String args[]) throws Exception {
ApplicationContext ac = new ClassPathXmlApplicationContext("context.xml", Main.class);
DataSource dataSource = (DataSource) ac.getBean("dataSource");
// DataSource mysqlDataSource = (DataSource) ac.getBean("mysqlDataSource");
BigDecimal meaningOfLife = new SimpleJdbcCall(dataSource).withFunctionName("f_calculate")
.withReturnValue().executeObject(BigDecimal.class, Collections.emptyMap());
System.out.println(meaningOfLife);
}
}
|