Note that there are some explanatory texts on larger screens.

plurals
  1. POJPA persistence.xml file content details
    primarykey
    data
    text
    <p>I am new to Java EE and JPA world, and need help with understanding persistence.xml file content. I work with Eclipse IDE, TomEE application server, OpenJPA as persistence provider, and MySQL as database.</p> <p>Now, lets say I have some Java EE project with annotated entities named A,B and C, and I would like to map these entities to MySQL database named TestDB. I would like for database to be created during deployment, according to entity annotations. On MySQL server I log as "root" user with password "123".</p> <p>Which properties from persistence.xml correspond to which Java EE environment artifacts (what represents persistence unit, where to specify database name ...)? Is this the correct persistence.xml file content, for situation described above:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;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"&gt; &lt;persistence-unit name="Test" transaction-type="JTA"&gt; &lt;provider&gt;org.apache.openjpa.persistence.PersistenceProviderImpl&lt;/provider&gt; &lt;properties&gt; &lt;property name="openjpa.ConnectionURL" value="jdbc:mysql://localhost:3306/TestDB" /&gt; &lt;property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver" /&gt; &lt;property name="openjpa.ConnectionUserName" value="root" /&gt; &lt;property name="openjpa.ConnectionPassword" value="123" /&gt; &lt;property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)" /&gt; &lt;property name="openjpa.jdbc.DBDictionary" value="mysql" /&gt; &lt;property name="openjpa.Log" value="DefaultLevel=WARN, Tool=INFO" /&gt; &lt;/properties&gt; &lt;/persistence-unit&gt; &lt;/persistence&gt; </code></pre> <p>What else settings are important for JPA to work properly? (Appreciate any help)</p>
    singulars
    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. 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