Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well, you can either access the database by:</p> <ul> <li>providing the url/driver/password/etc. information in the <code>persistence.xml</code> using your jpa-provider properties (in your case <code>hibernate.connection.*</code>) or the JPA 2.0 standardised <code>javax.persistence.jdbc.*</code> ones - this basically looks like the example you've posted,</li> <li><p>creating a Data Source in the ApplicationServer and just referring to it in the <code>persistence.xml</code> (through it's JNDI name you provide during creation) which might look similar to this (without the XML schema definition for the sake of brevity) :</p> <pre><code>&lt;persistence&gt; &lt;persistence-unit name="SomeApp"&gt; &lt;provider&gt;org.hibernate.ejb.HibernatePersistence&lt;/provider&gt; &lt;jta-data-source&gt;jdbc/myDB&lt;/jta-data-source&gt; &lt;/persistence-unit&gt; &lt;/persistence&gt; </code></pre></li> </ul> <p>What you're actually doing right now (with these properties) is using the JDBC.</p> <hr> <p>I would definitely go with the creation of the Data Source in the ApplicationServer rather than providing it in the properties in <code>persistence.xml</code>. It allows you to dynamically change the end-database, it's type, credentials, manage connection pools, etc. without even touching your descriptor.</p> <p>It's also safer, as the credentials are not written in the plain file left on your server.</p> <p>As a side note, please remember that the <code>javax.persistence.jdbc.*</code> properties are a JPA provider <strong>must requirement</strong> for the <strong>Java SE</strong> environment, but it's <strong>optional</strong> for <strong>Java EE</strong>.</p> <p>Hope that helps!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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