Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 341398 - JPA: persistence.xml should be placed in Projet Root/META-INF
Summary: JPA: persistence.xml should be placed in Projet Root/META-INF
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Libra (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Stefan Dimov CLA
QA Contact: Kaloyan Raev CLA
URL: https://jtrack/browse/NGPBUG-106
Whiteboard:
Keywords:
Depends on: 341397
Blocks:
  Show dependency tree
 
Reported: 2011-03-30 13:25 EDT by Shaun Smith CLA
Modified: 2022-02-24 11:24 EST (History)
2 users (show)

See Also:
kaloyan: iplog+
kaloyan: review+


Attachments
fix (8.65 KB, text/plain)
2011-05-05 08:53 EDT, Stefan Dimov CLA
no flags Details
reworked patch - changed taking the source folder and computing the destination folder way (10.46 KB, patch)
2011-05-31 04:59 EDT, Dimitar Giormov CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Shaun Smith CLA 2011-03-30 13:25:22 EDT
When creating a new bundle project with JPA enabled persistence.xml is placed in src/META-INF however it should be placed in the Project Root/META-INF alongside the MANIFEST.MF.

Since the Helios release Dali has been placing persistence.xml in /META-INF when converting a plug-in project to a Faceted project with a JPA facet.
Comment 1 Stefan Dimov CLA 2011-05-05 08:53:54 EDT
Created attachment 194824 [details]
fix

With this patch the META-INF folder changes its place from 'src' folder to root. There is a side effect from this - sometimes validation gets confused and shows error in the problems view but manual project clean or validate removes it. I guess it comes from validation synchronization

I guess the above should result in a bug after this patch is committed.
Comment 2 Dimitar Giormov CLA 2011-05-31 04:59:42 EDT
Created attachment 196967 [details]
reworked patch - changed taking the source folder and computing the destination folder way
Comment 3 Kaloyan Raev CLA 2011-07-01 04:50:40 EDT
Dimitar, thanks for the patch. There is a known issue with creating patches with EGit, which prevents applying the patch. 

Could follow these instructions and push your patch to a GitHub repo?
http://wiki.eclipse.org/Development_Resources/Handling_Git_Contributions

Thanks!
Comment 5 Kaloyan Raev CLA 2011-07-08 02:40:15 EDT
Unfortunately, this patch does not work properly. Simply moving the persistence.xml from /src/META-INF to /META-INF breaks the JPA model and Dali tools (like the JPA Diagram Editor) cannot work properly.
Comment 6 Kaloyan Raev CLA 2011-07-08 10:13:04 EDT
After spending some time, it turned out that the patch works properly only when creating new JPA project without Utility facet. I succeeded to modify it to cover this case too. 

The only scenario left is when converting existing JPA project to OSGi Bundle - I am looking to a way to refresh the JPA model without having any error markers on the persistence.xml file...
Comment 7 Kaloyan Raev CLA 2011-07-13 12:42:02 EDT
Refreshing the JPA model seems to be a tough thing. I decided to commit the current work in Git and open a separate bug for converting existing JPA project to a Persistent Bundle.

The following change is committed in the indigo branch and merged to master:
http://git.eclipse.org/c/libra/org.eclipse.libra.git/commit/?id=338c8f6178c820789dd34bebcb3324db32ef1bcb
Comment 8 Kaloyan Raev CLA 2011-07-14 11:42:09 EDT
I opened bug 352121 for converting existing JPA project to a Persistent Bundle.
Comment 9 Alexander Silgidjian CLA 2011-07-14 12:28:30 EDT
Tests are available here: https://github.com/asilgidjian/libra/commit/6ef5cbe3fca0df16c1106f3f3aa33678b587fec2

Kind Regards,
Alex
Comment 10 Kaloyan Raev CLA 2011-07-15 04:11:35 EDT
Thanks for the tests, Alex. They are now pushed to the indigo branch.
Comment 11 Kaloyan Raev CLA 2011-07-15 06:03:46 EDT
Verified with the latest build from http://download.eclipse.org/libra/maintenance/snapshot/
Comment 12 Kaloyan Raev CLA 2011-07-15 06:03:56 EDT
Closing