Add explicit @Column and @Table annotations for Serie and SeriePunkt entities to align with SQL schema, include @Id annotations in JPA entities, and resolve schema mapping warnings.

This commit is contained in:
Stefan Mogeritsch 2026-04-12 17:47:47 +02:00
parent 5b207a2b9d
commit 11abbf0179
2 changed files with 9 additions and 5 deletions

View File

@ -7,12 +7,13 @@ import java.util.*
@Table(name = "serien")
class Serie(
@Id
@Column(name = "id")
val id: String = UUID.randomUUID().toString(),
@Column(nullable = false)
@Column(name = "name", nullable = false)
val name: String,
@Column
@Column(name = "beschreibung")
val beschreibung: String? = null,
@Enumerated(EnumType.STRING)
@ -23,7 +24,7 @@ class Serie(
val streichresultateCount: Int = 1,
@Enumerated(EnumType.STRING)
@Column(nullable = false)
@Column(name = "bindungstyp", nullable = false)
val bindungstyp: Bindungstyp = Bindungstyp.PAAR_BINDUNG,
@ElementCollection
@ -67,6 +68,7 @@ enum class Bindungstyp {
@Table(name = "serie_punkte")
class SeriePunkt(
@Id
@Column(name = "id")
val id: String = UUID.randomUUID().toString(),
@Column(name = "serie_id", nullable = false)
@ -81,10 +83,10 @@ class SeriePunkt(
@Column(name = "bewerb_id", nullable = false)
val bewerbId: String,
@Column(nullable = false)
@Column(name = "punkte", nullable = false)
val punkte: Double,
@Column(nullable = false)
@Column(name = "platzierung", nullable = false)
val platzierung: Int
) {
fun copy(

View File

@ -7,6 +7,8 @@
## Heute erledigt
- **Backend (Series-Service):**
- Behebung von JPA-Warnungen durch Umwandlung von `data class` in reguläre `class` für `Serie` und `SeriePunkt`.
- Vollständige explizite Definition aller `@Column` und `@Table` Namen in `Serie.kt` zur Sicherstellung der Synchronität mit dem SQL-Schema.
- Hinzufügen der `@Id` Annotationen in den JPA-Entitäten zur Erfüllung der Framework-Anforderungen.
- Implementierung manueller `copy()`, `equals()`, `hashCode()` und `toString()` Methoden zur Sicherstellung der JPA-Kompatibilität und Code-Funktionalität.
- Erstellung der Flyway-Migration `V1__Create_Series_Tables.sql` zur Definition des Datenbankschemas.
- Korrektur der Spalten-Mappings (@Column) zur Übereinstimmung mit dem SQL-Schema (Snake Case).