JPA ManyToOne JsonIgnore
This commit is contained in:
parent
cec8f5a4a4
commit
62be53118b
@ -1,5 +1,6 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import org.hibernate.annotations.Fetch
|
||||
import org.hibernate.annotations.FetchMode
|
||||
import org.springframework.lang.NonNull
|
||||
@ -15,9 +16,11 @@ data class ExerciseTree (
|
||||
@get: NonNull var parentId: Int,
|
||||
@get: NotBlank var name: String = "",
|
||||
@get: NotBlank var imageUrl: String = "",
|
||||
@get: NonNull var active: Boolean?,
|
||||
@get: NonNull var active: Boolean?
|
||||
|
||||
|
||||
) {
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "exerciseTree")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
val translations: List<ExerciseTreeTranslation> = mutableListOf<ExerciseTreeTranslation>().toList()
|
||||
)
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import javax.persistence.*
|
||||
import javax.validation.constraints.NotBlank
|
||||
|
||||
@ -16,6 +17,7 @@ data class ExerciseTreeTranslation (
|
||||
) {
|
||||
@ManyToOne(fetch = FetchType.EAGER, optional = false)
|
||||
@JoinColumn(name = "treeId", nullable = false)
|
||||
@JsonIgnore
|
||||
val exerciseTree: ExerciseTree? = null
|
||||
|
||||
}
|
||||
|
@ -19,14 +19,16 @@ data class ExerciseType(
|
||||
|
||||
|
||||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
val exerciseTypeId: Long = 0,
|
||||
val exerciseTypeId: Long = 0
|
||||
|
||||
|
||||
) {
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "exerciseType")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
val images: List<ExerciseTypeImage> = mutableListOf<ExerciseTypeImage>()
|
||||
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "exerciseType")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
val images: List<ExerciseTypeImage> = mutableListOf<ExerciseTypeImage>().toList(),
|
||||
val translations: List<ExerciseTypeTranslation> = mutableListOf<ExerciseTypeTranslation>()
|
||||
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "exerciseType")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
val translations: List<ExerciseTypeTranslation> = mutableListOf<ExerciseTypeTranslation>().toList()
|
||||
|
||||
)
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import org.springframework.lang.NonNull
|
||||
import javax.persistence.*
|
||||
import javax.validation.constraints.NotBlank
|
||||
@ -19,6 +20,7 @@ data class ExerciseTypeImage (
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER, optional = false)
|
||||
@JoinColumn(name="exerciseTypeId", nullable=false)
|
||||
@JsonIgnore
|
||||
val exerciseType: ExerciseType? = null
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore
|
||||
import org.springframework.lang.NonNull
|
||||
import javax.persistence.*
|
||||
import javax.validation.constraints.NotBlank
|
||||
@ -18,5 +19,6 @@ data class ExerciseTypeTranslation (
|
||||
|
||||
@ManyToOne(fetch = FetchType.EAGER, optional = false)
|
||||
@JoinColumn(name = "exerciseTypeId", nullable = false)
|
||||
@JsonIgnore
|
||||
val exerciseType: ExerciseType? = null
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user