Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/anasoid/instancio-petclinic-jpa-example
sample spring boot jpa application to generate data by instancio
https://github.com/anasoid/instancio-petclinic-jpa-example
demo demo-app example instancio jpa sample spring test-data-generator
Last synced: 9 days ago
JSON representation
sample spring boot jpa application to generate data by instancio
- Host: GitHub
- URL: https://github.com/anasoid/instancio-petclinic-jpa-example
- Owner: anasoid
- Created: 2025-01-04T04:50:53.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2025-01-16T16:06:43.000Z (21 days ago)
- Last Synced: 2025-01-16T17:29:38.451Z (21 days ago)
- Topics: demo, demo-app, example, instancio, jpa, sample, spring, test-data-generator
- Language: Java
- Homepage:
- Size: 90.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# instancio-petclinic-jpa-sample
This project is an example to generate a fake data based on instancio in Spring boot application with JPA.
The application example used is the popular Spring pet
clinic [spring pet clinic](https://github.com/spring-projects/spring-petclinic)## Generated data
### Steps for demo
1. checkout spring pet clinic application from fork repos
```bash
git clone https://github.com/anasoid/spring-petclinic.git
```2. Install spring petclinic in local maven repo
```bash
cd spring-petclinic
./mvnw package
./mvnw install:install-file -Dfile=./target/spring-petclinic-3.4.0-SNAPSHOT.jar.original -DgroupId=org.springframework.samples -DartifactId=spring-petclinic -Dversion=3.4.0-SNAPSHOT -Dpackaging=jar
```3. Checkout this repo in different folder
```bash
git clone https://github.com/anasoid/instancio-petclinic-jpa-example.git
```4. Run sring boot petclinic app
```bash
./gradlew bootRun
```5. Visit url http://localhost:8080
### Description of application
#### Applications
1. There is two spring boot application present in this repos:
1. __InstancioPetClinicJpaExampleApplication:__ Console application that generate data in database, should be used with
mysql or other server database to be visible.
1. __PetClinicWithDataApplication:__ Star the original spring pet clinic and generated data in h2 in memory database.#### Code
The code to generate petclinic data is presents in package "org.anasoid.instancio.petclinic.jpa.example.petclinic" other
class form "org.anasoid.instancio.petclinic.jpa.example.core" can be resused in different applications.#### Generated Data
The config file by entity is present in [entity-config.yaml](src/main/resources/entity-config.yaml)
| Entity | Remarque |
|:----------|:----------------------------------------------------------------------------------------|
| Vet | generate 10 vets, with one or two specialities |
| Owner | generate minimum 100 owners, with one or two pets |
| Specialty | generate 5 specialities based on csv file [specialty.csv](src/main/resources/data/specialty.csv) |
| Pet | generate one or two pets by owners |
| Pettype | generate 5 pettype based on csv file [pettype.csv](src/main/ resources/data/pettype.csv) |
| Visit | generate zero to fives visits by pets |