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

How to use spring roo to manage multiple DB?

I am working on a project using spring roo and it needs to manage multiple DB. So I set up multiple data sources and entity manager factories. And when I run the project, I always get the following error: 2011-12-14 18:35:39,692 [main] ERROR…
Charles
  • 675
  • 3
  • 12
  • 21
1
vote
2 answers

glassfish-resource.xml and persistence unit in eclipse ang glassfish v3.0

I created a Web project in eclipse and adding a glassfish-resource.xml init and configure it with my database url. also I added a persistence.xml unit in my project and add a jta-datasource for my datasource defined in glassfish-resource.xml but…
Nav
  • 4,450
  • 10
  • 53
  • 84
1
vote
1 answer

Issue: java cannot access jakarta.persistence.Entity

I am trying to build my (yet) simple Java Persistence Project with a MySql Database in the Background and try to access it via Rest over a Java Application. This all doesnt matter, because as soon as i try building my project I get an error by my…
1
vote
0 answers

JPA - use entities from another jar

I was going going to use some JPA Entities in various apps, so I placed them in a separate JAR and added dependencies in pom where needed. In order to allow persistence provider to "see" the entities classes I had to clearly list them in the…
Sogawa-sps
  • 147
  • 10
1
vote
0 answers

Cannot get a connection as the driver manager is not properly initialized (could not manage to test database)

**User Class** This is the user class which has the basic details of user, Id, email, fullname, password. @Entity public class Users { private Integer userId; private String email; private String fullName; private String…
1
vote
1 answer

how can I have a dynamic persistence unit name?

I have an application, written in JEE, JPA, I use Payara as the application server. In my application's persistence.xml I have On the payara side, I have JDBC resource called XYZ, with JDBC…
norbi771
  • 814
  • 2
  • 12
  • 29
1
vote
2 answers

How can I exclude one persistence.xml from the test classpath in Eclipse without using Maven/Ant?

While running JUnit integration tests inside Eclipse, I have two persistence.xml files on the classpath - one containing the configuration for the test cases and another one for production. I need to find a way to exclude the persistence.xml for…
Bastian
  • 11
  • 1
  • 3
1
vote
1 answer

Connection Error with Eclipselink JPA 3.0 and standalone database

I've been asked to migrate the database connection jars for a large standalone Swing application from the Eclipselink JPA 2.0 to the Eclipselink JPA 3.0 implementation. One big difference I see: Eclipselink 3.0 uses Jakarta. All I am trying to do…
Warren
  • 179
  • 2
  • 7
1
vote
2 answers

Change values in persistence.xml from within the program

Is it possible to change values in persistence.xml from within the program that is using it ? If yes, i would appreciate some hints or/and links to read.
Jannis Alexakis
  • 1,279
  • 4
  • 19
  • 38
1
vote
0 answers

How to get Hibernate to scan for Entities in a jar file included in the jar

I have a vexing problem. I'm upgrading stuff to j11 and the latest of everything but I can't change too much of the app itself. The created jar file contains within itself a jar file that contains mapped entities, like…
Erik
  • 2,013
  • 11
  • 17
1
vote
0 answers

Wrong classpath in intellij for maven multi module project

My maven multi module project: root root/core root/persistence root/service1 root/service2 persistence depends on core and service1 and service2 are depends on persistence. When I run junit test cases for service1 or service2 from Intellij Idea,…
Mitesh
  • 477
  • 1
  • 6
  • 22
1
vote
1 answer

Hibernate : Error in persistence.xml - Element 'persistence-unit' cannot contain text content. The content type is defined as element-only

I'm using Hibernate and the below persistence.xml was working fine. But after creating a new JPA entity from Table in eclipse, persistence.xml is giving error - Element 'persistence-unit' cannot contain text content. The content type is defined as…
1
vote
1 answer

Getting hibernate.properties not found and java.lang.NoClassDefFoundError when using jpa with hibernate

I'm trying to create a basic quick start project using maven to understand jpa. I'm using Hibernate version 5.2.8.Final. When running its showing hibernate.properties not found and giving NoClassDefFoundError. I also have ojdbc14 jar file in my…
Sarath
  • 41
  • 4
1
vote
0 answers

How dynamically define properties for JPA connection with Injected EntityManager

How can I configure persistence.xml for production? My question specifically concerns the definition of parameters such as user, password and bank url, for example. I would like to not include this data directly in the file, but in an environment…
Joao Albuquerque
  • 366
  • 1
  • 3
  • 15
1
vote
0 answers

Could not create JDBC connection for a test method, when i add entity

Good morning, i have some problems with my Junit test. i have this error when i run my Junit test: java.lang.RuntimeException: Could not create dataset for test 'testRecupereEvenementsATraiter'. at …
ulrich 63
  • 11
  • 1