Removed SQLite. Removed adding DAOs to Jersey register.

This commit is contained in:
neviyn 2018-09-19 14:18:34 +01:00
parent 3dc5ebb774
commit 6a45056363
5 changed files with 7 additions and 14 deletions

View File

@ -1,9 +1,9 @@
database: database:
# the name of your JDBC driver # the name of your JDBC driver
driverClass: org.sqlite.JDBC driverClass: org.h2.Driver
# the JDBC URL # the JDBC URL
url: jdbc:sqlite:sampledatabase.db url: jdbc:h2:./sampledatabase.db
# any properties specific to your JDBC driver: # any properties specific to your JDBC driver:
properties: properties:

View File

@ -62,11 +62,6 @@
<artifactId>h2</artifactId> <artifactId>h2</artifactId>
<version>1.4.197</version> <version>1.4.197</version>
</dependency> </dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.23.1</version>
</dependency>
</dependencies> </dependencies>
<build> <build>

View File

@ -48,9 +48,6 @@ public class ObservationsApplication extends Application<ObservationsConfigurati
TutorDao tutorDao = new TutorDao(hibernate.getSessionFactory()); TutorDao tutorDao = new TutorDao(hibernate.getSessionFactory());
SiteDao siteDao = new SiteDao(hibernate.getSessionFactory()); SiteDao siteDao = new SiteDao(hibernate.getSessionFactory());
ObservationDao observationDao = new ObservationDao(hibernate.getSessionFactory()); ObservationDao observationDao = new ObservationDao(hibernate.getSessionFactory());
jersey.register(tutorDao);
jersey.register(siteDao);
jersey.register(observationDao);
final TutorResource tutorResource = new TutorResource(tutorDao); final TutorResource tutorResource = new TutorResource(tutorDao);
jersey.register(tutorResource); jersey.register(tutorResource);
final ObservationResource observationResource = new ObservationResource(observationDao, tutorDao, siteDao); final ObservationResource observationResource = new ObservationResource(observationDao, tutorDao, siteDao);

View File

@ -8,6 +8,7 @@ import uk.co.neviyn.Observations.dao.SiteDao;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import java.util.List; import java.util.List;
@ -31,7 +32,7 @@ public class SiteResource {
@Path("/{id}/tutors") @Path("/{id}/tutors")
@GET @GET
@UnitOfWork @UnitOfWork
public Set<Tutor> getSiteTutors(long id){ public Set<Tutor> getSiteTutors(@PathParam("id") long id){
return dao.get(id).getTutors(); return dao.get(id).getTutors();
} }
} }

View File

@ -30,7 +30,7 @@ public class ObservationDaoTest {
); );
@Before @Before
public void setUp() throws Exception { public void setUp() {
dao = new ObservationDao(testRule.getSessionFactory()); dao = new ObservationDao(testRule.getSessionFactory());
siteDao = new SiteDao(testRule.getSessionFactory()); siteDao = new SiteDao(testRule.getSessionFactory());
testRule.inTransaction(() -> siteDao.persist(site)); testRule.inTransaction(() -> siteDao.persist(site));