Guest User

Untitled

a guest
Oct 30th, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.02 KB | None | 0 0
  1. //This is the first entity
  2.  
  3. package org.domain.newseam.entity;
  4.  
  5. import java.util.Date;
  6. import javax.persistence.Column;
  7. import javax.persistence.Entity;
  8. import javax.persistence.GeneratedValue;
  9. import static javax.persistence.GenerationType.IDENTITY;
  10. import javax.persistence.Id;
  11. import javax.persistence.JoinColumn;
  12. import javax.persistence.ManyToOne;
  13. import javax.persistence.Table;
  14. import javax.persistence.Temporal;
  15. import javax.persistence.TemporalType;
  16. import org.jboss.seam.ScopeType;
  17. import org.jboss.seam.annotations.Name;
  18. import org.jboss.seam.annotations.Scope;
  19. import org.domain.newseam.entity.User;
  20.  
  21. @Entity
  22. @Scope(ScopeType.SESSION)
  23. @Name("multichoice")
  24. @Table(name = "multichoice", schema = "billmanager")
  25. public class Multichoice implements java.io.Serializable {
  26.  
  27. private Integer id;
  28. private String cardno;
  29. private String description;
  30. private double amount;
  31. private int user_id;
  32. private Date date;
  33. private String tnumber;
  34.  
  35. private User user;
  36.  
  37. public Multichoice() {
  38. }
  39.  
  40. public Multichoice(String cardno, String description, double amount,
  41. int userId, Date date, String tnumber) {
  42. this.cardno = cardno;
  43. this.description = description;
  44. this.amount = amount;
  45. this.user_id = userId;
  46. this.date = date;
  47. this.tnumber = tnumber;
  48. }
  49.  
  50. @Id
  51. @GeneratedValue(strategy = IDENTITY)
  52. @Column(name = "id", unique = true, nullable = false)
  53. public Integer getId() {
  54. return this.id;
  55. }
  56.  
  57. public void setId(Integer id) {
  58. this.id = id;
  59. }
  60.  
  61. @Column(name = "cardno", nullable = false, length = 50)
  62.  
  63. public String getCardno() {
  64. return this.cardno;
  65. }
  66.  
  67. public void setCardno(String cardno) {
  68. this.cardno = cardno;
  69. }
  70.  
  71. @Column(name = "description", nullable = false, length = 65535)
  72.  
  73. public String getDescription() {
  74. return this.description;
  75. }
  76.  
  77. public void setDescription(String description) {
  78. this.description = description;
  79. }
  80.  
  81. @Column(name = "amount", nullable = false, precision = 22, scale = 0)
  82. public double getAmount() {
  83. return this.amount;
  84. }
  85.  
  86. public void setAmount(double amount) {
  87. this.amount = amount;
  88. }
  89.  
  90. @Column(name = "user_id", nullable = false, updatable=false )
  91. public int getUser_id() {
  92. return user_id;
  93. }
  94.  
  95. public void setUser_id(int user_id) {
  96. this.user_id = user_id;
  97. }
  98.  
  99. @Temporal(TemporalType.DATE)
  100. @Column(name = "date", nullable = false, length = 10)
  101.  
  102. public Date getDate() {
  103. return this.date;
  104. }
  105.  
  106. public void setDate(Date date) {
  107. this.date = date;
  108. }
  109.  
  110. @Column(name = "tnumber", nullable = false, length = 12)
  111.  
  112. public String getTnumber() {
  113. return this.tnumber;
  114. }
  115.  
  116. public void setTnumber(String tnumber) {
  117. this.tnumber = tnumber;
  118. }
  119.  
  120. @ManyToOne
  121. @JoinColumn(name="user_id")
  122. public User getUser() {
  123. return user;
  124. }
  125.  
  126. public void setUser(User user) {
  127. this.user = user;
  128. }
  129.  
  130. }
  131.  
  132. //and this is the 2nd entity
  133.  
  134. package org.domain.newseam.entity;
  135.  
  136. // Generated 19-Apr-2011 14:44:53 by Hibernate Tools 3.4.0.CR1
  137.  
  138. import java.util.HashSet;
  139. import java.util.Set;
  140.  
  141. import javax.persistence.Column;
  142. import javax.persistence.Entity;
  143. import javax.persistence.GeneratedValue;
  144. import javax.persistence.OneToMany;
  145.  
  146. import static javax.persistence.GenerationType.IDENTITY;
  147. import javax.persistence.Id;
  148. import javax.persistence.Table;
  149. import javax.persistence.UniqueConstraint;
  150.  
  151. import org.hibernate.validator.Email;
  152. import org.hibernate.validator.Length;
  153. import org.hibernate.validator.NotNull;
  154. import org.jboss.seam.ScopeType;
  155. import org.jboss.seam.annotations.Name;
  156. import org.jboss.seam.annotations.Scope;
  157. import org.domain.newseam.entity.*;
  158. import javax.persistence.JoinColumn;
  159. import javax.persistence.JoinTable;
  160. import javax.persistence.ManyToMany;
  161. import org.jboss.seam.annotations.security.management.UserEnabled;
  162. import org.jboss.seam.annotations.security.management.UserFirstName;
  163. import org.jboss.seam.annotations.security.management.UserLastName;
  164. import org.jboss.seam.annotations.security.management.UserPassword;
  165. import org.jboss.seam.annotations.security.management.UserPrincipal;
  166. import org.jboss.seam.annotations.security.management.UserRoles;
  167. import org.jboss.security.integration.password.Password;
  168.  
  169. /**
  170. * User generated by hbm2java
  171. */
  172. @Entity
  173. @Scope(ScopeType.SESSION)
  174. @Name("user")
  175. @Table(name = "user", schema = "billmanager", uniqueConstraints = {
  176. @UniqueConstraint(columnNames = "email"),
  177. @UniqueConstraint(columnNames = "username") })
  178. public class User implements java.io.Serializable {
  179.  
  180. private Integer id;
  181. private String firstname;
  182. private String lastname;
  183. private String address1;
  184. private String address2;
  185. private String city;
  186. private String state;
  187. private String zip;
  188. private String phone;
  189. private String email;
  190. private String username;
  191. private String password;
  192. private int usertype;
  193. private String password2;
  194.  
  195. private Set<Multichoice> multichoices = new HashSet<Multichoice>();
  196.  
  197. private Set<Roles> roles;
  198.  
  199. public User() {
  200. }
  201.  
  202. public User(String firstname, String lastname, String address1,
  203. String address2, String city, String state, String zip,
  204. String phone, String email, String username, String password,
  205. int usertype) {
  206. this.firstname = firstname;
  207. this.lastname = lastname;
  208. this.address1 = address1;
  209. this.address2 = address2;
  210. this.city = city;
  211. this.state = state;
  212. this.zip = zip;
  213. this.phone = phone;
  214. this.email = email;
  215. this.username = username;
  216. this.password = password;
  217. this.usertype = usertype;
  218. }
  219.  
  220. @Id
  221. @GeneratedValue(strategy = IDENTITY)
  222. @Column(name = "id", unique = true, nullable = false)
  223. public Integer getId() {
  224. return this.id;
  225. }
  226.  
  227. public void setId(Integer id) {
  228. this.id = id;
  229. }
  230.  
  231. @Column(name = "firstname", nullable = false, length = 100)
  232. @NotNull
  233. @Length(max = 100)
  234. public String getFirstname() {
  235. return this.firstname;
  236. }
  237.  
  238. public void setFirstname(String firstname) {
  239. this.firstname = firstname;
  240. }
  241.  
  242. @Column(name = "lastname", nullable = false, length = 100)
  243. @NotNull
  244. @Length(max = 100)
  245. public String getLastname() {
  246. return this.lastname;
  247. }
  248.  
  249. public void setLastname(String lastname) {
  250. this.lastname = lastname;
  251. }
  252.  
  253. @Column(name = "address1", nullable = false, length = 200)
  254. @NotNull
  255. @Length(max = 200)
  256. public String getAddress1() {
  257. return this.address1;
  258. }
  259.  
  260. public void setAddress1(String address1) {
  261. this.address1 = address1;
  262. }
  263.  
  264. @Column(name = "address2", nullable = true, length = 200)
  265. @NotNull
  266. @Length(max = 200)
  267. public String getAddress2() {
  268. return this.address2;
  269. }
  270.  
  271. public void setAddress2(String address2) {
  272. this.address2 = address2;
  273. }
  274.  
  275. @Column(name = "city", nullable = false, length = 200)
  276. @NotNull
  277. @Length(max = 200)
  278. public String getCity() {
  279. return this.city;
  280. }
  281.  
  282. public void setCity(String city) {
  283. this.city = city;
  284. }
  285.  
  286. @Column(name = "state", nullable = false, length = 50)
  287. @NotNull
  288. @Length(max = 50)
  289. public String getState() {
  290. return this.state;
  291. }
  292.  
  293. public void setState(String state) {
  294. this.state = state;
  295. }
  296.  
  297. @Column(name = "zip", nullable = false, length = 15)
  298. @NotNull
  299. @Length(max = 15)
  300. public String getZip() {
  301. return this.zip;
  302. }
  303.  
  304. public void setZip(String zip) {
  305. this.zip = zip;
  306. }
  307.  
  308. @Column(name = "phone", nullable = false, length = 20)
  309. @NotNull
  310. @Length(max = 20)
  311. public String getPhone() {
  312. return this.phone;
  313. }
  314.  
  315. public void setPhone(String phone) {
  316. this.phone = phone;
  317. }
  318.  
  319. @Column(name = "email", unique = true, nullable = false, length = 40)
  320. @NotNull
  321. @Length(max = 40)
  322. @Email
  323. public String getEmail() {
  324. return this.email;
  325. }
  326.  
  327. public void setEmail(String email) {
  328. this.email = email;
  329. }
  330.  
  331. @Column(name = "username", unique = true, nullable = false, length = 25)
  332. @NotNull
  333. @Length(max = 25)
  334. @UserPrincipal
  335. public String getUsername() {
  336. return this.username;
  337. }
  338.  
  339. public void setUsername(String username) {
  340. this.username = username;
  341. }
  342.  
  343. @Column(name = "password", nullable = false, length = 25)
  344. @NotNull
  345. @Length(max = 45)
  346. @UserPassword(hash="sha")
  347. public String getPassword() {
  348. return this.password;
  349. }
  350.  
  351. public void setPassword(String password) {
  352. this.password = password;
  353. }
  354.  
  355. @Column(name = "usertype", nullable = false)
  356. public int getUsertype() {
  357. return this.usertype;
  358. }
  359.  
  360. public void setUsertype(int usertype) {
  361. this.usertype = usertype;
  362. }
  363.  
  364. @UserRoles
  365. @ManyToMany
  366. @JoinTable(name = "userrolelink", joinColumns = @JoinColumn(name = "user_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "role_id", referencedColumnName = "id"))
  367. public Set<Roles> getRoles() {
  368. return roles;
  369. }
  370.  
  371. public void setRoles(Set<Roles> roles) {
  372. this.roles = roles;
  373. }
  374.  
  375. public String getPassword2() {
  376. return password2;
  377. }
  378.  
  379. public void setPassword2(String password2) {
  380. this.password2 = password2;
  381. }
  382.  
  383. @OneToMany(mappedBy="user")
  384. public Set<Multichoice> getMultichoices() {
  385. return multichoices;
  386. }
  387.  
  388. public void setMultichoices(Set<Multichoice> multichoices) {
  389. this.multichoices = multichoices;
  390. }
  391.  
  392. }
Add Comment
Please, Sign In to add comment