Advertisement
Guest User

Untitled

a guest
Jun 12th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.75 KB | None | 0 0
  1. @Repository
  2. interface DbHost : JpaRepository<HostEntity, Long> {
  3.  
  4.     fun findHostEntityByUserAuth_Name(login: String): HostEntity
  5.  
  6. }
  7.  
  8. @Entity
  9. class HostEntity(
  10.         @Column(name = "first_name")
  11.         var firstName: String,
  12.  
  13.         @Column(name = "last_name")
  14.         var lastName: String,
  15.  
  16.         @OneToOne(cascade = [CascadeType.ALL], orphanRemoval = true)
  17.         var userAuth: UserEntity,
  18.  
  19.         @Id
  20.         @GeneratedValue(strategy = GenerationType.IDENTITY)
  21.         var id: Long? = null
  22. )
  23.  
  24. @Entity
  25. class UserEntity(
  26.         @Id
  27.         @Column(unique = true)
  28.         val name: String,
  29.  
  30.         @Column(name = "password")
  31.         val password: String,
  32.  
  33.         @Enumerated(EnumType.STRING)
  34.         val role: Role)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement