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

Multiple persistence unit on Wildfly

I'm using JPA with Wildfly and I am connecting to multiple databases. Below is the persistence.xml - java:jboss/datasources/ContiegoDS
Víctor Cardozo
  • 153
  • 2
  • 13
0
votes
0 answers

Can't use EntityManagerFactory twice for a database in test environment

For test purposes I want to populate the category table with test data. Which works fine. But when I want to populate another table named products then an error occurs. And it's because of the following line (I discovered it by uncommenting the…
superkytoz
  • 1,267
  • 4
  • 23
  • 43
0
votes
0 answers

Schemas generation through JPA 2.1 EclipseLink

I am trying to understand all the properties for schemas generation of JPA 2.1 using EclipseLink implementation and a Mysql database, but I had several bugs easy to explain but difficult to debug Here is my persistence.xml document
0
votes
1 answer

Where to put persistence.xml in a Eclipse EJB Gradle project?

a) If I put persistence.xhtml in src/main/java/META-INF/ Gradle won't include it in generated jar file, as it is not a java file. b) If I put it in src/main/resources/META-INF/ Gradle will include it in generated jar file but Eclipse will complain…
icordoba
  • 1,834
  • 2
  • 33
  • 60
0
votes
0 answers

Only one entity generated in database [jee]

i am new in jee i create two entities with different namedquery. when i run my application on wildfly 10, only one entity generated in the data base despite when i check my console i find my two entities in jndi. this is my two…
Hamdy
  • 430
  • 1
  • 6
  • 19
0
votes
1 answer

How to use EJB 3 with persistence unit on a JBoss AS?

I have a JBoss AS, and on this server there is a standalone.xml file where there several properties, there are my datasources too, so how combine the datasources in the standalone.xml file with a persistence unit that I want to add to an EJB ?
0
votes
0 answers

JPA specify multiple sql-load-script-source

I need to fill my database on ear startup, so I add javax.persistence.sql-load-script-source tag with reference to the file.
Daniele Licitra
  • 1,520
  • 21
  • 45
0
votes
2 answers

How to use DB2 JDBC driver with Hibernate

I keep getting java.lang.ClassNotFoundException: Could not load requested class : com.ibm.db2.jcc.DB2Driver when trying to connect to a DB2 database using Hibernate. The driver jar is referenced as an external library: Image of Eclipse's…
Tim
  • 13
  • 4
0
votes
1 answer

weblogic 12c The processing instruction target matching "[xX][mM][lL]" is not allowed

I am migrating an ejb 1.0 app to ejb 3.1 app. The current app is running in WebLogic Server Version: 12.1.3.0.0 on jdk 8. For POC I have chosen one session bean and one entity bean and have upgraded to 3.1 by providing updated ejb-jar.xml, orm.xml…
donlys
  • 440
  • 6
  • 13
0
votes
0 answers

the config in persistence.xml can not get value from spring cloud config

I encounter wired issue when I use spring cloud config. And I config a para in persistence.xml, and can not get value with spring cloud config when I start my app. Error creating bean with name 'dataSource' defined in URL …
twocool
  • 11
  • 3
0
votes
1 answer

JBoss7.1.0: Can't find a persistence unit named null in subdeployment

I have a project with 3 modules inside: factory-ear, factory-ejb and factory-web. It deployed to JBoss7 as EAR with ejb.jar and web.war inside. When I trying to get EntityManager in my EJB class @PersistenceContext(unitName = "manager1") private…
evgeny_s
  • 391
  • 1
  • 6
  • 17
0
votes
1 answer

SpringMVC + JPA + Cannot find the declaration of element 'persistence'

I am getting the " Cannot find the declaration of element 'persistence' exception. I tried the solution given at OpenJPA 2.1.1 - Cannot find the declaration of element 'persistence' but it did not work. Below are the details of my project. I have…
Ash Ash
  • 443
  • 4
  • 7
  • 15
0
votes
0 answers

Can you specify an orm.xml without a supporting persistence.xml?

I'm very new to Spring and JPA so I'll try a different approach to ask this question: Given that there is a persistence.xml and persistence unit defined in separate jar (call it "core.jar"). In the project/app that I am developing, which includes…
markb
  • 55
  • 5
0
votes
1 answer

Use persistence.xml declared in different module

I'm using different separated modules in my app .. jpa-module : contains the JPA entities and the persistence.xml rest-module : where I'm using JAX-RS services and Hibernate to persist the data ... I'm injecting the entitymanager using Guice,…
Mohamed Taboubi
  • 6,663
  • 11
  • 55
  • 87
0
votes
0 answers

OSGI JPA Persistence - Handling multiple model bundles persistence.xml

In my project i have a persistence bundle which will perform the create/update/delete operations and multiple model bundles. persistence bundle: PersistenceService.java - Exposed as a service. PersistenceServiceImpl.java persistence.xml -…