- Make sure Postgres is running locally with default settings (see instructions below)
- Run
com.davidagood.springbootjpa.SpringBootJpaStarterApplicationor run./gradlew bootRun - Starts @ http://localhost:8080
- Supports basic CRUD operations:
GET /relationPOST /relation?parent=<parentId>&child=<childId>DELETE /relation
- Supports seeding an arbitrary number of relations:
POST /seed/{count}
Run ./gradlew build
docker run -d --name sb-jpa-starter -v sb-jpa-starter-data:/var/lib/postgresql/data -p 5432:5432 postgres:latestdocker logs -f sb-jpa-starterdocker exec -it sb-jpa-starter psql -U postgres\lto list databasesCREATE DATABASE test;Ctrl + Dto quit
- You can now either start the app and table creation will be handled automatically
(Spring runs
resources/schema.sql) or you can manually create the tables and insert some data:\c testto change totestdatabase- Run the statements in
resources/schema.sql INSERT INTO relation(id, parentId, childId, createdAt) VALUES (1, 1, 2, timezone('UTC'::text, now()));INSERT INTO relation(id, parentId, childId) VALUES (2, 2, 3);SELECT * FROM relation;Ctrl + Dto quit