是hibernate老老实实操作对象,把类型映射成Integer就可以了。不是Hibenrate,PreparedStatement pst = null;
pst.setNull(1, java.sql.Types.NULL);

解决方案 »

  1.   

    if(sage==null){
      xxxService.executeUpdate("update Student t set t.sName=?...t.sAge=null....., new Object[]{sname,addr,re,sId});
    }else{
      你原来的代码
    }
      

  2.   

    hibernate了不操作对象的还有null的情况,要么你内部对null做判断要么用不要hql用sql
      

  3.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
            "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
        <script type="text/javascript" src="../internal.js"></script>
        <link rel="stylesheet" type="text/css" href="video.css" />
    </head>
    <body>
    <div class="wrapper">
        <div id="videoTab">
            <div id="tabHeads" class="tabhead">
                <span tabSrc="video" class="focus"><var id="lang_tab_insertV"></var></span>
                <span tabSrc="videoSearch"><var id="lang_tab_searchV"></var></span>
            </div>
            <div id="tabBodys" class="tabbody">
                <div id="video" class="panel">
                   <table><tr><td><label for="videoUrl" class="url"><var id="lang_video_url"></var></label></td><td><input id="videoUrl" type="text"></td></tr></table>
                   <div id="preview"></div>
                   <div id="videoInfo">
                       <fieldset>
                           <legend><var id="lang_video_size"></var></legend>
                           <table>
                               <tr><td><label for="videoWidth"><var id="lang_videoW"></var></label></td><td><input class="txt" id="videoWidth" type="text"/></td></tr>
                               <tr><td><label for="videoHeight"><var id="lang_videoH"></var></label></td><td><input class="txt" id="videoHeight" type="text"/></td></tr>
                           </table>
                       </fieldset>
                       <fieldset>
                          <legend><var id="lang_alignment"></var></legend>
                          <div id="videoFloat"></div>
                      </fieldset>
                   </div>
                </div>
                <div id="videoSearch" class="panel" style="display: none">
                    <table style="margin-top: 5px;">
                        <tr>
                            <td><input id="videoSearchTxt"  type="text" /></td>
                            <td>
                                <select id="videoType">
                                    <option value="0"></option>
                                    <option value="29"></option>
                                    <option value="1"></option>
                                    <option value="5"></option>
                                    <option value="15"></option>
                                    <option value="21"></option>
                                    <option value="31"></option>
                                </select>
                            </td>
                            <td><input id="videoSearchBtn" type="button"/></td>
                            <td><input id="videoSearchReset" type="button" /></td>
                        </tr>
                    </table>
                    <div id="searchList"></div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript" src="video.js"></script>
    <script type="text/javascript">
        window.onload = function(){
            video.init();
            $focus($G("videoUrl"));
        };
    </script>
    </body>
    </html>
      

  4.   


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
            "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
        <script type="text/javascript" src="../internal.js"></script>
        <link rel="stylesheet" type="text/css" href="video.css" />
    </head>
    <body>
    <div class="wrapper">
        <div id="videoTab">
            <div id="tabHeads" class="tabhead">
                <span tabSrc="video" class="focus"><var id="lang_tab_insertV"></var></span>
                <span tabSrc="videoSearch"><var id="lang_tab_searchV"></var></span>
            </div>
            <div id="tabBodys" class="tabbody">
                <div id="video" class="panel">
                   <table><tr><td><label for="videoUrl" class="url"><var id="lang_video_url"></var></label></td><td><input id="videoUrl" type="text"></td></tr></table>
                   <div id="preview"></div>
                   <div id="videoInfo">
                       <fieldset>
                           <legend><var id="lang_video_size"></var></legend>
                           <table>
                               <tr><td><label for="videoWidth"><var id="lang_videoW"></var></label></td><td><input class="txt" id="videoWidth" type="text"/></td></tr>
                               <tr><td><label for="videoHeight"><var id="lang_videoH"></var></label></td><td><input class="txt" id="videoHeight" type="text"/></td></tr>
                           </table>
                       </fieldset>
                       <fieldset>
                          <legend><var id="lang_alignment"></var></legend>
                          <div id="videoFloat"></div>
                      </fieldset>
                   </div>
                </div>
                <div id="videoSearch" class="panel" style="display: none">
                    <table style="margin-top: 5px;">
                        <tr>
                            <td><input id="videoSearchTxt"  type="text" /></td>
                            <td>
                                <select id="videoType">
                                    <option value="0"></option>
                                    <option value="29"></option>
                                    <option value="1"></option>
                                    <option value="5"></option>
                                    <option value="15"></option>
                                    <option value="21"></option>
                                    <option value="31"></option>
                                </select>
                            </td>
                            <td><input id="videoSearchBtn" type="button"/></td>
                            <td><input id="videoSearchReset" type="button" /></td>
                        </tr>
                    </table>
                    <div id="searchList"></div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript" src="video.js"></script>
    <script type="text/javascript">
        window.onload = function(){
            video.init();
            $focus($G("videoUrl"));
        };
    </script>
    </body>
    </html>
      

  5.   

    判断谁有值谁没值,用sql或hql都行,有值的直接拼接