DDL generation based on JPA entities definition is a daily task for many developers. In most cases, we use tools like Hibernate’s built-in generator or JPA Buddy plugin. They make the job easier, but there are exceptions. When it comes to storing big chunks of data in the database, things get a bit complicated.
Use Case: Storing Documents
Let’s assume we need to store a document object with its content in the PostgreSQL database. The JPA entity code for this might look like the code below: