NathanQingyangXu / jpa-mongodb-mapping

OOP and MongoDB mapping based on Hibernate and MongoDB Java Driver
GNU General Public License v3.0
0 stars 1 forks source link

make native query parameterization mechanism in line with dialect customization #37

Open NathanQingyangXu opened 3 weeks ago

NathanQingyangXu commented 3 weeks ago

since 6.2, an \@Incubating config was provided: hibernate.dialect.native_param_markers, but currently native query parsing still ends up with default ? as marker.

See https://github.com/hibernate/hibernate-orm/blob/main/hibernate-core/src/main/java/org/hibernate/query/sql/internal/ParameterRecognizerImpl.java for details.

Might be worthwhile a bugfixing to have it solved from Hibernate upstream; otherwise ugly local code hacking has to be relied upon (or more fancy possibility like Spring's AOP usage).

jyemin commented 3 weeks ago

Can you open a bug report about it? Maybe we can get it fixed in a 6.6 patch release.

NathanQingyangXu commented 3 weeks ago

It seems more complex than I originally thought. The strategy method has input parameter of type, but such info might not be available during native query parsing phase. During native query parameter populating phase, the type provided by value might be different than real type. I will consider this key issue more and discusss with Steve if needed. Not sure whether it is a design loophole or not (in the sense that the strategy will conflict with native query). Another concern is this new feature was marked as @Incubating, so not stable and our customization might be broken in next Hibernate upgrade. We might well keep that in mind. That being said, I do agree its usage in our project is a great idea.

On Sun, Aug 18, 2024, 7:09 p.m. Jeff Yemin @.***> wrote:

Can you open a bug report about it? Maybe we can get it fixed in a 6.6 patch release.

— Reply to this email directly, view it on GitHub https://github.com/NathanQingyangXu/jpa-mongodb-mapping/issues/37#issuecomment-2295428181, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6UYAWX2GZJOOIIQIQ24Z3ZSEST7AVCNFSM6AAAAABMVQPWSCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJVGQZDQMJYGE . You are receiving this because you authored the thread.Message ID: @.***>