自动生成映射文件和hibernate配置文件

上传人:kms****20 文档编号:41335452 上传时间:2018-05-29 格式:DOC 页数:10 大小:32KB
返回 下载 相关 举报
自动生成映射文件和hibernate配置文件_第1页
第1页 / 共10页
自动生成映射文件和hibernate配置文件_第2页
第2页 / 共10页
自动生成映射文件和hibernate配置文件_第3页
第3页 / 共10页
自动生成映射文件和hibernate配置文件_第4页
第4页 / 共10页
自动生成映射文件和hibernate配置文件_第5页
第5页 / 共10页
点击查看更多>>
资源描述

《自动生成映射文件和hibernate配置文件》由会员分享,可在线阅读,更多相关《自动生成映射文件和hibernate配置文件(10页珍藏版)》请在金锄头文库上搜索。

1、自动生成映射文件和自动生成映射文件和 HibernateHibernate 配置文件配置文件01.import java.io.Serializable; 02. 03./* 04. * An Address component, its not have its own identity. 05. * 06. */ 07.public class Address implements Serializable 08. private String streetAddress; 09. private String city; 10. private String state; 11. pri

2、vate String zipCode; 12. 13. /* 14. * hibernate.property 15. * hibernate.column name=“street_address“ 16. * return 17. */ 18. public String getStreetAddress() return streetAddress; 19. public void setStreetAddress(String streetAddress) this.streetAddress = streetAddress; 20. 21. /* 22. * hibernate.p

3、roperty 23. * hibernate.column name=“city“ 24. * return 25. */ 26. public String getCity() return city; 27. public void setCity(String city) this.city = city; 28. 29. /* 30. * hibernate.property 31. * hibernate.column name=“state“ 32. * return 33. */ 34. public String getState() return state; 35. pu

4、blic void setState(String state) this.state = state; 36. 37. /* 38. * hibernate.property 39. * hibernate.column name=“zip_code“ 40. * return 41. */ 42. public String getZipCode() return zipCode; 43. public void setZipCode(String zipCode) this.zipCode = zipCode; 44. 45. 46. 47. 48./ 49. 50.import jav

5、a.io.Serializable; 51.import java.util.Date; 52.import java.util.Set; 53.import java.util.LinkedHashSet; 54. 55./* 56. * A persistant Hibernate object. 57. * 58. * hibernate.class table=“events“ 59. */ 60.public class Event implements Serializable 61. private Long id; 62. private int duration; 63. p

6、rivate String name; 64. private Date startDate; 65. private Location location; 66. private Set speakers = new LinkedHashSet(); 67. 68. /* 69. * hibernate.id generator-class=“native“ column=“uid“ 70. * return 71. */ 72. public Long getId() return id; 73. public void setId(Long id) this.id = id; 74. 7

7、5. /* 76. * hibernate.property column=“name“ 77. * return 78. */ 79. public String getName() return name; 80. public void setName(String name) this.name = name; 81. 82. /* 83. * hibernate.property column=“start_date“ 84. * return 85. */ 86. public Date getStartDate() return startDate; 87. public voi

8、d setStartDate(Date startDate) this.startDate = startDate; 88. 89. /* 90. * hibernate.property column=“duration“ 91. * return 92. */ 93. public int getDuration() return duration; 94. public void setDuration(int duration) this.duration = duration; 95. 96. /* 97. * hibernate.many-to-one column=“locati

9、on_id“ cascade=“save-update“ 98. * return 99. */ 100. public Location getLocation() return location; 101. public void setLocation(Location location) this.location = location; 102. 103. /* 104. * hibernate.set cascade=“save-update“ 105. * hibernate.collection-key column=“event_id“ 106. * hibernate.co

10、llection-one-to-many class=“Speaker“ 107. * return 108. */ 109. public Set getSpeakers() return speakers; 110. public void setSpeakers(Set speakers) this.speakers = speakers; 111. 112. 113. 114. 115./ 116. 117. 121. 129. 130. 138. 139. 147. 148. 156. 157. 158. 159. 160./ 161. 162. 163.import java.io

11、.Serializable; 164./* 165. * hibernate.class table=“locations“ 166. */ 167.public class Location implements Serializable 168. private Long id; 169. private String name; 170. private Address address = new Address(); 171. 172. /* 173. * hibernate.id generator-class=“native“ column=“uid“ 174. * return

12、175. */ 176. public Long getId() return id; 177. public void setId(Long id) this.id = id; 178. 179. public String getName() return name; 180. public void setName(String name) this.name = name; 181. 182. /* 183. * ponent 184. * return 185. */ 186. public Address getAddress() return address; 187. public void setAddress(Address address) this.address = address; 188. 189. 190. 191./ 192. 193. 194. 195. 196. 197. 198. 199. 200. 201. 202. 203. 204. 205. 206. 207. 208. 209. 210. 211. 215. 216. 217. 218. 219. 220.

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 生活休闲 > 科普知识

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号