-
Notifications
You must be signed in to change notification settings - Fork 174
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
[master] Bug 539822: Fixes #260 #261
Conversation
…dSuperclasses Signed-off-by: Jan Vissers <[email protected]>
Issue tracker reference: |
1 similar comment
Issue tracker reference: |
I need a test to be added as part of this delivery. We try to not deliver changes without tests to demonstrate that there is an issue and that this change fixes it. You were saying that this issue was uncovered during some testing you were doing for migrating from ECL 2.6 -> 2.7, right? If you have a test that fails, please add that test to the |
note that this change may affect static weaving, see full change for the context |
Yeah the tests I conducted were done using our test harness. It tried to get the test going in eclipselink.jpa.test.jse but unfortunately I didn't get that far. I mean - I had a pretty hard time getting all the required pieces together to compile the whole thing in the first place. So I guess what I'm saying is that: sure I want to come up with a test, but I first could do with some more detailed explanation of how to set this thing up locally. On the comment about static weaving. I noticed that the weaver has changed to support weaving of mappedsuperclasses, which is great because before 2.7 we had to work around that. I don't see how a change in the MetaDataProject stage2 call affects static weaving. |
@lukasj Ok, there is some stuff here that I don't quite follow (like the fact that there are two maps), but I have a couple suggestions:
|
@jvissers Are you saying you are having a hard time getting EclipseLink to build&compile locally? Or are you having a hard time getting your test to compile and run in the JSE bucket? We can definitely help in either of those issues |
I seem to run into issues compiling each and every bit. With the risk of being 'noisy' - this is the first issue I encounter.
|
With respect to the jpa.test.jse - when I build that I get:
|
Okay that test issue might be related to the Java version I used by default.
Let me try with Java 9 (downloading now) and I'll get back to you. Java 11 has removed all ee parts - so that might be causing this. |
You need jdk 8. 9 may work too but run tests different way than 8. |
jdk 8 gave me Now up against:
I'm trying to piece together where you guys expect hamcrest-core and what the exact naming should be :-) |
@jvissers So, I have hamcrest-core downloaded locally. Then, I have a file called
It seems like I should make a wiki page on "How to build EclipseLink"... |
I think you should be able to replicate what travis does: https://github.com/eclipse-ee4j/eclipselink/blob/master/.travis.yml |
After positioning JAR files in various places (seems not all 3rd party libs are expected in the same place), installing mysql, creating the correct db, user and password for it - I'm now able to run the test suite. I will try and come up with a test case that illustrates the problem and solution. That is not trivial I think, because in this scenario - I have to work with a generated canonical metamodel class and then use that in a unit test. I'm not sure if I can do both from within the same unit test - without any trickery. Do you have a canonical metamodel test that was supposed to cover this (already)? |
@jvissers I see a test class in Also, the Hope this helps! |
I haven't been able to reproduce the changed behavior with respect to canonical metamodel in 2.7.3 with a vanilla based test. Now we do have customized Eclipselink quite a bit with respect to various things - so I'm not ruling out that that might have something to do with it. So I'm know also having another look into that. What I see in 2.6.5 and 2.7.3 when I run a test that uses our code is that in Metadataproject::processStage2: the Can you enlighten me what the rationale is/was for changing this in 2.7.3? |
Ok - so one of the things that we should be aware of here is that in our case we are not using a Now when I look into the code that builds the Eclipselink metamodel I do notice this bit that gets triggered:
Note that this adds a Effectively this means - that the |
I won't pretend to know much about spring's integration with JPA, but I think you need to use either XML mappings or annotations for your managed classes: JPA 2.1 Specification; 8.2.1:
I thought this worked for you on 2.6.5? How does |
Actually you can build a EntityManagerFactory programmatically (and we do) - by leveraging the JPA Specification's It is working in 2.6.5 - because in that version the processStage2 is looking at m_metamodelMappedSuperclasses which will be populated from the method See:
|
…dSuperclasses Signed-off-by: Jan Vissers <[email protected]>
well, yes, you can use PersistenceProvider.createContainerEntityManagerFactory()... but unless you are writing a container implementation, I'm not sure why you'd want to... and in any case, this doesn't mean you don't have to annotate your @MappedSuperclass classes or use an orm.xml metadata mapping file.
The only way I see
Perhaps I misunderstand (wouldnt be the first time lol), but number 1 is out cause the whole issue is that getMappedSuperclasses() (iow m_mappedSuperclasseAccessors) is empty, right? Then number 2 is out cause the class isn't annotated @MappedSuperclass? |
I've added a test that will succeed with the fix I've proposed but will fail with current master (2.7.3). Mind you that we have customized Eclipselink quite extensively to meet our application architecture's requirements and programming model (which takes inspiration from DDD). I'll let you process the test first and can add more background later if that is necessary. |
To answer your questions
We are not writing a container implementation, but using Spring's https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/orm/jpa/persistenceunit/PersistenceUnitPostProcessor.html. This along with other EL specific customizations enables us to create a rich domain model
From a JPA mapping perspective everything is okay. |
Sorry for my ignorance - but can you please explain whether the build (tests) run against the 'fixed' version of eclipselink or the one that is currently in the master branch? Asking because locally when I run the testsuite against the fixed eclipselink version all is green. |
properties.setProperty("javax.persistence.jdbc.driver", "com.mysql.jdbc.Driver"); | ||
properties.setProperty("javax.persistence.jdbc.url", "jdbc:mysql://localhost/user"); | ||
properties.setProperty("javax.persistence.jdbc.user", "user"); | ||
properties.setProperty("javax.persistence.jdbc.password", "password"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you want to read these from the system, see https://github.com/eclipse-ee4j/eclipselink/blob/master/jpa/eclipselink.jpa.test.jse/antbuild.xml#L110-L113
…_master Signed-off-by: Jan Vissers <[email protected]>
import javax.persistence.metamodel.SingularAttribute; | ||
import javax.persistence.metamodel.StaticMetamodel; | ||
|
||
@Generated(value = "Simulated Generation", date = "2018-10-09T11:24:45") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to avoid using try the javax.annotation.processing.Generated
annotation unless this is specifically needed for the test (I don't think it is).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reason for this is that I'm trying to mimic the actual scenario at our end. We have a customized annotation processor that generates JPA canonical metamodel classes. You are (probably) right that the javax.annotation.processing.Generated
here doesn't serve a (technical) purpose - it is more of a descriptive thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beware of the difference between javax.annotation.Generated
which is in your import, and javax.annotation.processing.Generated
you are referring to in your comment - they have different requirements on what exactly to put on the compiler's module-path for JDK 9+
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will take it out and push later today. Do you guys have any thoughts already on the actual test case and what it seems to be exposing?
…_master Signed-off-by: Jan Vissers <[email protected]>
Hi, I'm curious about the status of this now. Can you please let us know? |
Would it be possible to get an update for this issue? |
yup, this breaks fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=466271 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually no, works fine. So looks good to me. Remaining thing is failing IP validation - did you signed https://www.eclipse.org/legal/ECA.php already? We cannot accept anything without that
Just signed it. |
Hopefully last request(s) - can you force push this branch again to trigger ip-validation hook (or rebase against master...), please? |
…_master Signed-off-by: Jan Vissers <[email protected]>
Man this is painful! ip-validation still failing?! |
yes but there exists a way I can validate your account myself and it's OK now (apart from getting 'This user is missing from the ECA LDAP group' warning. Will see if the problem persists after 10minutes...) Now waiting for travis to finish test run. I don't expect bad surprise, so it is likely I'll merge this to master later today. Will you prepare backport to 2.7 branch then, please? Thanks! |
Signed-off-by: Jan Vissers <[email protected]>
Signed-off-by: Jan Vissers <[email protected]>
for #260
Signed-off-by: Jan Vissers [email protected]