jbonofre commented on code in PR #907:
URL: https://github.com/apache/polaris/pull/907#discussion_r1935095587


##########
site/content/in-dev/unreleased/metastores.md:
##########
@@ -49,6 +49,8 @@ The `configuration-file` option must point to an [EclipseLink 
configuration file
 `persistence.xml`, is used to set up the database connection properties, which 
can differ depending
 on the type of database and its configuration.
 
+> Note: EclipseLink is scanning the folder containing the `persistence.xml` 
but also the parent folder. For this reason, you have to locate the 
`persistence.xml` at least two folders down to the root folder, e.g. 
`/deployments/config/persistence.xml` is correct, whereas 
`/deployments/persistence.xml` is not correct.
+

Review Comment:
   It's related to JPA spec and the fact EclipseLink is using 
`classLoader.getResource()`: we allow to use "external" resources instead of 
the "container" packaging:
   
   ```
   EJB modules: you can package your entities in an EJB JAR. When defining a 
persistence unit in an EJB JAR, the persistence.xml file is not optional–you 
must create and place it in the META-INF directory of the JAR alongside the 
deployment descriptor, if it exists.
   
   Web modules: you can use a WAR file to package your entities. In this case, 
place the persistence.xml file in the WEB-INF/classes/META-INF directory. Since 
the WEB-INF/classes directory is automatically on the classpath of the WAR, 
specify the mapping file relative to that directory.
   
   Persistence archives: a persistence archive is a JAR that contains a 
persistence.xml file in its META-INF directory and the managed classes for the 
persistence unit defined by the persistence.xml file. Use a persistence archive 
if you want to allow multiple components in different Java EE modules to share 
or access a persistence unit.
   
   Once you create a persistence archive, you can place it in either the root 
or the application library directory of the EAR. Alternatively, you can place 
the persistence archive in the WEB-INF/lib directory of a WAR. This will make 
the persistence unit accessible only to the classes inside the WAR, but it 
enables the decoupling of the definition of the persistence unit from the web 
archive itself.
   ```
   
   So yes, that causes issue in classloader/resource scan imho.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to