Sprawdzenie schematu: brak kolumny [identyfikator zdarzenia] w tabeli [process_event]. Nie wiem, dlaczego

0

Pytanie

W moim programie springboot mam następny model

@Table(name = "process_event", indexes = [
    Index(name = "pe_eventId_idx", columnList = "eventId")
])
@Entity
internal class ProcessEvent {
    @EmbeddedId
    var id: ProcessEventId? = null
}

i

@Embeddable
internal class ProcessEventId : Serializable {
    @Column(name = "processId", nullable = false, length = 100)
    var processId: String? = null

    @Column(name = "eventId", nullable = false, length = 100)
    var eventId: String? = null

    override fun hashCode(): Int = Objects.hash(processId, eventId)
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (other == null || Hibernate.getClass(this) != Hibernate.getClass(other)) return false

        other as ProcessEventId

        return processId == other.processId &&
                eventId == other.eventId
    }

    companion object {
        private const val serialVersionUID = 2616696968741078700L
    }
}

Uruchamianie aplikacji wyświetla następujący błąd Failed to initialize JPA EntityManagerFactory: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: missing column [event_id] in table [process_event]

Modele generowane z wykorzystaniem intellij . Nie mam pojęcia, dlaczego mam ten błąd. Jakaś pomoc ?

hibernate kotlin spring-data-jpa
2021-11-23 18:03:48
1

Najlepsza odpowiedź

0

Dobrze, to zdecydowano się poprzez dodanie strategii nazewnictwa

jpa:
    hibernate:
      ddl-auto: validate
      naming.physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

2021-11-24 08:59:16

W innych językach

Ta strona jest w innych językach

Русский
..................................................................................................................
Italiano
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................