This file contains hidden or 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
| @Dao | |
| public interface DeptDao { | |
| @MultiInsert(duplicateKeyType = DuplicateKeyType.UPDATE) | |
| int insertOnDuplicateKeyUpdate(List<Dept> entities); | |
| } | |
| ``` | |
| insert into DEPARTMENT as target ( | |
| DEPARTMENT_ID, | |
| DEPARTMENT_NO, |
This file contains hidden or 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
| package org.komapper.quickstart | |
| import org.komapper.core.dsl.Meta | |
| import org.komapper.core.dsl.QueryDsl | |
| import org.komapper.jdbc.JdbcDatabase | |
| import java.time.LocalDateTime | |
| fun main() { | |
| val database = JdbcDatabase("jdbc:h2:mem:quickstart;DB_CLOSE_DELAY=-1") |
This file contains hidden or 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
| package org.komapper.quickstart | |
| import org.komapper.core.dsl.Meta | |
| import org.komapper.core.dsl.QueryDsl | |
| import org.komapper.core.dsl.expression.WhereDeclaration | |
| import org.komapper.core.dsl.scope.WhereScope | |
| import org.komapper.jdbc.JdbcDatabase | |
| import java.time.LocalDateTime | |
| fun main() { |
This file contains hidden or 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
| import org.komapper.annotation.* | |
| import org.komapper.core.dsl.expression.PropertyExpression | |
| import org.komapper.core.dsl.expression.WhereDeclaration | |
| import java.time.LocalDateTime | |
| // EntityMetamodelのためのインタフェース | |
| interface BiTemporal { | |
| val validFrom: PropertyExpression<LocalDateTime, LocalDateTime> | |
| val validTo: PropertyExpression<LocalDateTime, LocalDateTime> | |
| } |
This file contains hidden or 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
| package org.komapper.quickstart | |
| import org.komapper.annotation.* | |
| import org.komapper.core.dsl.Meta | |
| import org.komapper.core.dsl.QueryDsl | |
| import org.komapper.core.dsl.expression.PropertyExpression | |
| import org.komapper.core.dsl.expression.WhereDeclaration | |
| import org.komapper.core.dsl.metamodel.EntityMetamodel | |
| import org.komapper.jdbc.JdbcDatabase | |
| import java.time.LocalDateTime |
This file contains hidden or 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
| package org.komapper.quickstart | |
| import org.komapper.annotation.* | |
| import org.komapper.core.dsl.Meta | |
| import org.komapper.core.dsl.QueryDsl | |
| import org.komapper.core.dsl.expression.PropertyExpression | |
| import org.komapper.core.dsl.expression.WhereDeclaration | |
| import org.komapper.jdbc.JdbcDatabase | |
| import java.time.LocalDateTime |
This file contains hidden or 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
| @KomapperEntity | |
| @KomapperTable("users") | |
| data class User( | |
| @KomapperId | |
| val id: String, | |
| val name: String, | |
| val age: Int | |
| ) | |
| @KomapperEntity |
This file contains hidden or 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
| // 下記の記事の最後のコード例をKotlinで書いてみた | |
| // https://zenn.dev/hinastory/articles/c8d5267ea43ed6 | |
| package hello.kotlin | |
| data class Person(val name: String, val age: Int) | |
| data class Japanese(val name: String, val age: Int, val info: String) | |
| interface CanGreet<T> { | |
| fun T.hello() |
This file contains hidden or 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
| val d = Dept.meta | |
| val e = Emp.meta | |
| val query = SqlDsl.from(d).innerJoin(e){ d.id eq e.deptId }.associate(d, e) | |
| val aggregate = db.runQuery { query } | |
| val map: Map<Dept, Set<Emp>> = aggregate.oneToMany(d, e) |
This file contains hidden or 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
| public class Address { | |
| public String ctiy; | |
| public String street; | |
| public Address(String city, String street) { | |
| this.city = ctiy; | |
| this.street = street; | |
| } | |
| } |
NewerOlder