изменены базовая сущность, константы и круд репозиторий
This commit is contained in:
parent
957c902e21
commit
d08574bc53
@ -2,6 +2,7 @@ package com.example.backend.core.configurations;
|
||||
|
||||
public class Constants {
|
||||
public static final String API_URL = "/api";
|
||||
public static final String SEQUENCE_NAME = "hibernate_sequence";
|
||||
|
||||
private Constants() {
|
||||
}
|
||||
|
@ -1,23 +1,29 @@
|
||||
package com.example.backend.core.model;
|
||||
|
||||
public class BaseEntity {
|
||||
import com.example.backend.core.configurations.Constants;
|
||||
|
||||
public Integer id;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.MappedSuperclass;
|
||||
import jakarta.persistence.SequenceGenerator;
|
||||
|
||||
@MappedSuperclass
|
||||
public abstract class BaseEntity {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = Constants.SEQUENCE_NAME)
|
||||
@SequenceGenerator(name = Constants.SEQUENCE_NAME, sequenceName = Constants.SEQUENCE_NAME, allocationSize = 1)
|
||||
protected Long id;
|
||||
|
||||
protected BaseEntity() {
|
||||
|
||||
}
|
||||
|
||||
protected BaseEntity(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
package com.example.backend.favorites.repository;
|
||||
|
||||
public class CrudRepository<T1, T2> {
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user