Hibernate Persistence
$count++; if($count == 1) { include "../mobilemenu.php"; } if ($count == 2) { include "../sharemediasubfolder.php"; } ?>
In Hibernate we can create a file under META-INF called persistence.xml, to define settings and persistence entities.
Sample persistence.xml file:
<persistence>
<persistence-unit name="CosmicLearn">
<jta-data-source>CosmicDB</jta-data-source>
</persistence-unit>
<class>com.cosmiclearn.model.Planet</class>
<class>com.cosmiclearn.model.Galaxy</class>
</persistence>
We need to define atleast one persistence unit. Here we created a persistence unit named CosmicLearn.
<persistence-unit name="CosmicLearn">
We need to define a data source for our project to connect to. We can do that by providing a JNDI data source as shown below.
<jta-data-source>CosmicDB</jta-data-source>
We can list our mapped classes for the domain as shown below. Hibernate will read these classes and use them as persistent entities.
<class>com.cosmiclearn.model.Planet</class>
<class>com.cosmiclearn.model.Galaxy</class>