jOOQ
Spring Data JPA
jOOQ | Spring Data JPA | |
---|---|---|
94 | 21 | |
5,905 | 2,903 | |
0.8% | 1.1% | |
9.8 | 9.1 | |
9 days ago | 6 days ago | |
Java | Java | |
GNU General Public License v3.0 or later | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
jOOQ
-
Serious flaws in SQL – Edgar F. Codd (1990)
> 2. ORMs do not hide SQL nastiness.
This is certainly true!
I mean: ORMs are now well known to "make the easy queries slightly more easy, while making intermediate queries really hard and complex queries impossible".
I think the are of ORMs is over. It simply did not deliver.
If a book on SQL is --say-- 100 pages, a book on Hibernate is 400 pages. So much to learn just to make the easy queries slightly easier to type? Just not worth it.
I prefer jooq any day over ORMs. And dont get me started over what tools like Hasuna have to offer.
There are also some languages (forgot the names) that are SQL-done-right. Select in the back, more type safe, more logic, more in the same steps as the query gets executed. These need to be adopted by PG and MySQL and we're good to go. (IMHO)
https://www.jooq.org/
https://hasura.io/
- ORMs are nice but they are the wrong abstraction
-
Do jOOQ DAOs support Kotlin Coroutines with R2DBC?
See: https://github.com/jOOQ/jOOQ/issues/5916
-
Ask HN: What's your experience with stored procedures-heavy systems?
I've worked on a few systems that were stored procedure heavy with Microsoft SQL server, not so much because I am a .NET guy, some of these came when I was working on super-random projects for a consulting company.
My take is that it is a lot like building a system that has an API over the database except that instead of writing in API in, say, Java and exposing it through an http API with, say, JAX-RS, you are writing the API in stored procedures and accessing it through JDBC or ODBC or the native API of the database.
It seems very possible to build some thin layer that uses metadata to make an http API over stored procedures.
I'd say that systems like that can work very well.
The basic challenge is maintaining version control over your scripts, my coworkers were rubyists on my first such project and built a system inspired by migrations in Ruby on Rails where we wrote up and down migration scripts for every database change. I carried that approach to other projects where the people had less discipline to begin with. There is a little awkwardness there that the "down" script that reverts a procedure to a previous version has a cut-and-pasted copy of the old version of the stored procedure, if I had to do it over again I'd make something where each version of a stored proc is in a numbered file and the "migrations" just say "upgrade ABC proc to version 7" or maybe you could make something that looks into the VCS and finds the old version.
From what I've read, PL/SQL from Oracle looks a lot better than the Transact-SQL language in SQL server but I've never done a major project with Oracle. Most places I've worked at recently use PostgreSQL and I think this would be a viable architecture for that.
One area where it seems to be a hassle is with the "query builder" pattern, for instance where I work now we have a very complex search form with a huge number of options that builds a SQL query. I think you can do that kind of thing with what they call "Dynamic SQL", see
https://www.postgresql.org/docs/15/plpgsql-statements.html#P...
but it seems preferable to do that kind of thing with a real programming language, particularly if you have tools like
https://www.jooq.org/
-
SQL based language for the SQL impaired?
I have a bachelor's in computer science, took a databases class in college (which I did poorly in), and worked as a backend developer for two years, but I always struggled with SQL. I can do the basic SELECT * FROM table WHERE column = 1 but when the SQL statement gets long with lots of joins I couldn't understand it and relied on another programmer for help. When I need to build a website myself I end up going with MongoDB because that allows me to write code instead of writing SQL. That being said, instead of doing all the data processing stuff in the backend, I'd like to try doing as much of it as I can in the database and learn some programmimg language that is SQL-esque (for my next personal project). I know Scala and am very comfortable doing functional programming stuff like List(1,2,3).filter(_.isEven()) to get the even numbers in a list or writing List(1,2,3).reduce(_+_) to apply the addition operation on all the numbers in a list. I know the Big Data framework Apache Spark is written in and works with Scala, but I really want to learn something that works with a traditional database that runs on one centralized server and not have to worry about the distributed computing MapReduce paradigm stuff (also installing the Big Data ecosystem on my personal computer is a pain). Like I want to try building something with a traditional database like Oracle, SQL Server, etc. Something I find really helpful is having IDE code error highlighting and auto-completion and the ability to run a static analysis code quality checker tool, which I can do with Scala code, but I don't know of a way to have those things with traditional SQL Strings sent from the backend to the database. I know of things like Java's JOOQ or C#'s LINQ, but I don't want to use one of those, I want to use something in the database that is database specific and pushes as much data processing as possible into the database. I heard of languages like PL/SQL, T-SQL, and PL/pgSQL to add procedural control to SQL, making it like a real programming language. On Wikipedia I found this list of PL/SQL editors but there are so many choices and I don't know which one to pick (it has to not cost me money and I would love one that has auto-completion with error highlighting and suggestions or maybe some sort of graphical query builder tool that gives me choices of what to put to compose my statement). I saw someone on Reddit say that more recently they added the ability to add database triggers in various programming languages. I also heard mentions online of this thing called "dbt" which adds software engineering tools like version control to SQL, but I don't know if that can help me get around my difficulty with SQL or if it is something I would want to use. Any advice would be appreciated.
-
Spring boot ili asp.net core?
Spring Boot, ili ako bi nesto vise lightweight u Javi Spark + jOOQ
-
Is ORM still an anti-pattern?
> I've been doing ORM on Java since Hibernate was new, and it has always sucked.
Have you ever looked at something like myBatis? In particular, the XML mappers: https://mybatis.org/mybatis-3/dynamic-sql.html
Looking back, I actually quite liked it - you had conditionals and ability to build queries dynamically (including snippets, doing loops etc.), while still writing mostly SQL with a bit of XML DSL around it, which didn't suck as much as one might imagine. The only problem was that there was still writing some boilerplate, which I wasn't the biggest fan of.
Hibernate always felt like walking across a bridge that might collapse at any moment (one eager fetch away from killing the performance, or having some obscure issue related to the entity mappings), however I liked tooling that let you point towards your database and get a local set of entities mapped automatically, even though codegen also used to have some issues occasionally (e.g. date types).
That said, there's also projects like jOOQ which had a more code centric approach, although I recall it being slightly awkward to use in practice: https://www.jooq.org/ (and the autocomplete killed the performance in some IDEs because of all the possible method signatures)
More recently, when working on a Java project, I opted for JDBI3, which felt reasonably close to what you're describing, at the expense of not being able to build dynamic queries as easily, as it was with myBatis: https://jdbi.org/
That said, with the multi-line string support we have in Java now, it was rather pleasant regardless: https://blog.kronis.dev/tutorials/2-4-pidgeot-a-system-for-m...
I don't think there's a silver bullet out there, everything from lightweight ORMs, to heavy ORMs like Hibernate, or even writing pure SQL has drawbacks. You just have to make the tradeoffs that will see you being successful in your particular project.
-
SQL-Parsing
Have a look at jooq - I know this has been used to rewrite SQL from one dialect to another, so it MUST be capable of collating code activity metrics. Look here. Otherwise, you might want to look into writing your own parser. ANTLR has a T-SQL dialect parser script here.
-
Magnum: A new Scala 3 Database Client
Feature requests go here: https://github.com/jOOQ/jOOQ/issues/new/choose. Looking forward!
-
Looking4Library: A GraphQL client that has query methods on the generated types
You may have the fortune of being familiar with the jOOQ library for Java/JVM apps, that can generate domain models based on your database schema, as well as methods on these classes to perform queries. In case you're not, here an example Postgres schema:
Spring Data JPA
-
How to Store Spring Boot Application Metrics in InfluxDB
Please note: The H2 database was chosen for simplicity. You can replace it with any other database technology and use the Spring Boot JPA to connect. The demo application will still work.
-
How to write a native query in spring boot jpa(postgres) which has "where in" check on composite columns?
What you are trying to do is not supported in JPA/JPQL or Spring Data (see here) Not even all databases support that syntax as far as I'm aware. You either need to concat the columns or add functionality to do this yourself, perhaps a Hibernate UserType will work.
-
What does @Transactional keep you from needing to call .save()?
There was also a discussion in the Spring Data JPA project repo surrounding the documentation as well: https://github.com/spring-projects/spring-data-jpa/issues/2055
- Multiple Datasources in an application
-
The best way to use Spring Data query methods
There is a small typo on the second issue, I have tried opening a PR myself to fix it https://github.com/spring-projects/spring-data-jpa/pull/2869. I hope i haven't messed up something lol.
-
Build a Simple CRUD App with Spring Boot and Vue.js
data-jpa: Spring Data JPA, makes it easy to create JPA-based repositories
-
Spring Boot GraphQL API example
This repository is an example application for the Spring Boot framework that employs the Netflix DGS framework to expose a GraphQL API and that interacts with a PostgreSQL DBMS via Spring Data JPA.
-
Spring Boot – Black Box Testing
I'm using Spring Data JPA as a persistence framework. Therefore, those classes are Hibernate entities.
-
QueryDSL and/or CriteriaAPI with multi-Joins on properties to Sort, Filter and Paging not working
By two different former developers, one from QueryDSL and the other RSQL JPA Spec (Criteria API), both mention that it is a Java issue mentioned here (since 2015...): https://github.com/spring-projects/spring-data-jpa/issues/1115
-
How do access sql through java in the real world?
If you go with hibernate note that there are a few different ways to use it. It can be used standalone and it can be used as a JPA implementation. If you use Spring and use hibernate as a JPA implementation then a popular Spring data layer abstraction is Spring Data which has JPA support with its Spring Data JPA library (https://spring.io/projects/spring-data-jpa)
What are some alternatives?
Querydsl - Unified Queries for Java
MyBatis - MyBatis SQL mapper framework for Java
JDBI - The Jdbi library provides convenient, idiomatic access to relational databases in Java and other JVM technologies such as Kotlin, Clojure or Scala.
HikariCP - 光 HikariCP・A solid, high-performance, JDBC connection pool at last.
spring-data-r2dbc - Provide support to increase developer productivity in Java when using Reactive Relational Database Connectivity. Uses familiar Spring concepts such as a DatabaseClient for core API usage and lightweight repository style data access.
Speedment - Speedment is a Stream ORM Java Toolkit and Runtime
Hibernate - Hibernate's core Object/Relational Mapping functionality
sql2o - sql2o is a small library, which makes it easy to convert the result of your sql-statements into objects. No resultset hacking required. Kind of like an orm, but without the sql-generation capabilities. Supports named parameters.
Apache Cayenne - Mirror of Apache Cayenne
blaze-persistence - Rich Criteria API for JPA providers