5 ms·
> Of that list, a typical Spring Boot application in the wild miiiiiiight use JPA. And that is totally optional, with a handful of newer ORM frameworks seriousl
by krzyk 4y ago
> Of that list, a typical Spring Boot application in the wild miiiiiiight use JPA. And that is totally optional, with a handful of newer ORM frameworks seriously eating into its market share
Could you cite some?
Specifically any that encourages immutable objects (like records in entities).
- kaba0 4y agoNot sure whether it is an ORM, but some people like JOOQ quite a bit.
- krzyk 4y agoYes I heard that, but it has other issues - code generation :( And AFAIR it needs a license for usage with Oracle, and getting approvals for something like that in a corp is PITA.
- kaba0 4y agoCode generation is not necessary, just makes it more typesafe and comfortable to use AFAIK. And yeah, its licensing is basically it is free for open-source dbs, paid otherwise.
- 62951413 4y agoI believe there's a pretty common approach implied here that assumes that SQL DDL is what you start from. It's nicely aligned with how RDBMS schema changes are usually applied too (i.e. a DDL script to make changes and possibly another to roll them back): * define you DB schema in a SQL script under version control * apply the script to your local DB instance, re-generate JOOQ classes (under version control too) * update the service logic * commit all the changes * in prod, apply the script and then re-deploy the code
- 62951413 4y agoThe best description I have seen is "type safe SQL" and it's a default choice for me too. One of the rare occasions where code generation in a Java library doesn't feel like magic and doesn't require littering your code with annotations.
- ithrow 4y agoWrite SQL and do the mappings to records yourself.
- cogman10 4y agoI've never understood why this isn't a more common approach. JDBC is an old standard, but it's also perfectly functional. The addition of try-with-resources has made it fairly terse once you know your way around it. And half the time with an ORM, you are trying to figure out what SQL is ultimately being generated and tweaking to get what you want. So, cut that middle layer out and just write what you want.
- krzyk 4y agoYes, tried that once and every other developer in my team complained. I would stick with JDBC if I were the only developer.
- StevePerkins 4y agoFor one, Spring offers "Spring Data JDBC", where the Spring Data repositories that people like so much can be implemented with raw JDBC rather than using a full ORM. Beyond that, there is JDBI (another thin wrapper around raw SQL), jOOQ, and MyBatis. And then a number of other options like Apache Cayenne that are interesting but never really caught on.
- BlackFly 4y agoHop on LinkedIn and search for job openings mentioning spring-data-r2dbc, or spring + r2dbc. Edit: r2dbc being reactive is founded firmly in the idea that you won't be getting proxy objects. I'm more of a vert.x fan myself so I haven't used it personally but I see CVs come by my desk with users of it.