Skip to content

Instantly share code, notes, and snippets.

@MarioAriasC
Created September 7, 2013 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarioAriasC/6474576 to your computer and use it in GitHub Desktop.
Save MarioAriasC/6474576 to your computer and use it in GitHub Desktop.
RowMapper with KotlinPrimavera
package org.kotlinprimavera.samples.petclinic.repository.jdbc
import org.springframework.jdbc.core.RowMapper
import java.sql.ResultSet
import org.kotlinprimavera.jdbc.core.build
import org.joda.time.DateTime
/**
* Created by IntelliJ IDEA.
* @author Mario Arias
* Date: 30/08/13
* Time: 22:54
*/
public class JdbcPetRowMapper : RowMapper<JdbcPet> {
public override fun mapRow(rs: ResultSet?, rowNum: Int): JdbcPet? {
return rs!!.build {
val pet = JdbcPet()
pet.id = int["id"]
pet.name = string["name"]
pet.birthDate = DateTime(date["birth_date"])
pet.typeId = int["type_id"]
pet.ownerId = int["owner_id"]
pet
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment