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 be.heh.onlineauction.application.domain.model; | |
import lombok.AllArgsConstructor; | |
import lombok.Getter; | |
import lombok.RequiredArgsConstructor; | |
import lombok.Setter; | |
import org.apache.tomcat.util.codec.binary.Base64; | |
@AllArgsConstructor | |
@RequiredArgsConstructor |
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
plugins { | |
id 'java' | |
id 'org.springframework.boot' version '3.5.6' | |
id 'io.spring.dependency-management' version '1.1.7' | |
} | |
group = 'be.heh' | |
version = '0.0.1-SNAPSHOT' | |
description = 'onlineauction' |
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
## default connection pool | |
spring.datasource.hikari.connectionTimeout=20000 | |
spring.datasource.hikari.maximumPoolSize=5 | |
## PostgreSQL | |
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres | |
spring.datasource.username=postgres | |
spring.datasource.password=root | |
spring.datasource.driverClassName = org.postgresql.Driver |
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
insert into personnes(first_name, last_name, age) values ('tata','tutu',12); | |
insert into personnes(first_name, last_name, age) values ('tata1','tutu1',21); | |
insert into personnes(first_name, last_name, age) values ('tata2','tutu2',32); |
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
CREATE TABLE IF NOT EXISTS personnes ( | |
idPerson SERIAL, | |
first_Name varchar(15), | |
last_Name varchar(15), | |
age int | |
); |
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 be.heh.projetapiweb; | |
import org.junit.ClassRule; | |
import org.junit.jupiter.api.Test; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; | |
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; | |
import org.springframework.context.annotation.Import; | |
import org.springframework.test.context.jdbc.Sql; | |
import org.testcontainers.containers.GenericContainer; |
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 be.heh.projetapiweb; | |
import org.springframework.data.jpa.repository.JpaRepository; | |
import org.springframework.stereotype.Repository; | |
@Repository | |
interface PersonRepository extends JpaRepository<PersonJpaEntity,Long> { | |
} |
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 be.heh.projetapiweb; | |
import lombok.RequiredArgsConstructor; | |
import org.springframework.stereotype.Component; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; |
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 be.heh.projetapiweb; | |
import lombok.Data; | |
import javax.persistence.*; | |
import java.util.UUID; | |
@Entity | |
@Table(name = "personnes") | |
@Data | |
public class PersonJpaEntity { |
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
## PostgreSQL | |
spring.datasource.url=jdbc:tc:postgresql:13://localhost:5432/postgres | |
spring.datasource.username=postgres | |
spring.datasource.password=root | |
spring.datasource.driverClassName = org.testcontainers.jdbc.ContainerDatabaseDriver | |
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL9Dialect | |
spring.jpa.generate-ddl=false | |
#drop n create table again, good for testing, comment this in production | |
##spring.jpa.hibernate.ddl-auto=create |
NewerOlder