API 1.0.15b CustomerExerciseDevice standalone
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package com.aitrainer.api.model
|
||||
|
||||
import org.hibernate.annotations.Fetch
|
||||
import org.hibernate.annotations.FetchMode
|
||||
import javax.persistence.*
|
||||
|
||||
@Entity
|
||||
@@ -20,7 +18,6 @@ data class Customer (
|
||||
var trainerId: Long = 0,
|
||||
var password: String? = "",
|
||||
var birthYear:Int = 0,
|
||||
// var weight: Int = 0,
|
||||
var goal: String? = null,
|
||||
var fitnessLevel: String = "beginner",
|
||||
var bodyType: String? = null,
|
||||
@@ -28,8 +25,4 @@ data class Customer (
|
||||
|
||||
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
var customerId: Long = 0
|
||||
) {
|
||||
@OneToMany(cascade = [(CascadeType.ALL)], fetch = FetchType.EAGER, mappedBy = "customer")
|
||||
@Fetch(value = FetchMode.SUBSELECT)
|
||||
var exerciseDevices: List<CustomerExerciseDevice> = mutableListOf<CustomerExerciseDevice>()
|
||||
}
|
||||
)
|
||||
|
||||
@@ -12,14 +12,9 @@ data class CustomerExerciseDevice (
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
val customerExerciseDeviceId: Long = 0,
|
||||
@get: NotNull var exerciseDeviceId: Long?,
|
||||
//@get: NotNull var customerId: Long?,
|
||||
@get: NotNull var customerId: Long?,
|
||||
@get: NotNull var favourite: Boolean?,
|
||||
@get: NotNull var dateAdd: String? = null
|
||||
|
||||
) {
|
||||
@ManyToOne(fetch = FetchType.EAGER, optional = false)
|
||||
@JoinColumn(name = "customerId", nullable = false)
|
||||
@JsonIgnore
|
||||
val customer: Customer? = null
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user