Comments (5)
Thanks for the report and problem analysis. I'd very much appreciate if you could provide a PR with a test and fix.
from blaze-persistence.
I do believe that when using composite keys with Hibernate, none of the Id columns are allowed to be nullable. Or was this requirement dropped in later versions of Hibernate?
This is the exact reason why I started using a single @Id
field mapped to a ROW_NUMBER
functions in my CTE's, compared to IdClass on a logical key.
from blaze-persistence.
@beikov
Unfortunately, I don't know the internal logic exactly.
I just found the cause by just taking a brut force debug..
If there's a situation it's absolutely necessary for all IDs to be 'ISNULL',
It would be fine if it could be adjusted with an option value such as IMPLICIT_GROUP_BY_FROM_SELECT
.
@jwgmeligmeyling
Yeah, In a typical situation, all IDs will be not null, so this issue may not be a big problem in general.
However, it is not intuitive for users to have different results from the query that the user intended.
And in my case,
The project I'm applying JPA and Blaze persistence is an old project.
so there are tables that don't have an ID and It's a situation where I can't add an ID here arbitrarily.
The CTE proposal is interesting.
I'm still a beginner, so I've only used CTE in select sentences.
I don't know how to change the row of DB with cte yet, but I'll study it. Thank you.
from blaze-persistence.
I do believe that when using composite keys with Hibernate, none of the Id columns are allowed to be nullable. Or was this requirement dropped in later versions of Hibernate?
This is correct, though it is not "enforced" in any way. Materializing an entity with a null id column value will make the entity null as a whole.
Unfortunately, I don't know the internal logic exactly.
No worries, it will take some time though until I can look into this topic. Luckily, you have a workaround ;)
The CTE proposal is interesting.
The CTE approach is a good way to deal with this sort of situation. I guess @jwgmeligmeyling means you should add a @Id @Formula("row_number() over ()") Long rowNumber
to that entity?
from blaze-persistence.
The CTE approach is a good way to deal with this sort of situation. I guess @jwgmeligmeyling means you should add a @id @formula("row_number() over ()") Long rowNumber to that entity?
I primarily meant that it's not outrageous to assume all id columns must be non-null if one of the id columns is non-null. However, the other columns definitely do not have to be checked. I am surprised a bit surprised that those too are rendered in the select clause.
W.r.t. the CTE, never tried it with a Formula, I always just bind it directly, but this is the approach I typically use yes 😉
from blaze-persistence.
Related Issues (20)
- @Mapping(fetch = FetchStrategy.MULTISET) breaks boolean fields mapping. HOT 6
- Special case entity expression mapping with limit 1 to support MySQL and MariaDB
- Entity view loads more data than fetches should allow
- Embeddable in Keyset represented as constituent values since 1.6.10
- FR: Support more types for GraphQL
- Cannot create own CustomCollectionPersister HOT 7
- Limit optimization leads to problematic join condition for composite PKs
- AbstractMethodError when executing CTE query with 1.6.10 and Hibernate ORM 6.4.0.Final HOT 3
- Filtering the collection on Multiset FetchStrategy - array predicate syntax HOT 2
- Warning like "Could not register the function xxx" HOT 2
- Incompatibility with Spring 6.1(.1)
- Blaze Persistence 1.6.10 is no longer compatible with spring boot 3.2.0 HOT 1
- Error mapping Map<String, Integer> with JdbcTypeCode(JSON) HOT 6
- Repository should only allow sorting by entity and entity view attribute paths
- EntityView calls method Assert.notNull(Object object) that was removed in SpringFramework 6.1.x HOT 6
- saveFull throws exception on entity without mutable attributes HOT 2
- EntityViewAwareMappingJackson2HttpMessageConverter doesn't use Spring Boot's ObjectMapper
- Collection insert broken on Hibernate 6.4.2+
- Support for HATEOAS RepresentationModel link relation naming HOT 2
- conversion of LocalDate to entityview is failing HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blaze-persistence.