Note that there are some explanatory texts on larger screens.

plurals
  1. PODoes the "mapping" tag in hibernate.cfg.xml have an equivalent property name in hibernate.properties?
    text
    copied!<p>I thought that hibernate.cfg.xml and hibernate.properties were effectively equivalent, and therefore, could be used interchangeably. Is this true?</p> <p>If it is true, then what is the equivalent property name in hibernate.properties for the "mapping" tag that sometimes appears in hibernate.cfg.xml?</p> <p>For example, here is an example hibernate.cfg.xml:</p> <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt; &lt;!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt; &lt;hibernate-configuration&gt; &lt;!-- a SessionFactory instance listed as /jndi/name --&gt; &lt;session-factory name="java:hibernate/SessionFactory"&gt; &lt;!-- properties --&gt; &lt;property name="connection.datasource"&gt;java:/comp/env/jdbc/MyDB&lt;/property&gt; &lt;property name="dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt; &lt;property name="show_sql"&gt;false&lt;/property&gt; &lt;property name="transaction.factory_class"&gt; org.hibernate.transaction.JTATransactionFactory &lt;/property&gt; &lt;property name="jta.UserTransaction"&gt;java:comp/UserTransaction&lt;/property&gt; &lt;!-- mapping files --&gt; &lt;mapping resource="org/hibernate/auction/Item.hbm.xml"/&gt; &lt;mapping resource="org/hibernate/auction/Bid.hbm.xml"/&gt; &lt;!-- cache settings --&gt; &lt;class-cache class="org.hibernate.auction.Item" usage="read-write"/&gt; &lt;class-cache class="org.hibernate.auction.Bid" usage="read-only"/&gt; &lt;collection-cache collection="org.hibernate.auction.Item.bids" usage="read-write"/&gt; &lt;/session-factory&gt; &lt;/hibernate-configuration&gt; </code></pre> <p>I know how to transform some, but not all, tags in this hibernate.cfg.xml to hibernate.properties:</p> <pre><code>hibernate.connection.datasource=java:/comp/env/jdbc/MyDB hibernate.dialect=org.hibernate.dialect.MySQLDialect </code></pre> <p>But how do you translate the other tags, such as "mapping", to hibernate.properties?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload