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/db
for the schema scripts). - Update the
src/main/resources/application.properties
file to have the correct values for your data source. - Run the
bootRun
Gradle task to launch the Spring Boot application. - Go to
http://localhost:8080/swagger-ui.html
to 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!
Enjoy