-
Notifications
You must be signed in to change notification settings - Fork 87
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
Entity view inheritance and FetchType.SUBSELECT with @EmbeddedId throws UnsuportedOperationException #1945
Comments
Hi, the error comes from Hibernate ORM. Can you please share the full stack trace and also the HQL query that is generated which fails? |
I can provide a similar version that strips out any information pertinent to the project, but I can at least provide the general idea as to what is happening. This is the full stack trace from where getResultList() is called in our code.
As for the HQL query, this is the rough outline of what's going on in the query based on the minimal example provided above:
|
Ah, I think I see where this is going. Do you use the |
@beikov I just tried that but I got the same result in the same location. It seems like the issue is coming from the generated HQL and since it sees the field being queries as the ID it ends up failing still. It looks as if the HQL code has not changed at all from that change and is still using the composite field. |
Please share the entity views you're using. |
Gladly: @EntityView(BaseEntity.class)
@EntityViewInheritance
public interface BaseEntityView {
@IdMapping
CompositeIdView getCompositeId();
int getDataField();
} Here is the ID @EntityView(CompositeId.class)
public interface CompositeIdView {
UUID getId();
int getRevisionId();
} This is the one for the derived view: @EntityView(DerivedEntity.class)
public interface DerivedEntityView extends BaseEntityView {
@Mapping(fetch = FetchStrategy.SUBSELECT)
Set<OtherEntityView> getOtherEntities();
} And this is the one for the related entity: @EntityView(OtherEntity.class)
public interface OtherEntityView {
@IdMapping
UUID getId();
int getMyDataField();
} When run this is the query that gets generated:
|
Thanks, I can imagine where this goes wrong. I hope though, that you can use a different fetch type in the meantime. |
Description
I'm currently trying to translate a fairly deep inheritance hierarchy of entities to use Blaze persistence and I'm running into some issues with the query of the view when using Hibernate.
My structure looks something like this
I then try to create views with a similar structure and the issue I seem to be running into is that the collection is mapped using
FetchType.SUBSELECT
which then causes issues when the query is generated. It seems to stem from the usage of theTREAT
keyword which seems to expand to create a case statement, which returns the compositeId of the entity.When it tries to execute the query, it ends up throwing an
UnsupportedOperationException
with the message ofResolution of embedded-valued SqmExpressible nodes not yet implemented
causing the query to fail to run. It seems that it is unable to resolve the mapping inside of that case statement because it is both an Embeddable and the ID of the source entity.Expected behavior
The query goes off and the entities are subselected
Actual behavior
An exception is thrown and the query method fails
Steps to reproduce
FetchType.SUBSELECT
Environment
Version: 1.6.12
JPA-Provider: Hibernate
DBMS: Postgres/HSQL
Application Server: Spring Boot
The text was updated successfully, but these errors were encountered: