Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
alx_java2b_20250412
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
alx_java2b_20250412
Commits
90f7865c
Commit
90f7865c
authored
Jun 01, 2025
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
poprawki dot eksportu JSON, m.in. @JsonIgnore
parent
cfe8a578
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
1 deletions
+11
-1
Customer.java
PC37-SklepSpring/src/main/java/sklep/model/Customer.java
+5
-0
Order.java
PC37-SklepSpring/src/main/java/sklep/model/Order.java
+1
-1
OrderProduct.java
PC37-SklepSpring/src/main/java/sklep/model/OrderProduct.java
+3
-0
application.properties
PC37-SklepSpring/src/main/resources/application.properties
+2
-0
No files found.
PC37-SklepSpring/src/main/java/sklep/model/Customer.java
View file @
90f7865c
...
...
@@ -7,6 +7,8 @@ import jakarta.validation.constraints.Pattern;
import
java.util.LinkedHashSet
;
import
java.util.Set
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
@Entity
@Table
(
name
=
"customers"
)
public
class
Customer
{
...
...
@@ -32,6 +34,9 @@ public class Customer {
private
String
city
;
@OneToMany
(
mappedBy
=
"customer"
)
@JsonIgnore
// W danych klienta zwracanych w JSONie nie będzie listy zamówień.
// Można by pomyśleć o stworzeniu dwóch wersji tej klasy - jedna z zamówieniami, jedna bez.
private
Set
<
Order
>
orders
=
new
LinkedHashSet
<>();
public
String
getCustomerEmail
()
{
...
...
PC37-SklepSpring/src/main/java/sklep/model/Order.java
View file @
90f7865c
...
...
@@ -16,7 +16,7 @@ public class Order {
@Column
(
name
=
"order_id"
,
nullable
=
false
)
private
Integer
id
;
@ManyToOne
(
fetch
=
FetchType
.
LAZY
,
optional
=
false
)
@ManyToOne
(
optional
=
false
)
@JoinColumn
(
name
=
"customer_email"
,
nullable
=
false
)
private
Customer
customer
;
...
...
PC37-SklepSpring/src/main/java/sklep/model/OrderProduct.java
View file @
90f7865c
...
...
@@ -5,6 +5,8 @@ import jakarta.validation.constraints.Min;
import
org.hibernate.annotations.ColumnDefault
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
java.math.BigDecimal
;
@Entity
...
...
@@ -16,6 +18,7 @@ public class OrderProduct {
@MapsId
(
"orderId"
)
@ManyToOne
(
fetch
=
FetchType
.
LAZY
,
optional
=
false
)
@JoinColumn
(
name
=
"order_id"
,
nullable
=
false
)
@JsonIgnore
private
Order
order
;
@MapsId
(
"productId"
)
...
...
PC37-SklepSpring/src/main/resources/application.properties
View file @
90f7865c
...
...
@@ -6,4 +6,6 @@ spring.datasource.url=jdbc:postgresql://localhost/sklep
spring.datasource.username
=
alx
spring.datasource.password
=
abc123
spring.jackson.serialization.FAIL_ON_EMPTY_BEANS
=
false
alx.photo_dir
=
/home/patryk/sklep/foto
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