JDBI3 is the answer to ORMS.
It's not an ORM. per-se :-)
And the Sql Object component allows strong typing in a much easier way.
You use annotations to define sql statements with parameters in interface classes. Or, optionally, sql files.
At work I ended up converting all our DB accesses, both raw and JPA over to JDBI3.
Here is an example: https://github.com/CherokeeLanguage/AudioQualityVote/blob/main/audio-quality-vote-db/src/main/java/com/cherokeelessons/audio/quality/db/AudioQualityVoteDao.java
On Tue, Mar 9, 2021 at 3:10 AM Gordan Krešić <gordan.kresic@steatoda.com> wrote:
On 09. 03. 2021. 08:29, Craig Mitchell wrote:
>
> Too late. Flame war! ;P But seriously, what's wrong with using Hibernate
> as JPA provider? Okay, yes, there is nothing to learn, it does all its
> magic behind the scenes, but is there something better? Or maybe using JPA
> is bad, and we go back to pure SQL? I'm curious.
I did try various ORMs, including some for non-relational databases (but
then it's not an ORM, but... what?) but never figured out the benefits. They
all demo well, but when I go past most basic usage, they always felt more
like an obstacle than a tool.
Only case where I would agree using ORM saves time are projects with high
number of tables compared to complexity of their usage (simple SELECTs on
hundreds or thousands of tables). But, I don't have such a project in my
portfolio.
Can you name few other benefits? Type safety? "Compile-time checks" of SQL
"queries"? I can see *some* benefits there, but hardly ones that justifies
learning another, fairly complex, DSL on top of SQL.
From time to time I found a survey with question like "Which ORM do you
use?" and there are usually low-double-digits of percentages of users who
claim to be using "raw JDBC with SQL". It gives me hope that I'm not a lone
lunatic, but still, 80+% of users must know *something*, right?
So, if we assume that someone already knows SQL (and it's an 'if', I know),
what would be the benefits of using ORM of any kind?
Bonus question: I've been looking for years for a most simplistic SQL
templating library, mainly for things like reusing WHERE clauses (i usually
end up with fairly complex ones used in multiple queries), linking '?' with
setters on PreparedStatements and things like that. I even wrote small lib
because I was tired of experimenting, but I seriously doubt that I'm the
only one with this need and would instead like to contribute to already
existing project rather than maintain my own.
-gkresic.
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/21b217be-c3b1-884e-8a98-4709ae383d7b%40steatoda.com.
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/CAFHWztzuWPOsC2Wh%3DM4a-tGgi_tS8s-pqi9%2B9_jiS31-x9yvPg%40mail.gmail.com.
No comments:
Post a Comment