изменены базовая сущность, константы и круд репозиторий

This commit is contained in:
ekallin 2024-04-14 23:25:37 +03:00
parent 957c902e21
commit d08574bc53
3 changed files with 22 additions and 10 deletions

View File

@ -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() {
}

View File

@ -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;
}
}

View File

@ -0,0 +1,5 @@
package com.example.backend.favorites.repository;
public class CrudRepository<T1, T2> {
}