<code id="ymukc"><xmp id="ymukc">

spring jdbcTemplate 插入對象返回主鍵值

ScaNIV的頭像 ScaNIV 0 2016-03-04 14:54 0


× 1   

瀏覽數: 22140

分享時間: 2 年 前

public int addClifford(Clifford clifford) {
    String sql = "insert into t_user_clifford(mobile,last_activity_date,clifford_count,is_share)values(?,?,?,?)";
    int idResult = 0;
    KeyHolder keyHolder = new GeneratedKeyHolder();
    jdbcTemplateActivityWrite.update(new PreparedStatementCreator() {
        public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
            PreparedStatement ps = connection.prepareStatement(sql,PreparedStatement.RETURN_GENERATED_KEYS);
            return ps;
    idResult = keyHolder.getKey().intValue();
    return idResult;

  • ossaa的頭像 ossaa 2018-09-02 18:28 代碼數:0

    This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post! Toronto Homes Canada

  • ossaa的頭像 ossaa 2018-09-06 23:02 代碼數:0

    It is imperative that we read blog post very carefully. I am already done it and find that this post is really amazing.

    EMS Ger?te

  • cixexey 的頭像 cixexey 2018-09-17 20:56 代碼數:0

    I really appreciate this wonderful post that you have provided for us. I assure this would be beneficial for most of the people. tech tips

  • pevahanifo的頭像 pevahanifo 2018-09-22 19:21 代碼數:0

    I have read your article, it is very informative and helpful for me.I admire the valuable information you offer in your articles. Thanks for posting it.. technology and business tips

  • cixexey的頭像 cixexey 2018-08-20 19:06 代碼數:0

    I really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful. Good day! suzuki coin

  • cixexey的頭像 cixexey 2018-08-24 19:15 代碼數:0

    Thank you so much for the post you do. I like your post and all you share with us is up to date and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job. Michigan Personal Injury Law Firm

  • AsharSeo的頭像 AsharSeo 2018-10-12 05:50 代碼數:0

    The post is composed in exceptionally a decent way and it contains numerous helpful data for me.



  • 淡淡人生的頭像 淡淡人生 2016-03-04 15:08 代碼數:0
  • pevahanifo的頭像 pevahanifo 2018-08-26 14:15 代碼數:0

    I just want to let you know that I just check out your site and I find it very interesting and informative..Tile Cleaning


<code id="ymukc"><xmp id="ymukc">
<code id="ymukc"><xmp id="ymukc">