<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    少年阿賓

    那些青春的歲月

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      500 Posts :: 0 Stories :: 135 Comments :: 0 Trackbacks

    package com.abin.lee.bean;

    /**
     * Userbean entity. @author MyEclipse Persistence Tools
     */

    public class UserBean implements java.io.Serializable {

     // Fields

     private String id;
     private String username;
     private String password;

     // Constructors

     /** default constructor */
     public UserBean() {
     }

     /** minimal constructor */
     public UserBean(String id) {
      this.id = id;
     }

     /** full constructor */
     public UserBean(String id, String username, String password) {
      this.id = id;
      this.username = username;
      this.password = password;
     }

     // Property accessors

     public String getId() {
      return this.id;
     }

     public void setId(String id) {
      this.id = id;
     }

     public String getUsername() {
      return this.username;
     }

     public void setUsername(String username) {
      this.username = username;
     }

     public String getPassword() {
      return this.password;
     }

     public void setPassword(String password) {
      this.password = password;
     }

    }





    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "<!--
        Mapping file autogenerated by MyEclipse Persistence Tools
    -->
    <hibernate-mapping>
        <class name="com.abin.lee.bean.UserBean" table="USERBEAN" schema="ABING">
            <id name="id" type="string">
                <column name="ID" length="80" />
                <generator class="assigned" />
            </id>
            <property name="username" type="string">
                <column name="USERNAME" length="80" />
            </property>
            <property name="password" type="string">
                <column name="PASSWORD" length="80" />
            </property>
        </class>
    </hibernate-mapping>






    package com.abin.lee.dao;

    import java.sql.SQLException;

    import org.hibernate.SQLQuery;
    import org.hibernate.Session;
    import org.hibernate.SessionFactory;
    import org.hibernate.Transaction;
    import org.hibernate.cfg.Configuration;

    public class UserDao {
     private static final ThreadLocal<Session> threadLocal = new ThreadLocal<Session>();
     private static SessionFactory sessionFactory;
     static {
      sessionFactory=new Configuration().configure().buildSessionFactory();
     }
     public static Session GetSession(){
      Session session=(Session)threadLocal.get();
      if(null == session|| !session.isOpen()){
       if(null==sessionFactory){
        sessionFactory=new Configuration().configure().buildSessionFactory();
       }
       session=(sessionFactory!=null)?sessionFactory.openSession():null;
       threadLocal.set(session);
      }
      return session;
     }
     
     public static int insert(String id,String usr,String pwd) throws SQLException{
      UserDao UserDao=new UserDao();
      Session session=UserDao.GetSession();
      Transaction tx=session.beginTransaction();
      SQLQuery sqlQuery = session.createSQLQuery("{call insertObj(?,?,?)}");
      sqlQuery.setParameter(0, id);
      sqlQuery.setParameter(1, usr);
      sqlQuery.setParameter(2, pwd);
      int result=sqlQuery.executeUpdate();
      System.out.println("result="+result);
      return result;
     }
     
    }






    package com.abin.lee.test;

    import java.sql.SQLException;

    import junit.framework.TestCase;

    import com.abin.lee.dao.UserDao;

    public class UserTest extends TestCase{
     public void test() throws SQLException{
      UserDao user=new UserDao();
      int success=user.insert("abin","abing","bing");
      System.out.println("success="+success);
     }
    }








    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE hibernate-configuration PUBLIC
              "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
              "

    <!-- Generated by MyEclipse Hibernate Tools.                   -->
    <hibernate-configuration>

     <session-factory>
      <property name="dialect">
       org.hibernate.dialect.OracleDialect
      </property>
      <property name="connection.url">
       jdbc:oracle:thin:@localhost:1521:xe
      </property>
      <property name="connection.username">abing</property>
      <property name="connection.password">abing</property>
      <property name="connection.driver_class">
       oracle.jdbc.driver.OracleDriver
      </property>
      <property name="myeclipse.connection.profile">
       OracleConnection
      </property>
      <mapping resource="com/abin/lee/bean/UserBean.hbm.xml" />
       
        </session-factory>

    </hibernate-configuration>








    主站蜘蛛池模板: 亚洲无码精品浪潮| 亚洲国产精品一区二区第一页免| 亚洲男人的天堂www| 一级毛片大全免费播放下载 | 日本人的色道免费网站| 久久久久亚洲AV成人无码| 久久精品一区二区免费看| 亚洲视频在线观看| 中文字幕亚洲免费无线观看日本| 亚洲网红精品大秀在线观看| 99久久精品免费精品国产| 亚洲国产日韩在线人成下载| 无码永久免费AV网站| 亚洲日本中文字幕天天更新| 国产小视频在线观看免费| 一个人看的免费观看日本视频www 一个人看的免费视频www在线高清动漫 | aa午夜免费剧场| 亚洲情综合五月天| 24小时日本韩国高清免费| 亚洲一区精彩视频| 免费女人18毛片a级毛片视频| igao激情在线视频免费| 亚洲一级二级三级不卡| 最近中文字幕无免费视频| 精品一区二区三区免费毛片| 亚洲女初尝黑人巨高清| 1000部国产成人免费视频| 亚洲色一区二区三区四区 | 永久在线毛片免费观看| 五级黄18以上免费看| 亚洲国产综合91精品麻豆| 成年女人午夜毛片免费看| 一级做a爰片久久免费| 亚洲麻豆精品果冻传媒| 成人国产mv免费视频| 青柠影视在线观看免费高清 | 免费人成大片在线观看播放| 亚洲av永久无码精品网站| 免费无码又爽又刺激聊天APP| 青青青视频免费观看| 亚洲成a人片77777群色|