Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
javab_20230928
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patryk Czarnik
javab_20230928
Commits
335d131a
Commit
335d131a
authored
Nov 10, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
@JsonIgnore aby przeciąć cykliczne zależności
parent
c27d9942
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
136 additions
and
4 deletions
+136
-4
dane.json
PC38-RestSpring/dane.json
+109
-0
Customer.java
PC38-RestSpring/src/main/java/sklep/model/Customer.java
+10
-2
Order.java
PC38-RestSpring/src/main/java/sklep/model/Order.java
+14
-2
OrderProduct.java
PC38-RestSpring/src/main/java/sklep/model/OrderProduct.java
+3
-0
No files found.
PC38-RestSpring/dane.json
0 → 100644
View file @
335d131a
{
"orderId"
:
1
,
"deliveryDate"
:
null
,
"orderDate"
:
"2021-11-20T11:30:00.000+00:00"
,
"status"
:
"PAID"
,
"orderProducts"
:
[
{
"id"
:
{
"orderId"
:
1
,
"productId"
:
2
},
"actualPrice"
:
2400.00
,
"actualVat"
:
0.23
,
"quantity"
:
3
,
"product"
:
{
"productId"
:
2
,
"description"
:
"Odkurzacz kolorowy"
,
"price"
:
440.00
,
"productName"
:
"odkurzacz"
,
"vat"
:
0.23
}
},
{
"id"
:
{
"orderId"
:
1
,
"productId"
:
1
},
"actualPrice"
:
2900.00
,
"actualVat"
:
0.23
,
"quantity"
:
1
,
"product"
:
{
"productId"
:
1
,
"description"
:
"Pralka szybkoobrotowa 1350"
,
"price"
:
2614.00
,
"productName"
:
"pralka"
,
"vat"
:
0.23
}
}
],
"customer"
:
{
"customerEmail"
:
"ala@example.com"
,
"address"
:
"Jasna 14/16"
,
"city"
:
"Warszawa"
,
"customerName"
:
"Alicja Kowalska"
,
"phoneNumber"
:
"123123123"
,
"postalCode"
:
"01-234"
,
"orders"
:
[
{
"orderId"
:
1
,
"deliveryDate"
:
null
,
"orderDate"
:
"2021-11-20T11:30:00.000+00:00"
,
"status"
:
"PAID"
,
"orderProducts"
:
[
{
"id"
:
{
"orderId"
:
1
,
"productId"
:
2
},
"actualPrice"
:
2400.00
,
"actualVat"
:
0.23
,
"quantity"
:
3
,
"product"
:
{
"productId"
:
2
,
"description"
:
"Odkurzacz kolorowy"
,
"price"
:
440.00
,
"productName"
:
"odkurzacz"
,
"vat"
:
0.23
}
},
{
"id"
:
{
"orderId"
:
1
,
"productId"
:
1
},
"actualPrice"
:
2900.00
,
"actualVat"
:
0.23
,
"quantity"
:
1
,
"product"
:
{
"productId"
:
1
,
"description"
:
"Pralka szybkoobrotowa 1350"
,
"price"
:
2614.00
,
"productName"
:
"pralka"
,
"vat"
:
0.23
}
}
],
"customer"
:
{
"customerEmail"
:
"ala@example.com"
,
"address"
:
"Jasna 14/16"
,
"city"
:
"Warszawa"
,
"customerName"
:
"Alicja Kowalska"
,
"phoneNumber"
:
"123123123"
,
"postalCode"
:
"01-234"
,
"orders"
:
[
{
"orderId"
:
1
,
"deliveryDate"
:
null
,
"orderDate"
:
"2021-11-20T11:30:00.000+00:00"
,
"status"
:
"PAID"
,
"orderProducts"
:
[
{
"id"
:
{
"orderId"
:
1
,
"productId"
:
2
},
"actualPrice"
:
2400.00
,
"actualVat"
:
0.23
,
"quantity"
:
3
,
"pro
\ No newline at end of file
PC38-RestSpring/src/main/java/sklep/model/Customer.java
View file @
335d131a
package
sklep
.
model
;
import
java.io.Serializable
;
import
jakarta.persistence.*
;
import
java.util.List
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
jakarta.persistence.Column
;
import
jakarta.persistence.Entity
;
import
jakarta.persistence.Id
;
import
jakarta.persistence.NamedQuery
;
import
jakarta.persistence.OneToMany
;
import
jakarta.persistence.Table
;
/**
* The persistent class for the customers database table.
...
...
@@ -35,6 +42,7 @@ public class Customer implements Serializable {
//bi-directional many-to-one association to Order
@OneToMany
(
mappedBy
=
"customer"
)
@JsonIgnore
private
List
<
Order
>
orders
;
public
Customer
()
{
...
...
PC38-RestSpring/src/main/java/sklep/model/Order.java
View file @
335d131a
package
sklep
.
model
;
import
java.io.Serializable
;
import
jakarta.persistence.*
;
import
java.util.Date
;
import
java.sql.Timestamp
;
import
java.util.Date
;
import
java.util.List
;
import
jakarta.persistence.Column
;
import
jakarta.persistence.Entity
;
import
jakarta.persistence.GeneratedValue
;
import
jakarta.persistence.GenerationType
;
import
jakarta.persistence.Id
;
import
jakarta.persistence.JoinColumn
;
import
jakarta.persistence.ManyToOne
;
import
jakarta.persistence.NamedQuery
;
import
jakarta.persistence.OneToMany
;
import
jakarta.persistence.Table
;
import
jakarta.persistence.Temporal
;
import
jakarta.persistence.TemporalType
;
/**
* The persistent class for the orders database table.
...
...
PC38-RestSpring/src/main/java/sklep/model/OrderProduct.java
View file @
335d131a
...
...
@@ -5,6 +5,8 @@ import jakarta.persistence.*;
import
java.math.BigDecimal
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
/**
* The persistent class for the order_products database table.
...
...
@@ -30,6 +32,7 @@ public class OrderProduct implements Serializable {
//bi-directional many-to-one association to Order
@ManyToOne
@JoinColumn
(
name
=
"order_id"
,
insertable
=
false
,
updatable
=
false
)
@JsonIgnore
private
Order
order
;
//uni-directional many-to-one association to Product
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment