Creating Java JPA Entities with an XML Field
This is the code sample to accompany the blog post: Creating Java JPA entities with an XML field.
This repository illustrates the usage of an XML field within a JPA entity.
Steps to see everything in action:
- Ensure that you have created the PostgreSQL DB, and the schema (see
src/main/resources/dbfor the schema scripts).
- Update the
src/main/resources/application.propertiesfile to have the correct values for your data source.
- Run the
bootRunGradle task to launch the Spring Boot application.
- Go to
http://localhost:8080/swagger-ui.htmlto access the UI to easily make requests.
- Make a POST request to create a new Person
- Check the DB - you will have stored XML!
- Make a PUT request to update the Person
- Check the DB - your XML would have been updated!