fork download
  1. package com.kotlin.model
  2.  
  3. import javax.persistence.*
  4.  
  5. @Entity
  6. @Table(name = "events", schema = "public")
  7. class Events(
  8. @ManyToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL])
  9. @JoinColumn(name = "users_id")
  10. var users_login: Users,
  11.  
  12. @Column(nullable = false)
  13. var events_date: String,
  14.  
  15. @ManyToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL])
  16. @JoinColumn(name = "computers_id")
  17. var computers_id: Computers
  18. ) {
  19. @Id
  20. @GeneratedValue(strategy = GenerationType.SEQUENCE)
  21. val id: Long = 0
  22.  
  23. constructor() : this(Users(""), "", Computers(""))
  24.  
  25. override fun toString(): String {
  26. return "Events(users_login=$users_login, events_date='$events_date', events_computers_name='$computers_id', id=$id)"
  27. }
  28.  
  29. }
  30.  
  31.  
  32.  
  33.  
  34. package com.kotlin.model
  35.  
  36. import javax.persistence.*
  37.  
  38. @Entity
  39. @Table(name = "users", schema = "public")
  40. class Users(
  41.  
  42. @Column(nullable = false)
  43. var users_login: String) {
  44. @Id
  45. @GeneratedValue(strategy = GenerationType.SEQUENCE)
  46. var id: Long = 0
  47.  
  48. @OneToMany(fetch = FetchType.LAZY, mappedBy = "users_login")
  49. val events: List<Events> = emptyList()
  50.  
  51. constructor() : this("")
  52.  
  53. override fun toString(): String {
  54. return "Users(users_login='$users_login', id=$id)"
  55. }
  56.  
  57. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
JNA Warning: IOException removing temporary files: JNA temporary directory '/tmp' is not writable
prog.kt:8:53: error: expecting an expression
        @ManyToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL])
                                                    ^
prog.kt:8:54: error: expecting ')'
        @ManyToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL])
                                                     ^
prog.kt:8:66: error: parameters must have type annotation
        @ManyToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL])
                                                                 ^
prog.kt:8:67: error: expecting comma or ')'
        @ManyToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL])
                                                                  ^
prog.kt:8:70: error: parameters must have type annotation
        @ManyToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL])
                                                                     ^
prog.kt:10:31: error: property getter or setter expected
        var users_login: Users,
                              ^
prog.kt:13:32: error: property getter or setter expected
        var events_date: String,
                               ^
prog.kt:15:53: error: expecting an expression
        @ManyToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL])
                                                    ^
prog.kt:15:54: error: expecting ')'
        @ManyToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL])
                                                     ^
prog.kt:15:55: error: expecting a top level declaration
        @ManyToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL])
                                                      ^
prog.kt:15:66: error: expecting a top level declaration
        @ManyToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL])
                                                                 ^
prog.kt:15:67: error: expecting a top level declaration
        @ManyToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL])
                                                                  ^
prog.kt:15:70: error: expecting a top level declaration
        @ManyToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL])
                                                                     ^
prog.kt:15:71: error: expecting a top level declaration
        @ManyToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL])
                                                                      ^
prog.kt:18:1: error: expecting a top level declaration
) {
^
prog.kt:18:3: error: expecting a top level declaration
) {
  ^
prog.kt:23:19: error: unexpected tokens (use ';' to separate expressions on the same line)
    constructor() : this(Users(""), "", Computers(""))
                  ^
prog.kt:34:1: error: expecting a top level declaration
package com.kotlin.model
^
prog.kt:34:9: error: expecting a top level declaration
package com.kotlin.model
        ^
prog.kt:34:12: error: expecting a top level declaration
package com.kotlin.model
           ^
prog.kt:34:13: error: expecting a top level declaration
package com.kotlin.model
            ^
prog.kt:34:19: error: expecting a top level declaration
package com.kotlin.model
                  ^
prog.kt:34:20: error: expecting a top level declaration
package com.kotlin.model
                   ^
prog.kt:36:1: error: expecting a top level declaration
import javax.persistence.*
^
prog.kt:36:8: error: expecting a top level declaration
import javax.persistence.*
       ^
prog.kt:36:13: error: expecting a top level declaration
import javax.persistence.*
            ^
prog.kt:36:14: error: expecting a top level declaration
import javax.persistence.*
             ^
prog.kt:36:25: error: expecting a top level declaration
import javax.persistence.*
                        ^
prog.kt:36:26: error: expecting a top level declaration
import javax.persistence.*
                         ^
prog.kt:3:14: error: unresolved reference: persistence
import javax.persistence.*
             ^
prog.kt:5:2: error: unresolved reference: Entity
@Entity
 ^
prog.kt:6:2: error: unresolved reference: Table
@Table(name = "events", schema = "public")
 ^
prog.kt:8:10: error: unresolved reference: ManyToOne
        @ManyToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL])
         ^
prog.kt:8:28: error: unresolved reference: FetchType
        @ManyToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL])
                           ^
prog.kt:9:10: error: unresolved reference: JoinColumn
        @JoinColumn(name = "users_id")
         ^
prog.kt:12:10: error: unresolved reference: Column
        @Column(nullable = false)
         ^
prog.kt:15:10: error: unresolved reference: ManyToOne
        @ManyToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL])
         ^
prog.kt:15:28: error: unresolved reference: FetchType
        @ManyToOne(fetch = FetchType.LAZY, cascade = [CascadeType.ALL])
                           ^
prog.kt:16:9: error: property must be initialized
        @JoinColumn(name = "computers_id")
        ^
prog.kt:16:10: error: unresolved reference: JoinColumn
        @JoinColumn(name = "computers_id")
         ^
prog.kt:17:27: error: unresolved reference: Computers
        var computers_id: Computers
                          ^
prog.kt:18:3: error: function declaration must have a name
) {
  ^
prog.kt:19:6: error: unresolved reference: Id
    @Id
     ^
prog.kt:20:6: error: unresolved reference: GeneratedValue
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
     ^
prog.kt:20:32: error: unresolved reference: GenerationType
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
                               ^
prog.kt:23:5: error: unresolved reference: constructor
    constructor() : this(Users(""), "", Computers(""))
    ^
prog.kt:25:5: error: modifier 'override' is not applicable to 'local function'
    override fun toString(): String {
    ^
prog.kt:38:2: error: unresolved reference: Entity
@Entity
 ^
prog.kt:39:2: error: unresolved reference: Table
@Table(name = "users", schema = "public")
 ^
prog.kt:42:10: error: unresolved reference: Column
        @Column(nullable = false)
         ^
prog.kt:44:6: error: unresolved reference: Id
    @Id
     ^
prog.kt:45:6: error: unresolved reference: GeneratedValue
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
     ^
prog.kt:45:32: error: unresolved reference: GenerationType
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
                               ^
prog.kt:48:6: error: unresolved reference: OneToMany
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "users_login")
     ^
prog.kt:48:24: error: unresolved reference: FetchType
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "users_login")
                       ^
stdout
Standard output is empty