-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Permission relationship #19
Changes from 4 commits
f07d404
3fbfb04
68092de
7d96f04
617d31e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,35 @@ | ||
package cat.udl.eps.softarch.demo.domain; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.ManyToMany; | ||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.util.Set; | ||
|
||
@Entity | ||
@Setter | ||
@Getter | ||
@Data | ||
@EqualsAndHashCode(callSuper = false) | ||
public class Permission { | ||
|
||
@Id | ||
@GeneratedValue | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is better to make the generation method explicit to make sure it is unique, like: |
||
@NotNull | ||
private Long id; | ||
|
||
@NotNull | ||
@NotBlank | ||
private String name; | ||
|
||
@NotNull | ||
@ManyToMany | ||
private Set<Role> role; | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package cat.udl.eps.softarch.demo.repository; | ||
|
||
import cat.udl.eps.softarch.demo.domain.Permission; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.data.repository.PagingAndSortingRepository; | ||
|
||
public interface PermissionRepository extends CrudRepository<Permission, String>, PagingAndSortingRepository<Permission, String> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If permission has Long as identifier, then the repository should use Long as identity type instead of String |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not necessary to use annotation getters and setters, If you use the annotation data