setup ffsaf server
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package fr.titionfire.ffsaf.data;
|
||||
|
||||
import org.hibernate.boot.model.naming.Identifier;
|
||||
import org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl;
|
||||
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
|
||||
|
||||
public class SafcaNamingStrategy extends PhysicalNamingStrategyStandardImpl {
|
||||
|
||||
private final static String PREFIX = "ffsaf__";
|
||||
|
||||
@Override
|
||||
public Identifier toPhysicalTableName(Identifier name, JdbcEnvironment context) {
|
||||
return new Identifier(convertToSnakeCasePrefixed(name.getText()), name.isQuoted());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier toPhysicalColumnName(Identifier name, JdbcEnvironment context) {
|
||||
return new Identifier(convertToSnakeCase(name.getText()), name.isQuoted());
|
||||
}
|
||||
|
||||
private String convertToSnakeCase(final String identifier) {
|
||||
final String regex = "([a-z])([A-Z])";
|
||||
final String replacement = "$1_$2";
|
||||
return identifier
|
||||
.replaceAll(regex, replacement)
|
||||
.toLowerCase();
|
||||
}
|
||||
|
||||
private String convertToSnakeCasePrefixed(final String identifier) {
|
||||
final String regex = "([a-z])([A-Z])";
|
||||
final String replacement = "$1_$2";
|
||||
final String newName = identifier
|
||||
.replaceAll(regex, replacement)
|
||||
.toLowerCase();
|
||||
return PREFIX + newName;
|
||||
}
|
||||
}
|
||||
28
src/main/java/fr/titionfire/ffsaf/data/model/ClubModel.java
Normal file
28
src/main/java/fr/titionfire/ffsaf/data/model/ClubModel.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package fr.titionfire.ffsaf.data.model;
|
||||
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@RegisterForReflection
|
||||
|
||||
@Entity
|
||||
@Table(name = "club")
|
||||
public class ClubModel {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
Long id;
|
||||
|
||||
String name;
|
||||
|
||||
String country;
|
||||
|
||||
String shieldURL;
|
||||
}
|
||||
40
src/main/java/fr/titionfire/ffsaf/data/model/CombModel.java
Normal file
40
src/main/java/fr/titionfire/ffsaf/data/model/CombModel.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package fr.titionfire.ffsaf.data.model;
|
||||
|
||||
import fr.titionfire.ffsaf.utils.Categorie;
|
||||
import fr.titionfire.ffsaf.utils.Genre;
|
||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@RegisterForReflection
|
||||
|
||||
@Entity
|
||||
@Table(name = "comb")
|
||||
public class CombModel {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
Long id;
|
||||
|
||||
String lname = "";
|
||||
String fname = "";
|
||||
|
||||
Categorie categorie;
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "club", referencedColumnName = "id")
|
||||
ClubModel club;
|
||||
|
||||
Genre genre;
|
||||
|
||||
int licence = 0;
|
||||
|
||||
String country = "fr";
|
||||
}
|
||||
Reference in New Issue
Block a user