Do
Question:
In a persistence.xml file, the omission of
Answer:
While
Hibernate's Auto-Detection:
To enable Hibernate's auto-detection in Java SE, add the hibernate.archive.autodetection property to the persistence.xml file, as seen below:
<persistence-unit name="eventractor" transaction-type="RESOURCE_LOCAL"> <!-- Hibernate supports auto-detection in JSE --> <properties> <property name="hibernate.archive.autodetection" value="class, hbm"/> <!-- Other properties --> </properties> </persistence-unit>
By specifying "class, hbm" as the value, the auto-detection process searches for both annotated classes and Hibernate mapping XML files. This provides a convenient alternative to explicitly listing
The above is the detailed content of Can Hibernate Auto-Detect @Entity Classes to Replace `` Elements in `persistence.xml`?. For more information, please follow other related articles on the PHP Chinese website!