Events and JPA Events Reposytory

master
dizda13 2017-03-23 03:50:16 +01:00
parent 26d383d3f1
commit 0b942ace1b
5 changed files with 8 additions and 23 deletions

View File

@ -23,10 +23,7 @@ repositories {
dependencies { dependencies {
compile("org.springframework.boot:spring-boot-starter-data-rest")
compile('org.springframework.boot:spring-boot-starter-data-jpa') compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-jdbc') runtime('com.h2database:h2')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-web-services')
runtime('mysql:mysql-connector-java')
testCompile('org.springframework.boot:spring-boot-starter-test')
} }

View File

@ -5,14 +5,15 @@ package ba.steleks.repository;
import ba.steleks.repository.model.Event; import ba.steleks.repository.model.Event;
import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import java.util.List; import java.util.List;
//@RepositoryRestResource(collectionResourceRel = "events", path = "events")
public interface EventsJpaRepository extends PagingAndSortingRepository<Event, Long> { public interface EventsJpaRepository extends PagingAndSortingRepository<Event, Long> {
Event save(Event event); Event save(Event event);
List<Event> findAll(); List<Event> findAll();
Event findOne(Long ID); Event findOne(Long ID);
List<Event> findByTitle(String title);
} }

View File

@ -23,6 +23,8 @@ public class Event {
private String createdById; private String createdById;
private String eventType; private String eventType;
protected Event() {}
public long getId() { public long getId() {
return id; return id;
} }

View File

@ -0,0 +1 @@
server.port = 9000

View File

@ -1,16 +0,0 @@
package ba.steleks;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class EventsApplicationTests {
@Test
public void contextLoads() {
}
}