main
Last change
on this file since 0078d84 was c03e53b, checked in by SazdovaEkaterina <sazdovaekaterina@…>, 16 months ago |
m-m relations
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[3d3e59d] | 1 | package finki.paw5.model.entities;
|
---|
[d427a07] | 2 |
|
---|
[038c9f7] | 3 | import jakarta.persistence.*;
|
---|
[d427a07] | 4 | import lombok.Data;
|
---|
[fdd7961] | 5 | import lombok.RequiredArgsConstructor;
|
---|
[d427a07] | 6 |
|
---|
[c03e53b] | 7 | import java.util.List;
|
---|
| 8 |
|
---|
[d427a07] | 9 | @Data
|
---|
| 10 | @Entity
|
---|
[fdd7961] | 11 | @RequiredArgsConstructor
|
---|
[d427a07] | 12 | @Table(name = "organisation")
|
---|
| 13 | public class Organisation {
|
---|
| 14 |
|
---|
| 15 | @Id
|
---|
[038c9f7] | 16 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
[d427a07] | 17 | @Column(name = "id_organisation")
|
---|
[ada7108] | 18 | private Integer id;
|
---|
[d427a07] | 19 |
|
---|
| 20 | @Column(name = "name_organisation", nullable = false, length = 100)
|
---|
| 21 | private String name;
|
---|
| 22 |
|
---|
| 23 | @Column(name = "email_organisation", nullable = false, length = 100, unique = true)
|
---|
| 24 | private String email;
|
---|
| 25 |
|
---|
| 26 | @Column(name = "billing_information", nullable = false, length = 20, unique = true)
|
---|
| 27 | private String billingInformation;
|
---|
| 28 |
|
---|
[c03e53b] | 29 | @ManyToMany
|
---|
| 30 | @JoinTable(name = "donor_donates_to_organisation",
|
---|
| 31 | joinColumns = @JoinColumn(name = "id_organisation"),
|
---|
| 32 | inverseJoinColumns = @JoinColumn(name = "id_user"))
|
---|
| 33 | List<Donor> donors;
|
---|
| 34 |
|
---|
[d427a07] | 35 | public Organisation(String name, String email, String billingInformation) {
|
---|
| 36 | this.name = name;
|
---|
| 37 | this.email = email;
|
---|
| 38 | this.billingInformation = billingInformation;
|
---|
| 39 | }
|
---|
| 40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.