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

PersistenceUnitPostProcessor Implementation not working during junit test

I have implemented a PersistenceUnitPostProcessor for scanning the entities in different packages and not listing them in the persistence.xml. Sadly, it is only working during deployment but not when running junit tests. The Processor is declared in…
0
votes
2 answers

How does spring detects current persistenceUnitName?

I'm working on a spring and JPA project. I had configured my JPA Persistence Unit in the Persistence.xml and here's my spring configuration file. My application works fine, but I didn't understand how does spring framework detects the Persistence…
0
votes
1 answer

neglect some classes in persistence.xml

I'm using eclipseLink 2.5.1 and through persistence.xml i'm able to create tables in DB by using entity classes(Java classes annotated with @Entity), those classes are listed in persistence.xml. Problem: All classes which are defined in…
CaliCo
  • 39
  • 10
0
votes
1 answer

Openshift - How to configure mysql connection using persistence.xml - problems with openshift variables

I want to create web application on Openshift which use Tomcat, Spring and Hibernate. First I have tried to configure the database using persistence.xml like this
James Freitas
  • 504
  • 2
  • 8
  • 21
0
votes
1 answer

DRY in persistence.xml

I'm trying to use DRY in my persistence.xml file in different persistence units. I have the following persistence.xml (it's just one file): java:/siteADS
SaintLike
  • 9,119
  • 11
  • 39
  • 69
0
votes
1 answer

it seems that hibernate is not reading the changes in the persistence.xml

Hello, I created the persistence file using the JNDI. But I change to use transaction-type="RESOURCE_LOCAL". The Hibernate log says one thing and the persistence.xml is other thing Error: nov 28, 2014 3:59:54 PM…
0
votes
2 answers

Saving and retrieving records in two related tabls wiht JPA

In my application there are two models with @onetomany realationship. I have defined Room and Seat entities. My first problem is that seats collection always returns null. @Entity public class Room implements Serializable { @Id …
bbxn
  • 1
  • 1
0
votes
0 answers

lookup a JDBC resource on glassfish with JNDI

Generally speaking, how is a persistence.xml in a library configured to use JDBC Connection Pooling with EclipseLink and JPA? When the library is used by the web module of an Enterprise Application, the library's configuration file is organized to…
Thufir
  • 8,216
  • 28
  • 125
  • 273
0
votes
1 answer

war, ejb-jar and persistence.xml

I have project with two ejb-jars located in [WAR]/WEB-INF/lib. Both ejb-jars uses JPA and contains classes annotated @Entity. But I have problems with packaging and deployment (Glassfish 4). If both of my jars contains persistence.xml then I get…
Joel
  • 473
  • 2
  • 7
  • 22
0
votes
1 answer
0
votes
1 answer

persistenceUnitName with JPA2.1

I am having a Spring project (with JPA2.1) and persistenceUnitName is defined as "default" in that project. I have defined the dependency (using maven) of this project (using spring-core.jar in another project to reuse some Entity classes and other…
0
votes
2 answers

DBCP (DataBase Connection Pooling) from JavaSE with JPA

For a JavaSE client, how is DBCP handled? With JDBC, I know how to add Apache DBCP. Can I add Apache DBCP to JPA? If so, how? Does the persistence.xml file have an option for this? code: package legacy.database; import…
Thufir
  • 8,216
  • 28
  • 125
  • 273
0
votes
1 answer

Remove eclipse error marker in persistence.xml definitely

In a Java EE project in Eclipse I've got a marker in my persistence.xml that cannot be deleted: JAR file "lib/entities.jar" cannot be resolved My persistence.xml file looks like:
boskop
  • 609
  • 5
  • 23
0
votes
1 answer

JPA persistence.xml and MySQL - Not taking the correct "hibernate.connection.url" catalog

I have worked first with Ingres database and there weren't problems there. I have configured my MySQL Database with two Schemas/Catalogs in the same port, one for producers and the other for testing. In the persistence.xml file, I have the following…
user2508640
  • 11
  • 1
  • 4
0
votes
1 answer

How to create H2 table before adding records in JPA

My project involves JPA and following in my persistence.xml file