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

Is it possible to share configuration from persistence.xml?

I have one persistence unit configured in my persistence.xml but i have two databases. Those databases are identical, regarding the schema. What i am trying to do is: Persistence.createEntityManagerFactory("unit",…
whiskeysierra
  • 5,030
  • 1
  • 29
  • 40
3
votes
0 answers

Which property of Persistence.xml can do Hibernate Configuration as Readonly.?

I am using Hibernate Configuration in my persistence.xml. I want two persistence units. One for persisting or editing to the db. And the second persistence unit` will only have read access to db. Database-readonly will be able to perform Only Read…
Vikrant Kashyap
  • 6,398
  • 3
  • 32
  • 52
3
votes
0 answers

Tables not being created from entity classes using JPA, Hibernate, h2 embedded db and JavaSE

I am having an issue on configuring my model to create database tables. I am using a h2 embedded database since it is a prerequisite for my project. I have created the entity class with the necessary data annotations. I created the persistence.xml…
MIlena
  • 257
  • 1
  • 4
  • 13
3
votes
1 answer

How to populate a DB with my JPA entities in IntelliJ

Is there a way in IntelliJ to create tables in a database from my entity classes? I mean without ER diagram. The IDE allows me to create entities from the DB, but not the other way around. I used to use netbeans and it just lets you add entities to…
user3817446
  • 111
  • 1
  • 4
3
votes
3 answers

Hibernate with JPA, connection time very slow

I have a project where I would like to use Hibernate for database access. In the application, the JPA api is used. The persistence.xml file is this
3
votes
1 answer

Referencing a datasource with JNDI name in persistence.xml

So I use Wildfly 8.2.0.Final I created my MySQL datasource successfully. Proof: from the admin console , i do "Test connection" and it gives Successfully connected to database MyAppDS. the datasource definition in standalone-full.xml : …
Nani
  • 317
  • 5
  • 15
3
votes
2 answers

Infinispan - set per Entity expiration.lifespan

I have a java web application deployed on Jboss 6.1.0, that uses infinispan 5.2.6.Final. I'm trying to set a per Entity specific expiration.lifespan following this guide…
Perelum
  • 129
  • 1
  • 10
3
votes
2 answers

Cannot inject EntityManager declared in persistence.xml

I'm trying to develop a (Maven-based) jar library which can act as a DAL for my Java application. This is my persistence.xml file
gvdm
  • 3,006
  • 5
  • 35
  • 73
3
votes
1 answer

Different persistence units for different Maven profiles

I want to use two different databases depending on the selected Maven profile. For the profile "production" I want to use a MySQL database and for the "development" profile I want to use an in-memory HSQLDB. I found out that it is possible to have…
3
votes
2 answers

Unit Testing from within Play-Module (JPA, eclipse PersistenceProvider)

My application is based on playframework and contains multiple modules. The database interaction is handled trough JPA (org.eclipse.persistence.jpa.PersistenceProvider) My task is to cover one of these modules with…
uhon
  • 195
  • 1
  • 9
3
votes
1 answer

It is possible to override properties in a persistence.xml that is located in a jar dependency

I have a java-ee web application that uses a persistence unit that is packaged as a jar dependency (Entity classes, EJB repositories, persistence.xml). In order to get some acceptance tests running for the web application i need to override a…
lgraf
  • 596
  • 7
  • 13
3
votes
1 answer

NoClassDefFoundError for JPA createEntityManagerFactory

I am new to developing with EclipseLink JPA, i am using eclipselink-2.4.0.v20120608-r11652.zip this version. the full story of my problem is that my lib contain some JPA 1.0 lib and i decide to upgrade to JPA 2.0 by download latest EclipseLink…
Ben.Yan
  • 118
  • 4
  • 13
2
votes
2 answers

how create a JPA persistance unit at runtime

Is it possible to create a jpa persistence unit on the fly in runtime withowt having it defined in persistance.xml? I have a use case where I use a one instance of an application for different customers, for each customer I setup a new database, I…
simonC
  • 4,101
  • 10
  • 50
  • 78
2
votes
1 answer

Configure persistence units to be available in several jars of an ear

In a .ear file, my EJBs are copied in several jar and war for some technical constraints. And only one of these jar contains the persistence.xml file where I have configured several persistence units. myear.ear |---- myjar1.jar |--------…
jsebfranck
  • 704
  • 2
  • 9
  • 18
2
votes
1 answer

Unknown SAXException: Requested schema is not found in local repository

I try to connect my Maven app with my DB with GlassFisch server. I also tried MySql and Postgres, but I got the following error by deploy: Exception Occurred :Error occurred during deployment: Exception while deploying the app…