如何使用jee:jndi-lookup配置SpringJDBC

时间:2016-08-02 17:53:14

标签: java spring web.xml spring-jdbc

我在Spring JDBC设置中有一个问题。那更需要我吗?

缺少其他一些配置

    <jee:jndi-lookup id=" wasDataSource "
                     jndi-name="jdbc/xxxx"
                     cache="true"
                     resource-ref="true"
                     lookup-on-startup="false"
                     proxy-interface="javax.sql.DataSource"/>

道:

public class BinnacleDaoImpl implements BinnacleDao {

    @Autowired
    JdbcTemplate jdbcTemplate;

    @Autowired
    public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }

    public String getFindBitacoraForDate(){
            //ArrayList value = new ArrayList();

            FOP fop =  jdbcTemplate.queryForObject(
                    "SELECT DESCRIPTION_HTML FROM PHUBUSR.FOP WHERE ID = ?;",
                    new Object[]{1},
                    new RowMapper<FOP>() {
                        public FOP mapRow(ResultSet rs, int rowNum) throws SQLException {
                            FOP fop = new FOP();
                            fop.setDescripcionHtml(rs.getString("DESCRIPTION_HTML"));
                            return fop;
                        }
                    });
            System.out.println(fop.getDescripcionHtml());

            return null;
        }

感谢您的帮助

0 个答案:

没有答案