What I like about Spring libraries is that they just work, and they don't suddenly stop working. The APIs are usually well thought-out.
Spring Data JPA continues on the same track.
I've been going through recent developments in ORM / data access technology, and porting my tiny skeleton application to each. Today it's Spring Data JPA's turn.
You provide an interface like this:
And configuration like that:
After which Spring automatically builds, generates and injects a concrete implementation of that interface to your application, where you can use it like so:
Calling the findByNameLike method results in this SQL query being run:
Compared to many other ways of building simple database access I've tried and used, Spring Data JPA takes the cake.
The only complaint I have with it is that when integrating JPA entities with Scaml, you have to refer to their property getters like so example.getName instead of Scaml autodetecting bean properties by simply example.name, but that's more of an issue with Scaml than Spring.
0 comments:
Post a Comment