That was great! I didn't know that spring could fetch entity properties in a DTO projection based on parameter names on the constructor! I always coded the constructor expression in the query...
Good day, @Thorben. I've been subscribed to your mailing list for a while and I've enjoyed your awesome content, especially with regards to Java Hibernate framework. My first time being on the channel. I wish you the best. I have committed to learning Spring framework + Hibernate framework by the end of this year or early next year. I have good practical knowledge of Java and OOP design principles.
Hey Thorben, Thanks for your great video. I see many people are using JDBC template for fetching DTO because it is highly customizable. But I think JDBC template is easily messed up, and error-prone, and it is not readable when the query takes dynamic WHERE conditions. Could you let us know there is any benefit to use JDBC template against Spring Projection when it comes to outbound DTO projection? Thanks!
I'm using Interface projtion and one of the get method in interface of type OffsetDateaTime but it's giving error.. could you please shade some light on the issu
Good day @Thorben, i have a use case which i'm trying to glue graphql with jpa. The problem is queries from graphql are dynamic. They are then converted to JPA CriteriaQuery to generate projections and predicates to construct SQL. I need to map my resultset back to the JPA entity. I have tried AliasToBeanResultTransformer to auto-map my projections. I'm using hibernate beneath it. Unfortunately, I realised JPA CriteriaQuery converted to HQL is not producing aliases in the projection although I have configured aliases. This result in AliasToBeanResultTransformer not able to map the resultset back to the entity attributes. Do you have any reccomendation?
How did you resolve this ? It is expecting a constructor for every combination of attributes in select and groupby clauses, I have configured aliases too but nothing seems to work
When you need a class based DTO projection you can't use nested fields. There is no support for this out of the box. If you want to get unmanaged entity with nested fields like Collection you'll have to resort to using tools like Mapstruct. That was a real downside for me. Manageable but a downside non the less.
You are the best, thanks for the information.
That was great! I didn't know that spring could fetch entity properties in a DTO projection based on parameter names on the constructor! I always coded the constructor expression in the query...
Good day, @Thorben. I've been subscribed to your mailing list for a while and I've enjoyed your awesome content, especially with regards to Java Hibernate framework.
My first time being on the channel. I wish you the best.
I have committed to learning Spring framework + Hibernate framework by the end of this year or early next year. I have good practical knowledge of Java and
OOP design principles.
Great tutorial, Please tell me how to fetch child data by a certain field from parent using spring projections. Thanks. Subscribed!
Great tutorial, thanks.
Hey Thorben,
Thanks for your great video.
I see many people are using JDBC template for fetching DTO because it is highly customizable.
But I think JDBC template is easily messed up, and error-prone, and it is not readable when the query takes dynamic WHERE conditions.
Could you let us know there is any benefit to use JDBC template against Spring Projection when it comes to outbound DTO projection?
Thanks!
Good video .. can u please do a lesson based on using Criteria Builder with associations (joins)
Performance wise which is better ? protection interface or DTO class ?
It doesn't make a difference as long as your projection interface doesn't model any relationship and doesn't use Spring's expression language
Great tutorial, How can we populate interface projection from Json file for testing
Great content, but how to use class dto for store procedure?
How to pass associate object in constructor in JPQL query. Just u have shown only passing properties not obj.
I'm using Interface projtion and one of the get method in interface of type OffsetDateaTime but it's giving error.. could you please shade some light on the issu
Please tell me how to fetch child data by a certain field from parent using spring projections.
Good day @Thorben, i have a use case which i'm trying to glue graphql with jpa. The problem is queries from graphql are dynamic. They are then converted to JPA CriteriaQuery to generate projections and predicates to construct SQL. I need to map my resultset back to the JPA entity. I have tried AliasToBeanResultTransformer to auto-map my projections. I'm using hibernate beneath it. Unfortunately, I realised JPA CriteriaQuery converted to HQL is not producing aliases in the projection although I have configured aliases. This result in AliasToBeanResultTransformer not able to map the resultset back to the entity attributes. Do you have any reccomendation?
How did you resolve this ? It is expecting a constructor for every combination of attributes in select and groupby clauses, I have configured aliases too but nothing seems to work
@@jayashreeerrabelli4258 yes, in the end, i did a walkaround and rewrite the jpql to create the alias myself
When you need a class based DTO projection you can't use nested fields. There is no support for this out of the box.
If you want to get unmanaged entity with nested fields like Collection you'll have to resort to using tools like Mapstruct.
That was a real downside for me. Manageable but a downside non the less.
Is projection can me mixed with specification?