SHARE
TWEET

Untitled

a guest Jun 12th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top