JDBCTemplate无法将数据插入Oracle

代码如下:
[code="java"]
DataSource dataSource = SpringContextHolder.getBean("dataSource");
template = new JdbcTemplate(dataSource);
String sql = "INSERT INTO ca_role_authority(role_id,authority_id) VALUES ('"
+ roleId + "','" + authorityId + "')";
template.update(sql);
[/code]
测试代码:
[code="java"]

private void addRoleAuthorityRelation() {
DataService service = new DataService();
String roleId = "9527";
String authorityId = "999999";
service.addRoleAuthorityRelation(roleId, authorityId);
List auths = service.getAuthorityIdsByRoleId("9527");
System.out.println("auths size : " + auths.size());
for (String auth : auths) {
System.out.println(auth);
}
}
[/code]
打印出来的auths size 是0

你是否在service层加了事务控制,如果有,应该是你的事务没有提交成功导致的

从上面看很有可能是你的datasource问题,你应该首先看日志报什么错误
要是你插入之后数据库没有数据的话,那说明是你插入有问题
若是你数据库有数据,则查询不出,则是你的查询有问题。
需要看情况,上面信息不好判断