Skip to content

Commit 4d9460d

Browse files
committed
[ADD] #26 add jpa support plugin
1 parent a1336dd commit 4d9460d

File tree

14 files changed

+11
-39
lines changed

14 files changed

+11
-39
lines changed

SpringBootCache/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
id 'org.springframework.boot' version '2.1.3.RELEASE'
33
id 'org.jetbrains.kotlin.jvm' version '1.2.71'
44
id 'org.jetbrains.kotlin.plugin.spring' version '1.2.71'
5+
id "org.jetbrains.kotlin.plugin.jpa" version "1.2.71"
56
}
67

78
apply plugin: 'io.spring.dependency-management'
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
package com.example.kotlin.domain
22

3-
data class Book(val isbn: String, val title: String) {
4-
constructor() : this("", "")
5-
}
3+
data class Book(val isbn: String, val title: String)

SpringBootConfigurable/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
id 'org.springframework.boot' version '2.1.3.RELEASE'
33
id 'org.jetbrains.kotlin.jvm' version '1.2.71'
44
id 'org.jetbrains.kotlin.plugin.spring' version '1.2.71'
5+
id "org.jetbrains.kotlin.plugin.jpa" version "1.2.71"
56
}
67

78
apply plugin: 'io.spring.dependency-management'

SpringBootConfigurable/src/main/kotlin/com/example/kotlin/account/Account.kt

-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ class Account(@Id val id: String,
1616
@Transient
1717
lateinit var passwordEncoder: PasswordEncoder
1818

19-
constructor() : this("", "")
20-
2119
fun resetPassword() {
2220
val newPassword = RandomStringUtils.randomAlphanumeric(10)
2321
this.password = passwordEncoder.encode(newPassword)

SpringBootJpa/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
id 'org.springframework.boot' version '2.1.3.RELEASE'
33
id 'org.jetbrains.kotlin.jvm' version '1.2.71'
44
id 'org.jetbrains.kotlin.plugin.spring' version '1.2.71'
5+
id "org.jetbrains.kotlin.plugin.jpa" version "1.2.71"
56
}
67

78
apply plugin: 'io.spring.dependency-management'

SpringBootJpa/src/main/kotlin/com/example/kotlin/onetomany/domain/Order.kt

+1-4
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,12 @@ data class Order(
1414
@ManyToOne @JoinColumn(name = "PRODUCT_IDX")
1515
var product: Product? = null
1616
) {
17-
18-
constructor() : this(null, null, null, null)
19-
2017
override fun toString(): String {
2118
return "Order{" +
2219
"idx=" + idx +
2320
", productCount=" + productCount +
2421
", bigo='" + bigo + '\''.toString() +
25-
", product=" + product!!.name +
22+
", product=" + product?.name +
2623
'}'.toString()
2724
}
2825
}

SpringBootJpa/src/main/kotlin/com/example/kotlin/onetomany/domain/Product.kt

+1-12
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,4 @@ data class Product(
1111
var name: String? = null,
1212
@Column(name = "CONTENT")
1313
var content: String? = null
14-
) {
15-
16-
constructor() : this(null, null, null)
17-
18-
override fun toString(): String {
19-
return "Product{" +
20-
"idx=" + idx +
21-
", name='" + name + '\''.toString() +
22-
", content='" + content + '\''.toString() +
23-
'}'.toString()
24-
}
25-
}
14+
)

SpringBootJpa/src/main/kotlin/com/example/kotlin/onetoone/domain/Market.kt

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ data class Market(
1414
@OneToOne @JoinColumn(name = "MARKET_ID")
1515
var owner: Owner? = null) {
1616

17-
constructor() : this(null, null, null, null)
18-
1917
override fun toString(): String {
2018
return "Market(idx=$idx, name=$name, location=$location, owner=${owner?.name})"
2119
}

SpringBootJpa/src/main/kotlin/com/example/kotlin/onetoone/domain/Owner.kt

+1-7
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,4 @@ data class Owner(
1111
var name: String? = null,
1212
@OneToOne @JoinColumn(name = "OWNER_ID")
1313
var market: Market? = null
14-
) {
15-
constructor() : this(null, null, null)
16-
17-
override fun toString(): String {
18-
return "Owner(idx=$idx, name=$name, market=${market?.name})"
19-
}
20-
}
14+
)

SpringBootJpa/src/main/kotlin/com/example/kotlin/simple/domain/Customer.kt

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ data class Customer(
1010
@Column(length = 14) val tel: String,
1111
var bigo: String) {
1212

13-
constructor() : this(null, "", "", "")
14-
1513
fun changeBigo(bigo: String) {
1614
this.bigo = bigo
1715
}

SpringBootJpa/src/main/kotlin/com/example/kotlin/simple/domain/TimeData.kt

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,4 @@ import java.time.LocalDateTime
99
@Entity
1010
data class TimeData(
1111
@Id @GeneratedValue val idx: Long? = null,
12-
val date: LocalDateTime) {
13-
14-
constructor() : this(null, LocalDateTime.now())
15-
}
12+
val date: LocalDateTime)

SpringBootJpa/src/test/kotlin/com/example/kotlin/CustomerRepositoryTests.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import org.springframework.test.context.junit4.SpringRunner
1212

1313
@RunWith(SpringRunner::class)
1414
@DataJpaTest
15-
open class CustomerRepositoryTests {
15+
class CustomerRepositoryTests {
1616

1717
@Autowired
1818
lateinit var repository: CustomerRepository

SpringBootJpa/src/test/kotlin/com/example/kotlin/EntityManagerTests.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import org.springframework.test.context.junit4.SpringRunner
1111

1212
@RunWith(SpringRunner::class)
1313
@DataJpaTest
14-
open class EntityManagerTests {
14+
class EntityManagerTests {
1515

1616
@Autowired
1717
lateinit var testEntityManager: TestEntityManager

SpringBootJpa/src/test/kotlin/com/example/kotlin/OneToOneTests.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import org.springframework.transaction.annotation.Transactional
1515
@RunWith(SpringRunner::class)
1616
@SpringBootTest
1717
@Transactional
18-
open class OneToOneTests {
18+
class OneToOneTests {
1919

2020
@Autowired
2121
lateinit var marketRepository: MarketRepository

0 commit comments

Comments
 (0)