Skip to content
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

@Entity objects are not enhanced by the load time weaver in certain situations [SPR-8523] #13167

Closed
spring-issuemaster opened this issue Jul 11, 2011 · 10 comments
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Jul 11, 2011

Matt Young opened SPR-8523 and commented

I've boiled down a confusing situation into a reproducible odd behavior in the attached example application. In an OpenJPA-supported application when there are two classes (an abstract parent and a concrete child) that are both marked with @Entity, the classes are not enhanced when an autowired @Repository DAO is called from a unit test. The DAO contains an inserted @PersistenceContext to get access to the EntityManager.

If the call to the dao is commented out, the classes are enhanced as they should be.

Using spring-instrument-3.1.M2.jar on a -javaagent line.

Notes:

  • Run a mvn package with the dao call commented out and not commented out in the test class

  • Observe the difference in openjpa reporting the enhancement of classes vs. not enhancing them

  • It doesn't matter if you use a persistence.xml file or the new packagesToScan option in LocalContainerEntityManagerFactoryBean


Affects: 3.1 M2

Attachments:

Issue Links:

  • #13148 @Configurable does not work if method with configured classes as parameter exists
  • #14490 LoadTimeWeaving not working properly in Websphere

1 votes, 3 watchers

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 11, 2011

Matt Young commented

Tested against 3.0.5 as well, can confirm the problem exists there also.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 11, 2011

Chris Beams commented

Hi Matt,

Thanks for attaching the project. Would you be willing to submit this as a pull request following the instructions here?

https://github.com/SpringSource/spring-framework-issues#readme

We'll look into this either way of course, but this helps streamline things.

Thanks!

Chris

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 11, 2011

Matt Young commented

Thanks for your help, Chris. I've added the sample project to github (correctly, I hope) and confirmed that the same result comes out. Please let me know if anything is wrong with the commit.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 11, 2011

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 11, 2011

Chris Beams commented

Confirmed the issue locally. Scheduling for RC1

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 20, 2011

Chris Beams commented

This issue seems very similar to #13148, but it is not yet clear that it is a duplicate per se.

See the reproduction projects for both issues to observe the similarities (README contains instructions)

https://github.com/SpringSource/spring-framework-issues/tree/master/SPR-8502
https://github.com/SpringSource/spring-framework-issues/tree/master/SPR-8523

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 20, 2011

Chris Beams commented

Also note that the reproduction project linked above has now been heavily simplified in an attempt to isolate the issue. It is quite clear what will cause the failure to enhance, but not yet clear why.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 20, 2011

Chris Beams commented

Matt, you may want to consider compile-time weaving as a workaround in the meantime. I've documented how to do this as well in the reproduction project. See the README: https://github.com/SpringSource/spring-framework-issues/tree/master/SPR-8523

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 20, 2011

Matt Young commented

Thanks Chris for the helpful configuration example.... we'll try compile-time weaving until this gets sorted out.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Nov 4, 2012

Juergen Hoeller commented

This sounds like it is basically the same issue as #14490, covered by the same fix. Please give the upcoming 3.2 RC1 a try and let us know whether it solves the problem for you...

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.