POJOs on the Desktop with the Java Persistence API
I mentioned in an earlier post that the Java Persistence API (JPA) could be used on the desktop. I'm still a database weakling, but learning about the JPA and how to use it from desktop applications wasn't nearly as difficult as I imagined.
And what is it that I imagined? Well, I had heard a little, read a little, and observed a little bit of object-relational mapping technologies and had shyed away from all ORM products. And EJBs...I never quite understood anything related to persistence in that arena. Somehow the need for all the various helper beans just scared me away. I simply avoided the subject. I imagined that I'd never get a handle on persistence, especially not from anything related to the EJB specification.
Wow, was I surprised! I read the persistence portion of the EJB 3.0 specification, downloaded the GlassFish reference implementation of the persistence API, and even put together a few little test demos. Demos? Nothing fancy mind you, just little exercises to help me understand the APIs as I discovered them. The best thing I discovered was that I could use plain ol' Java objects -- POJOs -- for both my application logic and persistence.
I've written down the major points that I've learned, along with the demos, and put it all into an online article. My motivation for writing anything is the belief that I represent the average desktop developer. If I benefit or learn something, I figure that someone else must have similar questions and can benefit too. Hopefully, the article Using the Java Persistence API in Desktop Applications will help you discover a potentially useful new API tool for your toolbox. That's certainly what I've discovered.
In my ears: Spoonman by Soundgarden