My code
import javax.persistence.*
@Entity
class ShopItem(@Id @GeneratedValue(strategy = GenerationType.AUTO)
val id: Long = 0,
@OneToOne(fetch = FetchType.EAGER, cascade = [CascadeType.ALL])
val item: Item,
val price: Float)
Throws this error when compiling
Error:Kotlin: [Internal Error] org.jetbrains.kotlin.util.KotlinFrontEndException: Exception while analyzing expression at (8,61) in /Users/me/dev/kotlin/Tori/src/main/kotlin/com/gahvigames/tori/model/ShopItem.kt:
[CascadeType.ALL]
This is what my build.gradle
looks like
buildscript {
ext {
kotlinVersion = '1.2-M1'
springBootVersion = '2.0.0.M2'
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
maven { url "http://dl.bintray.com/kotlin/kotlin-eap-1.2" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-noarg:${kotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
}
}
apply plugin: 'kotlin'
apply plugin: 'kotlin-jpa'
apply plugin: 'kotlin-spring'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
maven { url "http://dl.bintray.com/kotlin/kotlin-eap-1.2" }
}
dependencies {
compile('org.springframework.boot:spring-boot-starter')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile("com.fasterxml.jackson.module:jackson-module-kotlin:2.8.9")
compile("com.h2database:h2")
compile("org.jetbrains.kotlin:kotlin-stdlib-jre8:${kotlinVersion}")
compile("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
testCompile('org.springframework.boot:spring-boot-starter-test')
}
Using arrayOf(CascadeType.ALL)
works fine, am I doing something wrong here?