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
2
votes
1 answer

How to inject EntityManager in Java SE using @PersistenceContext (EclipseLink)

I have a client-server application that I made for a project at my university and I'm having problems with the database-JPA Cache synchronization. I'm using an application-managed EntityManager about which I found out from other posts that it's…
frozencure
  • 181
  • 1
  • 9
2
votes
2 answers

JPA default persistence unit

I get exception "There is no default persistence unit in this deployment." can I somehow mark unit as default?(I have only one persistence unit, so Id rather not call it by name)
rave
2
votes
0 answers

Elastic Beanstalk environment variables in persistence.xml

This is a fairly straightforward question but I couldn't find a proper answer for it. I have set a few environment variables in my Elastic Beanstalk environment. The application deployed is a Java Webapp built using JPA (EclipseLink). I want to…
2
votes
1 answer

JEE 7.0 JPA 2.1 Payara 4.1.x Eclipselink persistence.xml

I have to migrate old jee 6/jpa2.0 project to jee 7/jpa2.1. I migrated in pom.xml like this: fish.payara.extras
Mihai Catan
  • 106
  • 9
2
votes
0 answers

What is the best way of extracting property values from JPA persistence.xml if you want it to work for EclipseLink too?

I realize it is always possible to parse the persistence.xml myself, but I would like to know if there is any better way to extract the properties from persistence.xml, for example the values of the database driver/url/user/password, in a way…
Pelle
  • 137
  • 2
  • 6
2
votes
0 answers

"Persistence xml file was not found. NO GENERATION will occur!!" error in build.xml

I am receiving the error [javac] Note: The persistence xml file [META-INF/persistence.xml] was not found. NO GENERATION will occur!! Please ensure a persistence xml file is available either from the CLASS_OUTPUT directory [META-INF/persistence.xml]…
Dumpcats
  • 453
  • 5
  • 21
2
votes
0 answers

Switching JPA 2.1 datasource dynamically

I'm working on a persistence layer using jpa 2.1. Multitenancy is a requirements for my application so I need to be able to change my datasource dynamically at runtime. From what I saw in many posts I tried to use this way: EntityManagerFactory emf…
Alex
  • 1,515
  • 2
  • 22
  • 44
2
votes
1 answer

it's possible configure a persistence.xml for multiple data sources?

hi i just want to know how configure in a persistence.xml two datasources one of the data sources have a jar outside from the other. I'm tried but i really don't if it's possible
Jorge
  • 17,896
  • 19
  • 80
  • 126
2
votes
1 answer

Error No Script Specified when using JPA Persistence Schema Generation

Running on Wildly 8.2.0.Final. I get the following error when trying to generate a database schema from a script. Caused by: javax.persistence.PersistenceException: Schema generation configuration indicated to include CREATE scripts, but no script…
Android
  • 137
  • 1
  • 11
2
votes
2 answers

Relationship between persistence.xml datasource and web.xml / ibm-web-bnd.xml resource-ref

I am trying to follow this tutorial and at same time adapting it to run in on Websphere 8.5.5 with default Websphere JPA ( OpenJPA ) implementation. I created the project in Eclipse and use WAS for Developers. Initially, when running the…
adbdkb
  • 1,897
  • 6
  • 37
  • 66
2
votes
3 answers

How to detect entities automatically with openJPA?

I'm looking for an entity detection in OpenJPA. That I don't need to declare all entities in the persistence.xml. Edit: I'm sorry, I forgot to say that I develop a java se app.
Robin
  • 8,162
  • 7
  • 56
  • 101
2
votes
3 answers

Combine two or more persistence.xml(s) into one, when packaging (war) many modules (Maven)

I have a maven-managed project with some modules (with jar package). Each module contains its "persistence.xml" file in its META-INF directory. Another module has the responsibility to package these modules into a war file. But I have not found a…
smallufo
  • 11,516
  • 20
  • 73
  • 111
2
votes
1 answer

Creating a Table with JPA on wildfly using Hibernate fails

Im using JPA to create a table on the built in H2 database of Wildfly 8.0 installation using hibernate, but it fails with the following error message: Caused by: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException:…
2
votes
0 answers

Externalise postgresql schema from persistance.xml to jboss datasource configuration

This is my persistance.xml http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
Bigmwaj
  • 361
  • 2
  • 7
2
votes
0 answers

Externalize database connection (persistence unit) details in Tomcat 7 with EclipseLink

I'm joining a project which uses Tomcat 7 EclipseLink as JPA provider (could probably be changed) This project is deployed to many different environments each with a different database connection. Currently all connection details for all databases…
Marcel
  • 4,054
  • 5
  • 36
  • 50