2 files modified
3 files added
| | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-jpa</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-devtools</artifactId> |
| | | <scope>runtime</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.h2database</groupId> |
| | | <artifactId>h2</artifactId> |
| | | <scope>runtime</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.jayway.jsonpath</groupId> |
| | | <artifactId>json-path</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | </dependencies> |
| | |
| | | package hu.unr.fiber.cardapi; |
| | | |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.GeneratedValue; |
| | | import javax.persistence.Id; |
| | | import java.util.Objects; |
| | | |
| | | @Entity |
| | | public class Card { |
| | | public static final long INVALID_ID = 0; |
| | | |
| | | @Id |
| | | @GeneratedValue |
| | | private long id = INVALID_ID; |
| | | private String name; |
| | | //FIXME: @Pattern([0-9]+) |
| | | private String number; |
| | | private String cardHolder; |
| | | |
| | | public Card(){ |
| | | super(); |
| | | } |
| | | |
| | | public Card(long id) { |
| | | this.id = id; |
| | | } |
New file |
| | |
| | | package hu.unr.fiber.cardapi; |
| | | |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | |
| | | public interface CardRepository extends JpaRepository<Card, Long> { |
| | | } |
New file |
| | |
| | | # Enabling H2 Console |
| | | spring.h2.console.enabled=true |
| | | |
| | | #Turn Statistics on |
| | | spring.jpa.properties.hibernate.generate_statistics=true |
| | | logging.level.org.hibernate.stat=debug |
| | | # Show all queries |
| | | spring.jpa.show-sql=true |
| | | spring.jpa.properties.hibernate.format_sql=true |
| | | logging.level.org.hibernate.type=trace |
New file |
| | |
| | | INSERT INTO CARD(ID, NAME, NUMBER) values(1,'Első kártya', '1') |
| | | INSERT INTO CARD(ID, NAME, NUMBER) values(2,'Második kártya', '2') |
| | | INSERT INTO CARD(ID, NAME, NUMBER) values(3,'Harmadik kártya', '4') |
| | | INSERT INTO CARD(ID, NAME, NUMBER) values(10,'Tízezer egyszázadik kártya', '10100') |