Ebean + JPA 2.x + Jetty: Duplicate classes warnings #2790
jnehlmeier
started this conversation in
Backlog
Replies: 3 comments 5 replies
-
Refering to https://github.com/ebean-orm/javax-persistence-api ebean's JPA annotations are a clone/fork of the original ones. Except the two mentioned extensions. So ebean should be happy, with the original ones. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Exactly as Roland has said, just use the standard persistence API (with
those 2 noted extensions of @repeatable and @Embedded prefix).
*> and might require other dependencies to be Jakarta ready as well*
I want to add that *I am very concerned* that the Java SE community in
general is heading into serious difficulty in upgrading to Jakarta JAXB as
it is effectively incompatible with Javax JAXB and is not guaranteed to
co-exist in the same classpath (without hacking/shading/cloning the JAXB
API). Refer jakartaee/jaxb-api#263 and
#2722
I'm 99% sure we have to revert back to javax.xml.bind (from Jakarta) due to
the conflict there and at this point there is no known nice way to upgrade
to Jakarta JAXB without significant chance for an Java SE application to
have conflicting dependencies with Javax JAXB. Ebean can kick this can down
the road at the moment but at some point we need to deal with this issue of
being effectively stuck on javax.xml.bind (which I'd suggest is an
un-maintained dependency, mature sure but un-maintained going forward).
So for example, if an app upgrades to Jakarta persistence and *has a
dependency on Jakarta JAXB* ... then ebean-test / ebean-ddl-generator (in
the test classpath) might not be able to co-exist due to the conflicting
dependency on javax.xml.bind ... and Ebean will be in a catch 22 situation
in that it can't satisfy both the Javax JAXB apps and the Jakarta JAXB apps
at the same time. This could be painful.
I'd love more community brain power going into this issue to clarify our
path forward.
Cheers, Rob.
…On Tue, 16 Aug 2022 at 05:53, Roland Praml ***@***.***> wrote:
Refering to https://github.com/ebean-orm/javax-persistence-api ebean's
JPA annotations are a clone/fork of the original ones. Except the two
mentioned extensions. So ebean should be happy, with the original ones.
Try to exclude one of them in your pom file.
—
Reply to this email directly, view it on GitHub
<#2790 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABTATIEMW2PXKLAWP5PZZLVZJ72NANCNFSM56SPUPEA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
5 replies
-
ebean still supports the original/standard way for the cases ebean persistence api has made an extension for
Yes it does. Yes you can use @AttributeOverrides
Ebean still recognizes the container annotations like @AttributeOverrides of standard persistence API which are needed because corresponding annotations are not marked @repeatable?
Yes.
If we look at `@Repeatable` and see how it works ... we see that for example `@Repeatable` on `@AttributeOverride` is just syntax sugar for putting the entries into a `@AttributeOverrides`. There is no way to remove the `@AttributeOverrides` or for Ebean to not read it etc. That is, the `@Repeatable` is effectively just syntax sugar and this is the case for all those `@Repeatable` containers".
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to reduce the warnings of an app which uses JPA (EclipseLink 2.7.9), Ebean (12.10.0) and Jetty (10.0.11).
During deployment Jetty scans all dependencies for annotated classes (because of servlet-api) and while doing so it emits a
WARN
if the same class has been found in multiple jar files. IMHO it is a nice warning because you usually don't want that as you can not guarantee that both classes are actually the same code.Here an example
Library
jakarta.persistence-2.2.3.jar
(still usesjavax.persistence
package) is pulled in by EclipseLink andpersistence-api-2.2.4.jar
by Ebean.I can not exclude the Jakarta Persistence API because Ebean's version has removed some stuff from the annotations so that JPA won't work anymore. I can not exclude Ebean's version because then I am missing some Ebean features and I am not sure if they can be replicated using standard JPA annotations (that is I have no idea if Ebean adjustments are just syntactic sugar).
This affects everyone migrating away from JPA to Ebean and using Jetty. If the app is large (it is in my case) then migration can take very long or might never be fully done (then only new code uses Ebean). I can also see people developing desktop applications who want to use JPMS having trouble to do so given that two dependencies define the same module.
Currently we get warnings for
N files of persistence api * M deployed apps using JPA & Ebean * amount of app servers
which is quite some logging noise during deployment. I don't want to silence the logger and set it toERROR
only because then I am missing other warnings as well.Personally I would love to see Ebean to move its modified, JPA originated annotations to
io.ebean.annotations
. Given that Ebean entities and JPA entities both need to be weaved/enhanced there is no way to use the same entity class with Ebean and JPA at the same time. So for incremental migration of code you always have to duplicate the class to make weaving work until the JPA entity isn't used anymore at all. Because of that having to change packages of Ebean JPA annotations in ebean entities to an ebean specific package seems not a big deal. If someone wants to do an all-or-nothing switch they could use search/replace to update imports and then fix everything that is broken. Overall I think it wasn't a great idea to duplicate, modify and re-release a specification using the same package.The above issue will go away naturally when updating EclipseLink to v3 which uses the Jakarta namespace. But this can also involve additional work and might require other dependencies to be Jakarta ready as well.
Beta Was this translation helpful? Give feedback.
All reactions