/kotlin-spring-jpa-examples

playground for kotlin, spring boot and jpa

Primary LanguageKotlinMIT LicenseMIT

kotlin-spring-jpa-examples

  • playground for kotlin + spring-boot + bean-validation + jpa + hibernate + querydsl
  • realworld examples (just a little simplified): check api.realestate

status:

  • its an active playground ,therefore in progress ...

requirements

  • postgres

create an example db

$ make db.local.create 

additional resources

bean validation

findings

hibernate:

  • if you have to use if for whatever reason, check the logs ;) ...

hibernate: immutable data class as @Entity

  • in jpa/hibernate context it gets proxied by cglib & bean validation works
  • entity.copy() -> triggers init() method, if there is one

hibernate: auditing

  • Auditing classes (Listeners) are no spring beans
  • @inject will not work out-of-the-box
  • thefore its pretty useless

jetbrains gradle plugin:

querydsl: is awesome :)

elasticsearch

  • https://www.mkyong.com/spring-boot/spring-boot-spring-data-elasticsearch-example/
  • spring-data-elasticsearch: dependency hell:
    • boot 1.5.* with spring-data-elasticsearch does not work with es 5.5
    • es 5.5 requires spring-data-elasticsearch 2.* (boot 2.*)
    • using es transportclient (native protocol) is not recommended by es
    • es recommends using rest-api - which is aware of future versions of es
    • es is currently working on a high level restapi client that should make things easy
    • most cloud providers (hosted-es-as-a-service) just allow using rest api
    • several issues related to jackson-json serialization (e.g.: supports JodaTime but not Java 8 Time Api out-of-the-box)