Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Persistence.xml file

Kris,
    Hi, the <exclude-unlisted-classes> element is used to fine tune which entities are picked up - you may want to include some but exclude others - when you use this element in conjuction with the <class> element.
    In a Java SE environment off the server when you use a value of false (the default in SE mode is true) - all your entities on the classpath will get picked up without specifying them in persistence.xml - normally you should list them though.
    In a Java EE environment on the server when you use a value of true (the default in EE mode is false) - all your entities will not get picked up if you don't have them listed in persistence.xml in <class> elements.

    In your example persistence.xml your entities...
          ...will be found when running in SE mode (because you are overriding the default for SE)
          ...will be found when deployed in EE mode (because you are re-setting the default for EE)

    thank you
    /michael
krisusa123 wrote:
Hello EclipseLinkTeam
I have my eclipselink persistence.xml file listed as below.
 
How does the application find all the entities without being specified with <class></class> tags in my peristence.xml file?
 
What does <exclude-unlisted-classes> does?
 
Thanks in advance!
 
 

<?xml version="1.0" encoding="UTF-8"?>

<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">

<persistence-unit name="Testing" transaction-type="RESOURCE_LOCAL">

<exclude-unlisted-classes>false</exclude-unlisted-classes>

</persistence-unit>

</persistence>
 
All the other properties are populated at run time using syntax like this
 

properties.put(PersistenceUnitProperties.TARGET_DATABASE,

PropertyManager.getProperty("persistence.target_database"));
 
 


f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng


_______________________________________________ eclipselink-users mailing list eclipselink-users@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top