a sample of maven xdoclet hibernate



/**
* Client POJO.
*
* @hibernate.class table = "client"
* @hibernate.cache usage = "read-write"
*/
public class Client implements Serializable {

private static final long serialVersionUID = -8361595011677919387L;

/**
*
* @hibernate.id generator-class = "increment"
* column = "clientid"
*/
private Integer clientId = null;

/**
*
* @hibernate.many-to-one column = "economicgroupid"
* class = "com.yourdomain.yourprojectname.entities.hibernate.EconomicGroup"
* foreign-key = "fk_client_to_economicgroup"
* cascade = "none"
* not-null = "false"
* lazy = "false"
*/
private EconomicGroup economicGroup = null;

/**
*
* @hibernate.many-to-one column = "activitysectorid"
* class = "com.yourdomain.yourprojectname.entities.hibernate.ActivitySector"
* foreign-key = "fk_client_to_activitysector"
* cascade = "none"
* not-null = "false"
* lazy = "false"
*/
private ActivitySector activitySector = null;

/**
*
* @hibernate.property column = "name"
* length = "100"
* not-null = "true"
*/
private String name = null;

/**
*
* @hibernate.property column = "status"
* not-null = "true"
*/
private Boolean status = null;

/**
*
* @hibernate.property column = "changeuserid"
* not-null = "true"
*/
private Integer changeUserId = null;

/**
*
* @hibernate.property column = "changedate"
* not-null = "true"
*/
private Date changeDate = null;

/**
*
* @hibernate.set inverse = "true"
* cascade = "none"
* lazy = "true"
*
* @hibernate.key column = "clientid"
* @hibernate.one-to-many class = "com.yourdomain.yourprojectname.entities.hibernate.Contact"
*/
private Set contacts = new HashSet();

/**
*
* @hibernate.set table = "display"
* cascade = "all"
* inverse = "true"
* lazy = "true"
*
* @hibernate.key column = "userid"
*
* @hibernate.many-to-many class = "com.yourdomain.yourprojectname.entities.hibernate.UserProfile"
* column = "clientid"
*/
private Set userProfiles = new HashSet();

public ActivitySector getActivitySector() {
return activitySector;
}
public void setActivitySector(ActivitySector activitySector) {
this.activitySector = activitySector;
}

public Date getChangeDate() {
return changeDate;
}
public void setChangeDate(Date changeDate) {
this.changeDate = changeDate;
}

public Integer getChangeUserId() {
return changeUserId;
}
public void setChangeUserId(Integer changeUserId) {
this.changeUserId = changeUserId;
}

public Integer getClientId() {
return clientId;
}
public void setClientId(Integer clientId) {
this.clientId = clientId;
}

public EconomicGroup getEconomicGroup() {
return economicGroup;
}
public void setEconomicGroup(EconomicGroup economicGroup) {
this.economicGroup = economicGroup;
}

public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}

public Boolean getStatus() {
return status;
}
public void setStatus(Boolean status) {
this.status = status;
}

public Set getContacts() {
return contacts;
}
public void setContacts(Set contacts) {
this.contacts = contacts;
}

public Set getUserProfiles() {
return userProfiles;
}
public void setUserProfiles(Set userProfiles) {
this.userProfiles = userProfiles;
}
}
UserProfile.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/**
* UserProfile POJO.
*
* @hibernate.class table = "userprofile"
* @hibernate.cache usage = "read-write"
*/
public class UserProfile implements Serializable {

private static final long serialVersionUID = -2103841533469690219L;

/**
*
* @hibernate.id generator-class = "assigned"
* column = "userid"
*/
private Integer userId = null;

/**
*
* @hibernate.many-to-one column = "commercialareaid"
* class = "com.yourdomain.yourprojectname.entities.hibernate.CommercialArea"
* foreign-key = "fk_userprofile_to_commercial"
* cascade = "none"
* not-null = "true"
* lazy = "false"
*/
private CommercialArea commercialArea = null;

/**
*
* @hibernate.property column = "status"
* not-null = "true"
*/
private Boolean status = null;

/**
*
* @hibernate.property column = "changeuserid"
* not-null = "true"
*/
private Integer changeUserId = null;

/**
*
* @hibernate.property column = "changedate"
* not-null = "true"
*/
private Date changeDate = null;

/**
*
* @hibernate.set table="display"
* lazy = "true"
*
* @hibernate.key column="clientid"
*
* @hibernate.many-to-many class="com.yourdomain.yourprojectname.entities.hibernate.Client"
* column="userid"
*/
private Set clients = new HashSet();

public Date getChangeDate() {
return changeDate;
}
public void setChangeDate(Date changeDate) {
this.changeDate = changeDate;
}

public Integer getChangeUserId() {
return changeUserId;
}
public void setChangeUserId(Integer changeUserId) {
this.changeUserId = changeUserId;
}

public CommercialArea getCommercialArea() {
return commercialArea;
}
public void setCommercialArea(CommercialArea commercialArea) {
this.commercialArea = commercialArea;
}

public Boolean getStatus() {
return status;
}
public void setStatus(Boolean status) {
this.status = status;
}

public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}

public Set getClients() {
return clients;
}
public void setClients(Set clients) {
this.clients = clients;
}
}






Client.hbm.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91

"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">


name="com.yourdomain.yourprojectname.entities.hibernate.Client">



column="clientid"
access="field"
name="clientId">




not-null="false"
column="economicgroupid"
foreign-key="fk_client_to_economicgroup"
lazy="false"
access="field"
cascade="none"
name="economicGroup"
class="com.yourdomain.yourprojectname.entities.hibernate.EconomicGroup"/>

not-null="false"
column="activitysectorid"
foreign-key="fk_client_to_activitysector"
lazy="false"
access="field"
cascade="none"
name="activitySector"
class="com.yourdomain.yourprojectname.entities.hibernate.ActivitySector"/>

name="name"
not-null="true"
length="100"
access="field"
column="name"/>

name="status"
not-null="true"
access="field"
column="status"/>

name="changeUserId"
not-null="true"
access="field"
column="changeuserid"/>

name="changeDate"
not-null="true"
access="field"
column="changedate"/>

access="field"
lazy="true"
inverse="true"
cascade="none"
name="contacts">


class="com.yourdomain.yourprojectname.entities.hibernate.Contact"/>


table="display"
access="field"
lazy="true"
inverse="true"
cascade="all"
name="userProfiles">


column="clientid"
class="com.yourdomain.yourprojectname.entities.hibernate.UserProfile"/>




UserProfile.hbm.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">


name="com.yourdomain.yourprojectname.entities.hibernate.UserProfile">



column="userid"
access="field"
name="userId">




not-null="true"
column="commercialareaid"
foreign-key="fk_userprofile_to_commercial"
lazy="false"
access="field"
cascade="none"
name="commercialArea"
class="com.yourdomain.yourprojectname.entities.hibernate.CommercialArea"/>

name="status"
not-null="true"
access="field"
column="status"/>

name="changeUserId"
not-null="true"
access="field"
column="changeuserid"/>

name="changeDate"
not-null="true"
access="field"
column="changedate"/>

table="display"
access="field"
lazy="true"
name="clients">


column="userid"
class="com.yourdomain.yourprojectname.entities.hibernate.Client"/>




你可能感兴趣的:(a sample of maven xdoclet hibernate)