Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Carlos Wu
Added: Jun 4, 2019 8:23 AM
Views: 15
Tags: no tags
  1. @OneToOne
  2. @JoinColumn(name = "fk_Member")
  3. Member member;
  4.  
  5. @OneToOne(mappedBy = "member", fetch = FetchType.EAGER, cascade = CascadeType.REMOVE)
  6. Account account;
  7.  
  8. @ElementCollection(targetClass = Role.class, fetch =FetchType.EAGER)
  9. @CollectionTable(name = "tbl_member_role", joinColumns = @JoinColumn(name = "fk_Member"))
  10. @Column(name ="intRoleNo")
  11. Set<Role> roles =Sets.newHashSet(Role.USER);
  12.  
  13. @Column(name ="intStatus",nullable=false)
  14. @Enumerated(EnumType.STRING)
  15. TicketStatus status=TicketStatus.OPEN;
  16.  
  17.  
  18.  
  19. @OneToMany(mappedBy = "member", cascade = CascadeType.REMOVE)
  20. List<PurchaseOrder> orders;
  21.  
  22. @ManyToOne
  23. @JoinColumn(name ="fk_Member")
  24. Member member;
  25.  
  26.  
  27.  
  28.  
  29. @ManyToMany
  30. @JoinTable(name = "tbl_ticket_course", joinColumns =@JoinColumn(name = "fk_Ticket") ,
  31. inverseJoinColumns = @JoinColumn(name = "fk_Course") ,
  32. uniqueConstraints = {@UniqueConstraint(columnNames= {"fk_Ticket","fk_Course"})})
  33. List<Course> courses;
  34.  
  35.  
  36. @Column(name ="dtPayday")
  37. @Temporal(TemporalType.DATE)
  38. Date payday;
  39.  
  40. @Inheritance(strategy = InheritanceType.JOINED)
  41. @Table(name = "tbl_order")
  42. public class PurchaseOrder extends PersistableClass<Integer>{
  43.  
  44.  
  45. @PrimaryKeyJoinColumn(name = "id")
  46. @Table(name = "tbl_order_cash")
  47. public class CashOrder extends PurchaseOrder{
  48.  
  49.  
  50. @Table(name = "test", indexes = [
  51.      @Index(columnList = "target"),
  52.      @Index(columnList = "target,creation asc")
  53. ])
  54. class Test extends AbstractPersistable<Long>{
  55.  
  56.     //jodatime
  57.     @Column(name = "modification_time", nullable = false)
  58.     @Type(type="org.joda.time.contrib.hibernate.PersistentDateTime")
  59.     private DateTime modificationTime;
  60.  
  61.  
  62. // http://joda-time.sourceforge.net/contrib/hibernate/userguide.html
  63.  
  64.  
  65.  
  66.  
  67. @Id
  68. @GeneratedValue(strategy=GenerationType.AUTO)
  69. private int id;
  70.  
  71. @Id
  72. @GeneratedValue(generator = "uuid2")
  73. @GenericGenerator(name = "uuid2", strategy = "uuid2")
  74. String id;
  75.