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
8
votes
2 answers

javax.persistence.PersistenceException: No Persistence provider for EntityManager named

I'm trying to set up a simple jpa 2.0 project by following the information provided by my teacher's documentation . I've been on this for hours now, but no matter what I do I always get this exception when I try to create a…
AchillesVan
  • 4,156
  • 3
  • 35
  • 47
8
votes
1 answer

can I inject values into the persistence.xml file from maven?

I want to be able to store my database information in a pom.xml (as properties) and inject the necessary values into my persistence.xml file. Is there any way I can achieve this in maven? an alternative would be how to keep my database connection…
santiagozky
  • 2,519
  • 22
  • 31
7
votes
1 answer

Using separate persistence.xml files for production and test with Spring 3.1

OK, sorry, I looked for answers to this for hours, but it took me entering the whole question for StackOverflow to bubble up the link I was looking for. You can read a lot of relevant information here. I have a Spring project created with Spring…
Old Pro
  • 24,624
  • 7
  • 58
  • 106
7
votes
3 answers

Multiple persistence units in Wildfly?

Is it possible to have two persistence units in a Wildfly (9.0.2) application? I get "WFLYJPA0061: Persistence unitName was not specified and there are 2 persistence unit definitions in application deployment deployment "jasper-web.war". Either…
jon martin solaas
  • 459
  • 1
  • 4
  • 14
7
votes
0 answers

How to log JPA/SQL queries with JavaMelody?

I have found the following manual https://code.google.com/p/javamelody/wiki/UserGuideAdvanced#JPA_monitoring It contains some info regarding the changes I should make in persistence.xml in order to let JavaMelody gather JPA/SQL statistics. However,…
Roman
  • 64,384
  • 92
  • 238
  • 332
7
votes
1 answer

Persistence.xml field values from properties file

Help, i would like to my persistence xml properties value reference to my db.properties file. here's my db.properties file jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/apsas jdbc.username=root jdbc.password=password and…
Ernest Hilvano
  • 503
  • 3
  • 8
  • 16
7
votes
3 answers

how to put ampersand (&) in a jdbc url?

I have a dynamic application with glassfish server and using EclipseLink (JPA 2.1). I used to could put jdbc configuration in the persistence.xml directly and didn't have any problem. But now it forces me to create a datasource name for glassfish…
Mustafa Shujaie
  • 1,447
  • 1
  • 16
  • 30
7
votes
2 answers

JPA multiple persistence units for dev/qa/stage/production

I've looked for answers for this but haven't been able to find any so asking these questions to this very apt community! I have a standalone java application that gets deployed in many environments: dev, qa, stage, production. As such each…
ustad
  • 459
  • 1
  • 6
  • 21
6
votes
5 answers

Maven using wrong version of javax.validation

I have a dynamic web project I have been working on that uses hibernate as a jpa provider. Up until the last week, I could insert, update, query, and delete from my databases using hibernate. Recently, I began working on validation, and brought in…
Connor Butch
  • 648
  • 1
  • 10
  • 28
6
votes
3 answers

JPA and toplink create-table on if they don't already exist?

Looks like jpa is something which makes me ask a lot of questions. Having added this my JPA application always creates tables when running, which results in exceptions in case the…
Nils
  • 13,319
  • 19
  • 86
  • 108
6
votes
1 answer

C3P0: unreturnedConnectionTimeout in production?

The parameter unreturnedConnectionTimeout times out unreturned connections after a given period of time. I'm trying to decide whether I should use this in my production persistence.xml? A big plus of using this is that the Connection Pool will be…
Monarch Wadia
  • 4,400
  • 4
  • 36
  • 37
6
votes
2 answers

Generate the JPA 2.0 metamodel via maven without persistence.xml?

Is there any way to generate the JPA 2.0 metamodel via maven without having a persistence.xml file. I'm using eclipselink. In my Java EE-projects I'm doing something like the following wich works fine because in that case I have a…
Christian Hager
  • 468
  • 6
  • 22
5
votes
3 answers

How to specify character encoding for h2 in memory database scripts?

I have troubles with character encoding in my JPA test class. In my h2 in memory database I have this insert query : INSERT INTO MYTABLE (ID,FIELD1,FIELD2) VALUES (100,'ABC','Réclamation'); (please notice the "é" character in "Réclamation") In my…
Sinda MOKADDEM
  • 796
  • 2
  • 12
  • 35
5
votes
2 answers

JPA 2.1 is not generating schema scripts

I started JPA 2.1 with Hibernate, and had the following lines in my persistence.xml
VHanded
  • 2,079
  • 4
  • 30
  • 55
5
votes
3 answers

JPA without persistence.xml

I'm trying to get started with using Guice Persist and JPA, which recommends using configuration via persistence.xml. Coming from a native Hibernate background where configuration was obtained programmatically, is there a simple way to configure a…
Kelvin Chung
  • 1,327
  • 1
  • 11
  • 23
1 2
3
34 35