同样还是web项目,这里只做了一张表,做一个测试,例子。主要是建Hibernate 的时候要非常注意,有时间了整理一下建Hiberbnate 的时候需要注意的事项

Hibernate+jsp+struts+spring做增删该查,

这里我是建了5个包,其实只要四个就好,那个service包和action包可以放在一起的,其他的是1.实体包;2.接口包(写方法名的);3.接口实现包(实现接口的方法);4.action包(数据逻辑)

一、实体包,这里是自动生成的,但是强迫症还是把它放在这里了啊

 1 package com.chinasofti.sh2.entity;
 2 
 3 /**
 4  * Information entity. @author MyEclipse Persistence Tools
 5  */
 6 
 7 @SuppressWarnings("serial")
 8 public class Information implements java.io.Serializable {
 9 
10     // Fields
11 
12     private Integer id;
13     private String name;
14     private String department;
15     private String position;
16     private String password;
17     private String tel;
18     private String lervel;
19 
20     // Constructors
21 
22     /** default constructor */
23     public Information() {
24     }
25 
26     /** full constructor */
27     public Information(String name, String department, String position,
28             String password, String tel, String lervel) {
29         this.name = name;
30         this.department = department;
31         this.position = position;
32         this.password = password;
33         this.tel = tel;
34         this.lervel = lervel;
35     }
36 
37     // Property accessors
38 
39     public Integer getId() {
40         return this.id;
41     }
42 
43     public void setId(Integer id) {
44         this.id = id;
45     }
46 
47     public String getName() {
48         return this.name;
49     }
50 
51     public void setName(String name) {
52         this.name = name;
53     }
54 
55     public String getDepartment() {
56         return this.department;
57     }
58 
59     public void setDepartment(String department) {
60         this.department = department;
61     }
62 
63     public String getPosition() {
64         return this.position;
65     }
66 
67     public void setPosition(String position) {
68         this.position = position;
69     }
70 
71     public String getPassword() {
72         return this.password;
73     }
74 
75     public void setPassword(String password) {
76         this.password = password;
77     }
78 
79     public String getTel() {
80         return this.tel;
81     }
82 
83     public void setTel(String tel) {
84         this.tel = tel;
85     }
86 
87     public String getLervel() {
88         return this.lervel;
89     }
90 
91     public void setLervel(String lervel) {
92         this.lervel = lervel;
93     }
94 
95 }
Information.java

相关文章: