source: src/main/java/edu/gjoko/schedlr/entity/Business.java

Last change on this file was 77205be, checked in by gjoko kostadinov <gjokokostadinov@…>, 11 months ago

Add entire code

  • Property mode set to 100755
File size: 1.7 KB
Line 
1package edu.gjoko.schedlr.entity;
2
3import com.fasterxml.jackson.annotation.JsonIgnore;
4import com.fasterxml.jackson.annotation.JsonManagedReference;
5import com.fasterxml.jackson.annotation.JsonProperty;
6import lombok.AllArgsConstructor;
7import lombok.Getter;
8import lombok.NoArgsConstructor;
9import lombok.Setter;
10import org.springframework.data.annotation.CreatedDate;
11import org.springframework.data.annotation.LastModifiedDate;
12import org.springframework.data.jpa.domain.support.AuditingEntityListener;
13
14import javax.persistence.*;
15import java.time.LocalDateTime;
16import java.util.List;
17
18@Entity
19@EntityListeners(AuditingEntityListener.class)
20@Table(name = "business")
21@Getter
22@Setter
23@NoArgsConstructor
24@AllArgsConstructor
25public class Business {
26
27 @Id
28 @GeneratedValue(strategy = GenerationType.SEQUENCE)
29 private Long id;
30
31 @Column(name = "company_name")
32 private String companyName;
33
34 @OneToOne
35 @JoinColumn(name = "business_type_id", referencedColumnName = "id")
36 @JsonProperty("businessType")
37 private BusinessType businessType;
38
39 @OneToOne(cascade = CascadeType.PERSIST)
40 @JoinColumn(name = "owner_id", referencedColumnName = "id", nullable = false)
41 @JsonProperty("owner")
42 private Stakeholder owner;
43
44 @OneToMany(mappedBy = "business", cascade = CascadeType.PERSIST)
45 @JsonManagedReference(value = "services")
46 private List<Service> services;
47
48 @Column(name = "business_status")
49 @Enumerated(EnumType.STRING)
50 private BusinessStatus businessStatus;
51
52 @Column(name = "created")
53 @CreatedDate
54 @JsonIgnore
55 private LocalDateTime created;
56
57 @Column(name = "modified")
58 @LastModifiedDate
59 @JsonIgnore
60 private LocalDateTime modified;
61
62
63}
Note: See TracBrowser for help on using the repository browser.