Comments (4)
If you look closely not only is the inlined query overfetching
Overfetching in a from-clause subquery should not be a problem. Optimizers usually prune away unnecessary select items. There is unfortunately no way to get rid of the overfetching here, because the subquery must produce something that is compatible with an entity fetch.
but also binding the id of c1_0 to ft1_0.id which is a @OnetoOne relation on the entity!
I'm not sure I understand that. Could you be more specific? Also, I don't know the entity model you're using, so it's hard to understand what this "toy" table is representing.
from blaze-persistence.
The relation looks like this:
For Cat
@OneToOne(mappedBy = "cat")
private Toy favouriteToy;
For Toy
@Id
@GeneratedValue
private Long id;
@OneToOne
private Cat cat;
Now from the lateral join the binding for the Cat is this line with id
being the 4th param
c1_0(a_id, age, father_id, id, mother_id, name, owner_id)
And the fetched fields are those with the 4th field being ft1_0.id
SELECT c2_0.a_id, c2_0.age, c2_0.father_id, ft1_0.id, c2_0.mother_id, c2_0.name, c2_0.owner_id
Which effectively sets the id of c1_0 to the id of ft1_0 and therefore results in a CatView with a wrong id.
Meaning for example if your Cat Entity has id 1 and the Toy Entity has id 2 the query results in CatView with id 2.
from blaze-persistence.
Ok, this looks like a bug to me. Could you please try to create a reproducer for this? You can use a quickstart project for this purpose and attach it here.
from blaze-persistence.
I hope this is enough to work with.
I replaced the DbmsDialect of H2 with the PostgreSQL one in the Configuration to make sure the buggy query gets created.
This will throw an exception in the end. If this is not enough, a real Postgres should be used.
blaze-persistence-reproducer-1876
from blaze-persistence.
Related Issues (20)
- Support determining if PagedList has next page
- Allow specifying defaults first/last for GraphQL pagination queries
- Don't create input types for non-updatable/creatable entity views
- The generated SQL statement order by is incorrect HOT 1
- Re-using ObjectMapper from spring-boot for EntityViewAwareMappingJackson2HttpMessageConverter leads to issues HOT 3
- Allow multiple named subqueries for @MappingSubquery
- Optimization of logging in the AnnotationUtils Utility Class HOT 1
- FR: Support field-EntityView deserializatin for DTOs which are non-entity views
- Expose EntityViewAwareMappingJackson2HttpMessageConverter as a Bean to support re-usage for http-clients
- Property naming strategy for Jackson integration does not work HOT 3
- How to ignore a certain `Getter` in EntityView? HOT 1
- Query DSL with blaze-persistence is generating an extra joining HOT 6
- SubviewAttributeFlusher always cascade deletes
- Exception thrown when using LocalDate in an EntityView being fetched using the Multiset strategy
- Startup error with Spring Boot 3.3.0 and Blaze Persistence Repositories HOT 5
- "No viable alternative at input" error near 'entity_function' HOT 1
- Exception thrown when using subQuery + pagedList HOT 1
- Fetching of MULTISET attribute not working HOT 3
- Question. Can i use fields mapped as @Convert in multiset mode? HOT 1
- Cannot invoke "EntityType.getName()" because the return value of "JoinNode.getTreatType()" is null HOT 1
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.