简体   繁体   English

不严重依赖 Panache 的 Quarkus?

[英]Quarkus without heavy dependencies on Panache?

I like the idea of using JAX-RS in Quarkus as it will make the code not dependent on framework implementation.我喜欢在 Quarkus 中使用 JAX-RS 的想法,因为它将使代码不依赖于框架实现。 However when it comes to DB we're proposed to use "Panache" and extend the DB entities from PanacheEntity .但是,当涉及到数据库时,我们建议使用“Panache”并从PanacheEntity扩展数据库实体。 I guess it's very handy and good for AOT work (what is basically Quarkus is trying to do) and simplifies Quarkus work a lot, but it introduces heavy dependency on particular implementation and we can't use pure JPA modules because of that.我想这对 AOT 工作(基本上是 Quarkus 试图做的)非常方便和有益,并且大大简化了 Quarkus 的工作,但它引入了对特定实现的严重依赖,因此我们不能使用纯 JPA 模块。

This conflicts with "clean architecture" and make testing of such DB module complicated [if possible at all].这与“干净的架构”相冲突,并使此类 DB 模块的测试变得复杂 [如果可能的话]。 Let's say i'd like to be able to use the same DB module (using pure JPA annotations only) for both Spring and Quarkus-based app modules.假设我希望能够对 Spring 和基于 Quarkus 的应用程序模块使用相同的数据库模块(仅使用纯 JPA 注释)。 It forces me to duplicate the code or cheat in terms of design purity.它迫使我复制代码或在设计纯度方面作弊。

Is there any possibility to use pure JPA annotations for persistence and probably pay the price with plugins (that modify the code during compilations) or by using of ORM framework(s) that do not do runtime bytecode modification/use reflection?是否有可能使用纯 JPA 注释来实现持久性并可能使用插件(在编译期间修改代码)或使用不进行运行时字节码修改/使用反射的 ORM 框架来付出代价? Any examples?有什么例子吗?

PS.附言。 Congrats on 1.0 release, Good job.祝贺1.0发布,干得好。 Quarkus team.夸克团队。

Panache is purely optional and you can stick with plain JPA, as documented in https://quarkus.io/guides/hibernate-orm . Panache 完全是可选的,您可以坚持使用普通的 JPA,如https://quarkus.io/guides/hibernate-orm中所述。

If you could explain why you think you have to use Panache, I believe that would be interesting for the Quarkus team.如果你能解释为什么你认为你必须使用 Panache,我相信这对 Quarkus 团队来说会很有趣。

First of all, I totally agree.首先,我完全同意。 I feel it's going against the idea of spec first.我觉得这违背了规范优先的想法。

But I have the feeling that the idea is to extend Quarkus reactive capabilities which they already admitted is currently only available for REST resources.但我觉得这个想法是扩展他们已经承认的 Quarkus 反应能力,目前仅适用于 REST 资源。

If you stick on JPA I guess you won't have access to Mutuniy features, unlike if you use Panache and Hibernate Reactive.如果您坚持使用 JPA,我猜您将无法访问 Mutuniy 功能,这与您使用 Panache 和 Hibernate Reactive 不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM