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
0 answers

Specifying custom persistence unit in spring boot

I have the following configuration in my spring boot application: @Bean(name="entityManagerFactory") public LocalContainerEntityManagerFactoryBean entityManagerFactory( @Value("${ds.fake.driverClass}") String driverClass, …
mangusbrother
  • 3,988
  • 11
  • 51
  • 103
2
votes
0 answers

Custom location of persistence.xml in Hibernate

Is there any property in Hibernate for locating custom location of persistence.xml other than /META-INF/? I found EclipseLink defined…
Jin Kwon
  • 20,295
  • 14
  • 115
  • 184
2
votes
1 answer

Required Derby DataSource property databaseName not set

After unsuccessfully trying to switch to Postgresql from Derby using a Glassfish4 server, I wanted to switch back to my previous Derby based web app. But when I tried to deploy my app the following error appeared: [2014-10-20T23:13:36.297+0200]…
sthor69
  • 638
  • 1
  • 10
  • 25
2
votes
1 answer

DeploymentException: Invalid resource : jdbc/legacy__pm

I agree absolutely with the glassfish logs, that jdbc/legacy__pm is an invalid resource. There's no mention of such a file, or even that text, anywhere within the Enterprise project nor its modules. There is, however, a jdbc/legacy resource. The…
Thufir
  • 8,216
  • 28
  • 125
  • 273
2
votes
2 answers

Java JPA Hibernate Connection Issue

I'm using Netbeans to connect to a database. I want to use Java persistence to retrieve data from the database but I'm getting these errors: jun 18, 2014 9:41:44 AM org.hibernate.annotations.common.Version INFO: HCANN000001: Hibernate…
Hubertokf
  • 308
  • 1
  • 4
  • 12
2
votes
1 answer

persistence xml on openshift and enviromental variables

I'm trying to deploy a simple application to Openshift, but I'm confused about its enviromental variables. They are used to access the mysql database that is installed. I saw a few examples but perhaps someone could tell me if I'm doing something…
Nimchip
  • 1,685
  • 7
  • 25
  • 50
2
votes
1 answer

How to externalize properties of persistence.xml for JBOSS 7.1.1?

My persistence.xml is currently present in the application war(in META-INF folder.). However, for the application to be run across multiple DBs the persistence needs to be changed again and again. I want to avoid it. But, I am not able to understand…
aman_novice
  • 1,027
  • 3
  • 13
  • 31
2
votes
1 answer

How to Solve SQL Integrity Constraint Violation Exception

I created an entity class that has the same properties as project.java, and created a class where I can persist the entity object. Also, I created a database using databases in Netbeans using embedded JDBC. I have the persistence.xml, which provides…
mussdroid
  • 732
  • 1
  • 9
  • 22
2
votes
2 answers

Cannot call JNDI resource in persistence.xml file

Although it seems many users faced the same problem, I have to post my own issue, taking in account that for now, no suggestion from those already present worked for me. Or maybe am I missing something? Here is my persistence.xml file (located uner…
artaxerxe
  • 6,281
  • 21
  • 68
  • 106
2
votes
1 answer

Possibility to eliminate persistence.xml?

I'm quite new to the Java EE persistence world, so I apologize if the question seems odd. In Servlets 3.0 one can eliminate the web.xml file completely and strictly use annotations instead. Can you do this with JPA as well? I've been reading all…
JagWire
  • 269
  • 2
  • 16
2
votes
0 answers

hibernate 4.3.0.Final causes a ORA-01000: maximum open cursors exceeded

What would I need to specify in the persistence.xml in order to avoid Oracle complaining about ORA-01000: maximum open cursors exceeded? This error occurs after migrating from Hibernate 4.2.6 to 4.3.0
2
votes
1 answer

Shared JPA persistence.xml among several projects

I have several small java projects that access to same DB. Is it possible to have one persistence.xml file, which is somewhere on the file system (not included in any jars, wars, ears, etc.) and it is still visible to the projects? The reason is…
2
votes
0 answers

Proper notation in persistence.xml to change encoding to UTF-8

Which of this notation is proper in persistence.xml file for web application in TomEE server with OpenJPA module to connect with MySQL database and set UTF-8 encoding?
kuba44
  • 1,838
  • 9
  • 34
  • 62
2
votes
1 answer

Updating EhCache from native implementation to Hibernate implementation

My project uses Spring 3.x, Hibernate 4.2.7, JPA and Maven. It was migrated from a 3.x Hibernate version. Previously, the project used the following package: net.sf.ehcache ehcache
Leonel Sanches da Silva
  • 6,972
  • 9
  • 46
  • 66
2
votes
3 answers

JPA/Hibernate: create database schema and import data on first run, update schema on subsequent runs

In my projects I often use JPA/Hibernate stack for database. When defining persistence.xml you have couple options you can set hibernate.hbm2ddl.auto. If set to create tables will be recreated on every application run (persisted data will be lost of…
Eugene Loy
  • 12,224
  • 8
  • 53
  • 79