Last change
on this file since 950fa0d was 950fa0d, checked in by Gjoko Kostadinov <gjoko.kostadinov@…>, 13 months ago |
Periodic update
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[cf9cdbf] | 1 | package edu.gjoko.schedlr.entity;
|
---|
| 2 |
|
---|
[a436340] | 3 | import com.fasterxml.jackson.annotation.JsonBackReference;
|
---|
[8bcd64c] | 4 | import com.fasterxml.jackson.annotation.JsonIgnore;
|
---|
[cf9cdbf] | 5 | import lombok.AllArgsConstructor;
|
---|
| 6 | import lombok.Getter;
|
---|
| 7 | import lombok.NoArgsConstructor;
|
---|
| 8 | import lombok.Setter;
|
---|
[204464d] | 9 | import org.springframework.data.annotation.CreatedDate;
|
---|
| 10 | import org.springframework.data.annotation.LastModifiedDate;
|
---|
| 11 | import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
---|
[cf9cdbf] | 12 |
|
---|
| 13 | import javax.persistence.*;
|
---|
[204464d] | 14 | import java.time.LocalDateTime;
|
---|
[cf9cdbf] | 15 |
|
---|
| 16 | @Entity
|
---|
[204464d] | 17 | @EntityListeners(AuditingEntityListener.class)
|
---|
[cf9cdbf] | 18 | @Table(name = "service")
|
---|
| 19 | @Getter
|
---|
| 20 | @Setter
|
---|
| 21 | @NoArgsConstructor
|
---|
| 22 | @AllArgsConstructor
|
---|
| 23 | public class Service {
|
---|
| 24 |
|
---|
| 25 | @Id
|
---|
| 26 | @GeneratedValue(strategy = GenerationType.SEQUENCE)
|
---|
| 27 | private Long id;
|
---|
| 28 |
|
---|
| 29 | @Column(name = "duration")
|
---|
| 30 | private Integer duration;
|
---|
| 31 |
|
---|
[8bcd64c] | 32 | @Column(name = "price")
|
---|
| 33 | private Integer price;
|
---|
| 34 |
|
---|
[950fa0d] | 35 | @OneToOne(cascade = CascadeType.PERSIST)
|
---|
[a436340] | 36 | @JoinColumn(name = "service_type_id", referencedColumnName = "id")
|
---|
| 37 | private ServiceType serviceType;
|
---|
| 38 |
|
---|
[cf9cdbf] | 39 | @ManyToOne
|
---|
[950fa0d] | 40 | @JoinColumn(name = "business_id")
|
---|
[a436340] | 41 | @JsonBackReference
|
---|
[cf9cdbf] | 42 | private Business business;
|
---|
[204464d] | 43 |
|
---|
| 44 | @Column(name = "created")
|
---|
| 45 | @CreatedDate
|
---|
[8bcd64c] | 46 | @JsonIgnore
|
---|
[204464d] | 47 | private LocalDateTime created;
|
---|
| 48 |
|
---|
| 49 | @Column(name = "modified")
|
---|
| 50 | @LastModifiedDate
|
---|
[8bcd64c] | 51 | @JsonIgnore
|
---|
[204464d] | 52 | private LocalDateTime modified;
|
---|
[cf9cdbf] | 53 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.