main
Last change
on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
875 bytes
|
Line | |
---|
1 | package com.example.rezevirajmasa.demo.model;
|
---|
2 |
|
---|
3 | import jakarta.persistence.*;
|
---|
4 |
|
---|
5 | import java.io.Serializable;
|
---|
6 |
|
---|
7 | @Entity
|
---|
8 | @Table(name = "restaurantMenus")
|
---|
9 | public class RestaurantMenu {
|
---|
10 | @EmbeddedId
|
---|
11 | private RestaurantMenuId id;
|
---|
12 |
|
---|
13 | @ManyToOne
|
---|
14 | @MapsId("restaurantID")
|
---|
15 | @JoinColumn(name = "RestaurantID", nullable = false)
|
---|
16 | private Restaurant restaurant;
|
---|
17 |
|
---|
18 | @ManyToOne
|
---|
19 | @MapsId("menuID")
|
---|
20 | @JoinColumn(name = "MenuID", nullable = false)
|
---|
21 | private Menu menu;
|
---|
22 |
|
---|
23 | public RestaurantMenu(Restaurant restaurant, Menu menu) {
|
---|
24 | this.restaurant = restaurant;
|
---|
25 | this.menu = menu;
|
---|
26 | }
|
---|
27 |
|
---|
28 | public RestaurantMenu() {
|
---|
29 | }
|
---|
30 |
|
---|
31 | @Embeddable
|
---|
32 | public static class RestaurantMenuId implements Serializable {
|
---|
33 |
|
---|
34 | @Column(name = "RestaurantID")
|
---|
35 | private Long restaurantID;
|
---|
36 |
|
---|
37 | @Column(name = "MenuID")
|
---|
38 | private Long menuID;
|
---|
39 | }
|
---|
40 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.