Questions tagged [persistence.xml]

Used with the Java Persistence API, specifies names and database properties.

When used with the Java Persistence API, the persistence.xml file is usually placed in the META-INF folder; it's used to specify the persistence provider name, entity class names, and properties like the database connection URL, driver, user, password, and so on (taken from http://www.javaworld.com/javaworld/jw-01-2008/jw-01-jpa1.html?page=3).

519 questions
1
vote
2 answers

Use maven properties in persistence.xml

I want to use properties defined in my pom.xml (with different values for different profiles) in my persistence.xml. More precisely, I'd like the SQL dialect used in the persistence to adjust according to the profile I built my application with. So…
MetaColon
  • 2,895
  • 3
  • 16
  • 38
1
vote
1 answer

Wildfly can't find persistence units to inject into CDI managed bean

I have an app working well in Java 8 and Wildfly 10. The driver for the Postgres database is the PostgreSQL JDBC Driver 42.2.8 After updating to Java 11 and Wildfly 17, the different persistence units from the persistence.xml are no longer found.…
teleco
  • 21
  • 5
1
vote
1 answer

HSQLDB EJB3.0 Hibernate Cannot Connect to DB

I am attempting to create a EJB3.0 container-managed persistence bean and am having issues with connecting to the in-memory HSQLDB used by unit tests. I am using OpenEJB for my standalone container implementation. I have the following in my…
S73417H
  • 2,661
  • 3
  • 23
  • 37
1
vote
0 answers

Servicemix 7 Hibernate 5 javax.persistence.PersistenceException: No Persistence provider for EntityManager

I am using Servicemix 7. I am trying to use JPA implemented by Hibernate in my project. I have installed hibernate-release-5.2.16 in Servicemix. META-INF/persistence.xml
Hans
  • 145
  • 9
1
vote
1 answer

Dynamically add managed class names to EntityManagerFactory

Say I have a persistence.xml file like this:
Plaul
  • 7,191
  • 5
  • 19
  • 22
1
vote
0 answers

OPENJPA 2.4.3 apparently looking for persistence namespace on the internet

I'm using OpenJPA 2.4.3 and I found a weird occurrence. When OpenJPA tries to access my persistence.xml when connected to the internet and DNS working it works smoothly. However, when I'm not connected, it fails whenever it has to access my…
rafaelsk
  • 11
  • 3
1
vote
0 answers

Entities not being detected when using packaged Hibernate JPA persistence provider

Im deploying my web application on a local wildfly-11.0.0.Final server. Wildfly however provides its own hibernate and jpa modules which I dont want to use. I want to use the jpa jars packaged with my application. As described in …
1
vote
0 answers

hibernate.connection.autocommit = true not working

I'm creating a new java project that conect to an Oracle XE... I configured my persistence.xml with this: But on my DAO, if I don't use em.getTransaction().begin(); and…
BrunoTS
  • 171
  • 2
  • 17
1
vote
0 answers

No Persistence provider for EntityManager named esercizioCRUD

I create a mven project and I punt my persistence.xml in /src/main/resources/META-INF/persistence.xml This is my folder structure: enter image description here This is my persistence.xml
Doflamingo
  • 11
  • 3
1
vote
1 answer

Mapping interface type of objects in java

I have the following code interface Loanable {} abstract class Material {} @Entity class Journal extends Material {} @Entity class Book extends Material implements Loanable {} @Entity class DigitalMedia extends Material implements Loanable…
Harvey
  • 572
  • 1
  • 7
  • 23
1
vote
0 answers

H2 password issue after Upgrading to Hibernate 5

I've just upgraded my project from Hibernate 4.2.8 to Hibernate 5.2.12.Final The only change in terms of configuration is the persistence provider, instead of org.hibernate.ejb.HibernatePersistence it's now…
Gep
  • 848
  • 13
  • 29
1
vote
1 answer

How to scan Entity in EJB module

I have an ear file with structure below. [ejb-1.jar] and [ejb-2.jar] is both contain EBJ bean and Entity class. However, when I try to deploy it to server, JPA does not scan my entity in ejb jar file. Can any one tell me how to config…
Quang Duy
  • 23
  • 3
1
vote
1 answer

Hibernate / seam : hibernate.show_sql setting

org.hibernate.ejb.HibernatePersistence acm20-ds
A.W.
  • 2,858
  • 10
  • 57
  • 90
1
vote
1 answer

Hibernate does not recognize DBCP connection pool configurations from persistence.xml

I want to use DBCP2 connection pooling from Apache commons in an SE environment: (build.gradle) compile group: 'org.apache.commons', name: 'commons-dbcp2', version: '2.2.0' persistence.xml:
Archie
  • 962
  • 2
  • 9
  • 20
1
vote
0 answers

When create a new Persistence Unit?

I'm developing a GEO based app using PostGIS and Hibernate and I'm stuck on persistence units. I have entities with and without GIS attributes. And my persistence.xml is this:
rado
  • 5,720
  • 5
  • 29
  • 51