Created
February 10, 2019 14:56
-
-
Save theopendle/b5e65fa806d425491358cd45e4bb3379 to your computer and use it in GitHub Desktop.
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
@Mapper | |
public interface ClientMapper { | |
@Select("SELECT id as id, first_name as firstName, last_name as lastName FROM spring_demo.clients WHERE id = #{id}") | |
Client selectOne(long id); | |
@Select("SELECT id as id, first_name as firstName, last_name as lastName FROM spring_demo.clients") | |
List<Client> findAll(); | |
@Insert("INSERT INTO spring_demo.clients (id, first_name, last_name) VALUES (#{id}, #{firstName}, #{lastName})") | |
// Sets the object id to the id generated in database | |
@Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id") | |
void insertClient(Client client); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment