TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

JOOQ: an alternative approach to traditional ORMs

73 pointsby alanfranzover 9 years ago

13 comments

solutionyogiover 9 years ago
Never heard of this before as I mainly use MS stack.<p>However, my first impression is very positive.<p>1. Database First<p>Great way to distinguish your product from traditional ORMs. I am personally not a fan of code first approach especially as a LOB applications developer. I have been writing code for 15 years and the database&#x2F;schema has outlived each and every application that I wrote. (I am in full agreement with lukaseder&#x27;s comment: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10880942" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10880942</a>) As an experienced developer, they immediately made their value proposition clear to me and I wanted to learn more.<p>2. Examples<p>Side by side example comparing jOOQ to SQL. A great way for me to quickly see if I like their DSL design.<p>3. Convince your manager page.<p>I absolutely loved this: <a href="http:&#x2F;&#x2F;www.jooq.org&#x2F;why-jOOQ.pdf" rel="nofollow">http:&#x2F;&#x2F;www.jooq.org&#x2F;why-jOOQ.pdf</a><p>We all have worked with &#x27;a technical manager&#x27; who isn&#x27;t really technical. When you need to purchase a tool, you need to convince your manager and this page is as good as I have seen. All commercial software development tool product websites should feature a &#x27;Convince your manager&#x27; page.
评论 #10882518 未加载
评论 #10882100 未加载
评论 #10882647 未加载
评论 #10882506 未加载
ahacheteover 9 years ago
I have been using jOOQ for quite some time. Indeed, it&#x27;s the <i>only</i> mechanism (definitely not an ORM) to access the database that we use in my company.<p>From my own experience, and this is general consensus, it&#x27;s a big win to use it. Its SQL inspired fluent syntax brings you back the power of SQL, including really advanced stuff. But at the same time, in a Java native manner, type safe, by the way.<p>If you haven&#x27;t tried it yet, you definitely should.
评论 #10881289 未加载
continuationalover 9 years ago
&gt; type safe SQL queries<p>Really? So the compiler will catch this error?<p><pre><code> create.select().from(AUTHOR).where(BOOK.LANGUAGE.eq(&quot;DE&quot;)) </code></pre> No it won&#x27;t, because `where` has this type:<p><pre><code> SelectConditionStep&lt;R&gt; where(Field&lt;Boolean&gt; field) </code></pre> If it was type safe, `Field&lt;Boolean&gt;` would have to mention the type of the records that can be queried.<p>Type safety is what is being sold on the front page as the main value proposition.<p>Needless to say, I&#x27;m not sold on it.
评论 #10886189 未加载
评论 #10883795 未加载
critiumover 9 years ago
Sorry if I did too much TL;DR but this reads very much like Apache Torque, which has been around for a very loooooooong time.<p><a href="https:&#x2F;&#x2F;db.apache.org&#x2F;torque&#x2F;torque-4.0&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;db.apache.org&#x2F;torque&#x2F;torque-4.0&#x2F;index.html</a><p>Apache Torque is an object-relational mapper for java. In other words, Torque lets you access and manipulate data in a relational database using java objects. Unlike most other object-relational mappers, Torque does not use reflection to access user-provided classes, but it generates the necessary classes (including the Data Objects) from an XML schema describing the database layout. The XML file can either be written by hand or a starting point can be generated from an existing database. The XML schema can also be used to generate and execute a SQL script which creates all the tables in the database.<p>As Torque hides database-specific implementation details, Torque makes an application independent of a specific database if no exotic features of the database are used.<p>Usage of code generation eases the customization of the database layer, as you can override the generated methods and thus easily change their behavior. A modularized template structure allows inclusion of your own code generation templates during the code generation process.
评论 #10881164 未加载
levosmetaloover 9 years ago
Looked interesting until the moment I saw it&#x27;s not free. Sorry, but in this day and year I&#x27;m not gonna consider using a piece of basic infrastructure that is not free and open source, at least not for something as fundamental as ORM layer.
评论 #10880804 未加载
评论 #10881080 未加载
ehartsuykerover 9 years ago
Or you could use Slick[0] for free.<p>[0]: <a href="http:&#x2F;&#x2F;slick.typesafe.com&#x2F;" rel="nofollow">http:&#x2F;&#x2F;slick.typesafe.com&#x2F;</a>
评论 #10881623 未加载
评论 #10881669 未加载
评论 #10881694 未加载
评论 #10881628 未加载
DasIchover 9 years ago
This looks suspiciously similar to SQLAlchemy[1].<p>[1]: <a href="http:&#x2F;&#x2F;www.sqlalchemy.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.sqlalchemy.org&#x2F;</a>
评论 #10880993 未加载
评论 #10880989 未加载
kimiover 9 years ago
A simple library that is similar (but not multi-database; this said, at least you don&#x27;t have to learn another syntax for SQL) <a href="https:&#x2F;&#x2F;github.com&#x2F;l3nz&#x2F;ObjectiveSync" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;l3nz&#x2F;ObjectiveSync</a><p>- Minimal wrapper over JDBC.<p>- Querying done in SQL. You should not be afraid of SQL. If you are, you should not be doing anything above the trivial CRUD.<p>- Centralizing object marshaling and unmarshaling - each object should know how to sync itself and its descendents<p>- Single syntax for inserting and updating<p>- Ruby-like objectivized JDBC fetching with exception handling<p>- User-definable deep fetching and updating (almost Hibernate-like).<p>- Batch API to avoid round-trips when submitting multiple queries.<p>- Stats collection and similar stuff.
vtman2002over 9 years ago
A fully open source equivalent: <a href="https:&#x2F;&#x2F;github.com&#x2F;keredson&#x2F;DKO" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;keredson&#x2F;DKO</a><p>I wrote this for Two Sigma&#x27;s internal use back in 2010.
评论 #10881389 未加载
matdrewinover 9 years ago
Not too sure what&#x27;s special about this thing. I also wonder why people keep making DSLs to replace SQL. I was using iBatis back in 2005 (now called MyBatis - <a href="http:&#x2F;&#x2F;blog.mybatis.org&#x2F;?m=1" rel="nofollow">http:&#x2F;&#x2F;blog.mybatis.org&#x2F;?m=1</a>) and it worked great.
评论 #10887432 未加载
ssijakover 9 years ago
Does it &quot;feel&quot; natural to use it with spring boot instead of jpa and hibernate?
评论 #10886207 未加载
mediumdaveover 9 years ago
&gt; jOOQ is SQL-centric. Your database comes &quot;first&quot;.<p>This approach has always seemed completely backwards to me. Isn&#x27;t the database simply a mechanism for persisting records&#x2F;objects whose structure is determined by domain modeling?<p>To me, it would make about as much to say of a GUI framework &quot;foobarWidgets is GUI-centric. Your UI comes &#x27;first&#x27;.&quot;, as though the application itself was just an afterthought.<p>Don&#x27;t get me wrong - I like SQL, and I happily use relational databases to store objects. I just see the database as a means, not an end.
评论 #10880942 未加载
评论 #10881302 未加载
评论 #10881034 未加载
评论 #10881269 未加载
guiyeover 9 years ago
This is another option: <a href="http:&#x2F;&#x2F;ebean-orm.github.io&#x2F;" rel="nofollow">http:&#x2F;&#x2F;ebean-orm.github.io&#x2F;</a> sound very nice and complete