main
Last change
on this file since 4846b7a was 4846b7a, checked in by SazdovaEkaterina <sazdovaekaterina@…>, 17 months ago |
fix composite keys
|
-
Property mode
set to
100644
|
File size:
562 bytes
|
Line | |
---|
1 | package finki.paw5.model.relations;
|
---|
2 |
|
---|
3 | import jakarta.persistence.*;
|
---|
4 | import lombok.Data;
|
---|
5 |
|
---|
6 | @Data
|
---|
7 | @Entity
|
---|
8 | @Table(name = "pet_belongs_to_category")
|
---|
9 | @IdClass(PetBelongsToCategoryId.class)
|
---|
10 | public class PetBelongsToCategory {
|
---|
11 |
|
---|
12 | @Id
|
---|
13 | @Column(name="id_pet", nullable = false)
|
---|
14 | private int petId;
|
---|
15 |
|
---|
16 | @Id
|
---|
17 | @Column(name="id_category", nullable = false)
|
---|
18 | private int categoryId;
|
---|
19 |
|
---|
20 | public PetBelongsToCategory(int petId, int categoryId) {
|
---|
21 | this.petId = petId;
|
---|
22 | this.categoryId = categoryId;
|
---|
23 | }
|
---|
24 |
|
---|
25 | public PetBelongsToCategory() {
|
---|
26 |
|
---|
27 | }
|
---|
28 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.