5,测试类
Java代码 收藏代码
package com.supan.test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.supan.dao.UserDao;
import junit.framework.TestCase;
public class JunitMainTest extends TestCase
{
public void testApringAndHibernate()
{
ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
UserDao ud = (UserDao)ctx.getBean("userDao");
ud.getUserNameAndInfo();
}
}
6,创建数据库表,并插入一条数据
-- Create table
create table TBL_USER
(
ID NUMBER(10) not null,
NAME VARCHAR2(20 CHAR),
INFO VARCHAR2(30 CHAR),
REMARK VARCHAR2(30 CHAR),
AGE VARCHAR2(3 CHAR)
);
insert into tbl_user values(hibernate_sequence.nextval,'chenchaoyang','is a good man','hahha','26');
7,存储过程
Java代码 收藏代码
/*创建存储过程,该存储过程三个参数,前两个是输出参数
最后一个是输入参数*/
create or replace procedure PROC_GETUSER_NAME_AGE(userName out varchar2,
userAge out varchar2,
userId in long)
AS
--声明该存储过程为“自治事物单元”
PRAGMA AUTONOMOUS_TRANSACTION;