Posts

Showing posts from April, 2017

My Journey With Implementing JPA

There comes a time in pretty much every programming project when you need to communicate with a database of some sort.  When doing this in Java, one choice is to manipulate DriverManagers or DataSources directly.  However, if you want to take advantage of POJOs to represent your data from the database, manipulating data as objects, you might be staring down the task of writing all sorts of ugly reflection code or a really long constructor to make this happen.  There is an alternative: the Java Persistence API.
Old news, buddy!
JPA is old-school, clocking in at over 10 years old!  (Jeez, I might as well bust out my IBM 5150.)  However, I did not feel like writing reflection like what was done on the last project, so I searched for an alternative.  JPA provides you a mechanism to add in details pertaining to object/relational metadata (ORM), and thus run all sorts of CRUD operations with minimal code, by offering convenience functions for these operations.  The objects you make persist th…