Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Rubén Ramírez
/
MangAffinity
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
063a2731
authored
Feb 13, 2025
by
Rubén Ramírez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
feat: [Usuario-Repositorio]: Hecha la relación entre Usuario y Repositorio
parent
685b47e4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
src/main/java/com/ujaen/tfg/mangaffinity/entidades/Repositorio.java
src/main/java/com/ujaen/tfg/mangaffinity/entidades/Usuario.java
src/main/java/com/ujaen/tfg/mangaffinity/entidades/Repositorio.java
View file @
063a2731
...
...
@@ -15,13 +15,14 @@ public class Repositorio {
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Long
id
;
@NotBlank
@Column
(
nullable
=
false
)
private
String
categoria
;
@OneToOne
@JoinColumn
(
name
=
"usuario_id"
,
nullable
=
false
,
unique
=
true
)
private
Usuario
usuario
;
// Constructor con parámetros
public
Repositorio
(
String
categoria
)
{
this
.
categoria
=
categoria
;
public
Repositorio
(
Usuario
usuario
)
{
this
.
usuario
=
usuario
;
}
}
src/main/java/com/ujaen/tfg/mangaffinity/entidades/Usuario.java
View file @
063a2731
...
...
@@ -31,10 +31,14 @@ public class Usuario {
private
String
contrasenia
;
@OneToOne
(
mappedBy
=
"usuario"
,
cascade
=
CascadeType
.
ALL
,
orphanRemoval
=
true
)
private
Repositorio
repositorio
;
public
Usuario
(
String
email
,
String
nombreUsuario
,
String
contrasenia
)
{
this
.
email
=
email
;
this
.
nombreUsuario
=
nombreUsuario
;
this
.
contrasenia
=
contrasenia
;
this
.
repositorio
=
new
Repositorio
(
this
);
}
}
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