API 1.0.36 description table
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.google.gson.annotations.Expose
|
||||
import org.hibernate.annotations.Fetch
|
||||
import org.hibernate.annotations.FetchMode
|
||||
import org.springframework.lang.NonNull
|
||||
import javax.persistence.*
|
||||
|
||||
@Entity
|
||||
data class Description (
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var descriptionId: Long = 0,
|
||||
@Expose @get: NonNull var name: String,
|
||||
@Expose @get: NonNull var description: String,
|
||||
@Expose @get: NonNull var version: Int? = null,
|
||||
@Expose @get: NonNull var validFrom: String? = null,
|
||||
@Expose @get: NonNull var validTo: String? = null
|
||||
) {
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "mainDescription")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
@Expose val translations: List<DescriptionTranslation> = mutableListOf<DescriptionTranslation>().toList()
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import com.google.gson.annotations.Expose
|
||||
import org.springframework.lang.NonNull
|
||||
import javax.persistence.*
|
||||
import javax.validation.constraints.NotBlank
|
||||
|
||||
@Entity
|
||||
data class DescriptionTranslation (
|
||||
@Expose @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @get: NonNull var translationId: Long = 0,
|
||||
@Expose @get: NotBlank var languageCode: String? = "hu",
|
||||
@Expose @get: NonNull var descriptionTranslation: String? = null
|
||||
) {
|
||||
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||
@JoinColumn(name = "descriptionId", nullable = false)
|
||||
@JsonIgnore val mainDescription: Description? = null
|
||||
}
|
||||
Reference in New Issue
Block a user