Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bspastoriza19-esi-solutions
Project
Project
Details
Activity
Releases
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
Breixo Senra Pastoriza
bspastoriza19-esi-solutions
Commits
595e3c93
Commit
595e3c93
authored
Sep 19, 2019
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes pet relation in owner
In order to avoid repeated pets in the relation.
parent
c4ab8bb8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
Owner.java
...rc/main/java/es/uvigo/esei/xcs/domain/entities/Owner.java
+5
-6
No files found.
domain/src/main/java/es/uvigo/esei/xcs/domain/entities/Owner.java
View file @
595e3c93
...
...
@@ -5,8 +5,9 @@ import static java.util.Collections.unmodifiableCollection;
import
static
java
.
util
.
Objects
.
requireNonNull
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.HashSet
;
import
java.util.Set
;
import
javax.persistence.CascadeType
;
import
javax.persistence.DiscriminatorValue
;
...
...
@@ -28,12 +29,11 @@ public class Owner extends User implements Serializable {
@OneToMany
(
mappedBy
=
"owner"
,
targetEntity
=
Pet
.
class
,
cascade
=
CascadeType
.
ALL
,
orphanRemoval
=
true
,
fetch
=
FetchType
.
EAGER
)
private
Collection
<
Pet
>
pets
;
private
Set
<
Pet
>
pets
;
// Required for JPA
Owner
()
{}
...
...
@@ -53,7 +53,7 @@ public class Owner extends User implements Serializable {
*/
public
Owner
(
String
login
,
String
password
)
{
super
(
login
,
password
);
this
.
pets
=
new
ArrayLis
t
<>();
this
.
pets
=
new
HashSe
t
<>();
}
/**
...
...
@@ -72,8 +72,7 @@ public class Owner extends User implements Serializable {
* not valid according to its description.
*/
public
Owner
(
String
login
,
String
password
,
Pet
...
pets
)
{
super
(
login
,
password
);
this
.
pets
=
new
ArrayList
<>();
this
(
login
,
password
);
stream
(
pets
).
forEach
(
this
::
addPet
);
}
...
...
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