Hibernate 最简单例子 (11)

    publicstaticvoid main(String[] args) {

       // TODO Auto-generated method stub

       addUser();

       listUser();

       changeUser();

    }

 

    privatestaticvoid printUser(String extraText, User user) {

       System.out.println(extraText

              + "User[Username: "

              + user.getUsername()

              + ", Password:"

              + user.getPassword()

              + ",First Name: "

              + user.getFirstName()

              + ",Last Name: "

              + user.getLastName()

              + "]");

    }

 

    privatestaticvoid addUser() {

       // Create user

       User user = new User();

       user.setId(1);

       user.setUsername("guoqiang");

       user.setFirstName("guo");

       user.setLastName("qiang");

       user.setPassword("guoqiang");

       user.setDateCreated(System.currentTimeMillis());

       // Create DAO

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzjzyw.html