tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From martin mucha <alfon...@gmail.com>
Subject tomee configuration -- persistence.xml -- persistence unit definition.
Date Thu, 08 Oct 2015 12:51:09 GMT
Hi,

can someone explain to me, how persistence works in tomee? For example from
sample project moviefun-rest: There's referenced inexisting persistence unit
in persistence.xml, but app still works. And there's is datasource defined
in tomee.xml, which is not used. I'd expect app to fail when referencing
inexisting datasource. Ok, but I've fixed both jta and non-jta to point at
defined datasource. It still works, file-based hsqldb is created, however
nothing is persisted into it. Weird. So can someone please spell some light
on this 'funny' example? Or share a link to actually working, commented
example?

thanks.

persistence.xml:

<persistence version="2.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_2_0.xsd">
  <persistence-unit name="movie-unit">
    <jta-data-source>movieDatabase</jta-data-source>
    <non-jta-data-source>movieDatabaseUnmanaged</non-jta-data-source>
    <class>org.superbiz.moviefun.Movie</class>

    <properties>
      <property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(ForeignKeys=true)"/>
    </properties>
  </persistence-unit>
</persistence>


tomee.xml:
<tomee>
  <Resource id="HSQLDB Database" type="DataSource">
    JdbcDriver org.hsqldb.jdbcDriver
    JdbcUrl jdbc:hsqldb:file:target/db/moviefun
    UserName sa
    Password
  </Resource>
</tomee>






--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/tomee-configuration-persistence-xml-persistence-unit-definition-tp4676445.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Mime
View raw message