-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
112 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
kotlin.code.style=official | ||
kotlin.code.style=official | ||
kapt.incremental.apt=false | ||
kapt.include.compile.classpath=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
module sharon.main { | ||
requires java.base; | ||
requires java.sql; | ||
requires java.xml; | ||
requires kotlin.stdlib; | ||
requires kotlin.stdlib.jdk7; | ||
requires kotlin.stdlib.jdk8; | ||
requires com.github.javaparser.core; | ||
requires org.seasar.doma.core; | ||
requires org.seasar.doma.slf4j; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package net.love2hina.kotlin.sharon | ||
|
||
import org.seasar.doma.Dao | ||
import org.seasar.doma.Script | ||
import org.seasar.doma.Sql | ||
|
||
@Dao | ||
interface AppDao { | ||
|
||
@Sql(""" | ||
CREATE TABLE FILEMAP ( | ||
ID UUID NOT NULL PRIMARY KEY, | ||
FILE VARCHAR(2048) NOT NULL, | ||
PACKAGE VARCHAR(2048) | ||
); | ||
""") | ||
@Script | ||
fun create(): Unit | ||
|
||
@Sql(""" | ||
DROP TABLE FILEMAP; | ||
""") | ||
@Script | ||
fun drop(): Unit | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package net.love2hina.kotlin.sharon | ||
|
||
import org.seasar.doma.jdbc.Config | ||
import org.seasar.doma.jdbc.JdbcLogger | ||
import org.seasar.doma.jdbc.dialect.Dialect | ||
import org.seasar.doma.jdbc.dialect.H2Dialect | ||
import org.seasar.doma.jdbc.tx.LocalTransactionDataSource | ||
import org.seasar.doma.jdbc.tx.LocalTransactionManager | ||
import org.seasar.doma.jdbc.tx.TransactionManager | ||
import org.seasar.doma.slf4j.Slf4jJdbcLogger | ||
import javax.sql.DataSource | ||
|
||
data class DbConfig( | ||
private val dialect: Dialect, | ||
private val dataSource: DataSource, | ||
private val jdbcLogger: JdbcLogger, | ||
private val transactionManager: TransactionManager | ||
): Config { | ||
|
||
override fun getDialect(): Dialect = dialect | ||
override fun getDataSource(): DataSource = dataSource | ||
override fun getJdbcLogger(): JdbcLogger = jdbcLogger | ||
override fun getTransactionManager(): TransactionManager = transactionManager | ||
|
||
companion object { | ||
fun create(): DbConfig { | ||
val datasource = LocalTransactionDataSource("jdbc:h2:mem:sharon;DB_CLOSE_DELAY=-1", "sa", null) | ||
val logger = Slf4jJdbcLogger() | ||
|
||
return DbConfig( | ||
H2Dialect(), | ||
datasource, | ||
logger, | ||
LocalTransactionManager(datasource.getLocalTransaction(logger)) | ||
) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters