Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 319726 - Support persistence.xml in locations other than Java source folder
Summary: Support persistence.xml in locations other than Java source folder
Status: RESOLVED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: General (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.0 M1   Edit
Assignee: Paul Fullbright CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy, plan
Depends on: 317900
Blocks:
  Show dependency tree
 
Reported: 2010-07-13 10:19 EDT by Paul Fullbright CLA
Modified: 2010-10-29 16:04 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Fullbright CLA 2010-07-13 10:19:55 EDT
+++ This bug was initially created as a clone of Bug #309030 +++
+++ This is to track the issue for version 3.0, whereas the  +++
+++ original has a different fix for 2.3 maintenance         +++

Dali currently forces (defaults) the persistence.xml to be contained under META-INF in the Java source folder of a project. This makes sense for Java SE projects since persistence.xml is found at runtime using the classloader. However, when JPA is used within OSGi EEG bundles persistence.xml is normally found using methods like Bundle.getEntry() - i.e. a relative path from the root of the bundle, not on the bundle classpath.

The result is that we restrict the development project structure of OSGi bundles. If you want to be able to run directly out of the workspace, developers:
 - cannot separate Java source and resources like persistence.xml to suit their preferred project layout.
 - cannot easily use Bundle-Classpath to put Java output in a non-root folder within the bundle. (e.g. putting .classes under a /bin folder within the exported bundle)
 - cannot convert all existing WTP flexible projects (e.g. JEE web modules with a WebContent folder structure) to use JPA without moving restructuring the project.

Both PDE (IBundleProjectDescription.setBundleRoot()) and WTP (flexible project structure) already allow you to structure projects so that the Java source and 'resources' are different folders.

Please allow some flexibility in where persistence.xml is located to enable these OSGi development scenarios. My preference would be something simple, e.g. when JPA is used on PDE projects use IBundleProjectDescription.getBundleRoot() as the root instead of the Java source path. Alternately, even a JPA 'root' setting with no UI would be enough to allow adopters to create new projects or convert existing projects in this way.
Comment 1 Paul Fullbright CLA 2010-07-30 15:58:06 EDT
This has been fixed with the fix to bug 317900.  Dali now supports a fairly wide array of non java sourcepath scenarios.  If there are further issues, please open a new bug/enhancement request (for those issues not already open)