-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Integration with JDBC #753
Comments
Jakarta Data added the Jakarta Data Query Language (JDQL) to be used as a standard query language regardless of the underlying database/driver technology. If a vendor wants to also offer SQL (or JPQL or some other vendor-specific query language), they are free to do that, but it is outside of the Jakarta Data spec which standardizes on JDQL. Regarding the implementation of a Jakarta Data provider on JDBC vs Jakarta Persistence (or any other vendor-specific technology) for relational databases, it is intended that for the most part this will be an implementation detail of the Jakarta Data provider. The part that gets externalized to the user is the entity model. A provider that is built on JDBC can offer the Jakarta Persistence entity model (or some subset of it) and/or might choose to provide a vendor-specific entity model, such as what you list in your example with Java record being used as an entity. In version 1.0, we did not require the use of Java records as entities for relational database access or fully define how it would work and if additional annotations would be needed as in your example. I believe the entity model of Jakarta NoSQL for non-relational does allow records to be entities and the Jakarta NoSQL entity annotations are written to allow for it, unlike those of Jakarta Persistence. None of what is written in this issue would be properly categorized as a bug. It sounds more like a feature request. I suggest that we change its categorization from |
Not sure I understand how something can be "raw JDBC API" and "a simple ORM" at the same time. Either it generates SQL or it doesn't. If it does generate SQL, then I don't see how it's any different at all to a Jakarta Data implementation backed by Hibernate
This list of features already sounds like it competes with Jakarta Persistence, even right off the starting blocks. Even before you start to creep the scope. So look, I'm absolutely 100% implacably against the idea of growing a "mini-ORM" inside Jakarta Data. History shows that such things grow and grow until they turn into real ORMs. That's not the purpose of this spec. Instead, we should stick to the plan of:
We already know how to do that, and it's not an open-ended invitation to a quagmire. |
Currently Hibernate and EclipseLink have their own implementation for JPA, but no project for integrating Jdbc, sometime we would like use a light-weight ORM solution like what is provided in Spring Data Jdbc. |
If you want a Spring JDBC-based implementation of Jakarta Data, you should be talking to the Spring folks, and asking them to implement the spec. There's absolutely zero barriers in the way of Spring doing that. And there's nothing missing from Jakarta Data itself.
I mean, this is simply false. Both Hibernate and EclipseLink are completely based around JDBC, and both back an implementation of Jakarta Data. Perhaps what you mean is that you would like to be able to hand-write SQL. But both Hibernate and EclipseLink already let you do that. Hibernate Data Repositories even extends Jakarta Data with the
This is simply not a well-defined thing. "Light weight" isn't a term that actually means anything in computing. Software doesn't have mass, so it can't weigh anything. I guess what you really mean is that you want an ORM that's not based around stateful persistence contexts. One of those already exists today, and there's already an implementation of Jakarta Data based on it: Hibernate Data Repositories. Try it. |
Yes, also satisfy the project that follows data driven design firstly. Using reverse engineering, generating Entities from SQL/DB schema by Hibernate, the codes looks ugly.
I am trying to use it in my Quarkus example projects. |
@hantsy After thinking some more about your example with Java records as entities, if you want that the right place to ask for it is to open an issue for an enhancement request from the Jakarta Persistence spec. Jakarta Data allows you to use the Jakarta Persistence entity model. If a future version of Jakarta Persistence were to add records to their entity model, I would expect the corresponding version of Jakarta Data to follow along with it. |
It's already been requested; we thought hard about it; we're not doing it. Records just aren't an appropriate way to represent entities in Java. Among other problems:
Records are a good way to represent flat projections, as we've been discussing in #539. But you can't use them to represent the sort of interconnected object graphs that Java Persistence is designed to work with. [Seriously, a bunch of immutable record objects connected by instances of |
I think this issue should be closed. I think it would be a terrible idea for Jakarta Data to start growing a min-ORM that competes with JPA. Note that in JPA 4 we're adding a stateless |
Thus, I will close this one. |
Specification Version
1.0.0-RC1
Bug report
I am not sure if the v1.0 includes an integration with the raw JDBC API.
@Query
(accept sql instead).Additional information
The text was updated successfully, but these errors were encountered: