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
4
votes
4 answers

Eclipse keeps bin/META-INF/persistence.xml in use

On a clean installation of Eclipse Kepler 4.3.2, with an installation not including anything like JPA aspects, Spring, whatever - just plain Java, I keep encountering this weird issue. Upon building the project, but not running it even once, the…
Cilph
  • 115
  • 2
  • 8
4
votes
1 answer

How to reference external hibernate.cfg.xml from persistence.xml

I have a JAR file that needs to be deployed into multiple environments, each with their own database connection parameters. Rightly or wrongly, I've been requested to make those database connection parameters external to the JAR. I've seen…
user2913104
  • 41
  • 1
  • 4
4
votes
0 answers

why transaction-type="JTA" cause "WebBeans context with scope type annotation @RequestScoped does not exist within current thread"?

At my persistence.xml when I change from transaction-type="RESOURCE_LOCAL" to transaction-type="JTA" i get this error: WebBeans context with scope type annotation @RequestScoped does not exist within current…
kuba44
  • 1,838
  • 9
  • 34
  • 62
4
votes
1 answer

Webapp cannot find Persistence Unit. No persistence unit named 'X' is available in scope

I am trying to run my webapp on my weblogic 12c server using EJB 3.1, JPA 2.0, M2E-WTP, and JSF 2.1 technologies and continue to get the following error: javax.ejb.EJBException: EJB Exception: : java.lang.IllegalArgumentException: No persistence…
Padawan
  • 770
  • 1
  • 8
  • 18
4
votes
1 answer

error in persistence.xml

I am trying to deploy a simple EJB project onto Jboss 7.1.1. I have a separate installation of H2 database. So I changed the standalone.xml as follows:
Sara.0
  • 167
  • 3
  • 15
4
votes
1 answer

JPA EntityManagerFactory with persistence.xml and Properties Map

Can I pass some properties to an EntityManagerFactory by code, while still maintaining persistence.xml as the main configuration source? Using createEntityManager's overload with a Map appears to override persistence.xml completely: Map
Matthias Meid
  • 12,455
  • 7
  • 45
  • 79
3
votes
2 answers

eclipselink without persistence.xml

I'm not a big fan of XML files. Therefore I'm wondering if there is a way to use eclipselink without its persistence.xml configuration file. Why? Because I want to manage different databases dynamically. It would be much easier to do it without the…
nexus
  • 2,937
  • 3
  • 17
  • 22
3
votes
2 answers

Modify persistence.xml on runtime

I'm developping a program that uses JPA, and I deployed it in a single jar. I wish to modify (or ask to the user, in an menú item) the configuration of the connection data with the database server. It's possible to modify the data (user, password,…
neogurb
  • 690
  • 5
  • 15
3
votes
1 answer

JakartaEE JPA container-managed entity manager with in memory db

I am currently exploring JakartaEE and have a very basic application with a few jax-rs endpoints, a service and a "repository". My repository uses the EntityManger to write to the database. Since I am just testing, I wanted to use an in memory…
Turtle
  • 86
  • 8
3
votes
1 answer

No Persistence provider for EntityManager named- when try to deploy from weblogic console

I'm struggling for a few days about this error. When I try to deploy from ide(IntelliJ-eclipse), it works correct. But when I try to deploy from WebLogic console, I got these errors; Error Unable to access the selected application. Error Unable…
3
votes
5 answers

org.xml.sax.SAXParseExceptionpublicId: http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd

Error thrown at execution suddenly: org.xml.sax.SAXParseExceptionpublicId: http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd; lineNumber: 1; columnNumber: 1; Deployment descriptor file META-INF/persistence.xml in archive [classes]. …
lifer
  • 31
  • 2
3
votes
1 answer

JNDI lookup failed for the resource

I want to programm some simple JPA test. My project structure is ├── pom.xml └── src └── main ├── java │   └── guest │   ├── GuestDao.java │   ├── Guest.java │   ├── GuestRest.java │   …
Markus
  • 578
  • 6
  • 26
3
votes
2 answers

EclipseLink into OSGI Bundle persistence.xml not found

I'm having some problem with EclipseLink. I'm using GlassFish v3.1 and I'm trying to use EclipseLink for my persistence layer. I followed all tutorials available on the Eclipse wiki without luck. My persistence.xml file cannot be parsed and I…
MobileSam
  • 818
  • 8
  • 14
3
votes
1 answer

Error: 'No Persistence provider for EntityManager' under Hibernate 5.3.0.Beta1

In Eclipse, I set up a new maven project where I want to try some database connection. So I created a User.java which is my entity and a DataBaseConnector.java where I try the db connection but I get an error: Exception in thread "main"…
vifire
  • 57
  • 10
3
votes
0 answers

Persistence.xml in WAR and JAR

I have a jar file that cares about all persistence logic. This jar file contains persistence.xml file with all configurations needed. My war uses this jar file as dependency but should not know how it's persisted in database. I have some…
Ronaldo Lanhellas
  • 2,975
  • 5
  • 46
  • 92