@Entity
class Product(
@Id
@GeneratedValue
val id: Int? = null
){
@Email
lateinit var name: String
.....
}
Now when i tried to insert an invalid entity:
This will works, but now if I put it into the primary constructor:
class Product(
@Id
@GeneratedValue
val id: Int? = null,
@Email val name: String
)
The entity just get inserted without any validation:
Other annotations work just fine in the constructor (@Id, @ManyToMany …) but not this.