EclipseLink JPA - location of persistence.xml

不羁岁月 提交于 2020-02-26 12:38:26
问题 I am using JPA for a java class and having trouble putting the persistence XML file where it should be. The IDE i am using is Eclipse Helios. Eclipselink jar files are downloaded and added to my JRE System Library and all. I wrote up the persistence.xml with the tag after getting the following error : Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named customers Provider tag: <provider>org.eclipse.persistence.jpa

How to get Hibernate dialect during runtime

丶灬走出姿态 提交于 2020-01-24 02:29:06
问题 In my application, I use Hibernate with SQL Server database, so I set <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"> in my persistence.xml. In some case, I want to sort records with NULL include, I use keyword NULLS FIRST. Because it is not supported by default by CriteriaQuery/CriteriaBuilder in Hibernate, then I use Interceptor to modify the native query. The problem is, keyword NULLS FIRST is not supported in SQL Server, so I use keyword: case when

OpenJPA 2.1.1 - Cannot find the declaration of element 'persistence'

若如初见. 提交于 2020-01-14 10:32:39
问题 I just downloaded to use OpenEJB with OpenJPA2.1.1. I can't get my persistence.xml working. The top of the stack trace: org.xml.sax.SAXException: file:/D:/Workspaces/sandbox/tomcat_ejb_jpa2_tomEE/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/testEE/WEB-INF/classes/META-INF/persistence.xml [Location: Line: 2, C: 248]: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the

How can I make a JPA application access different databases?

拟墨画扇 提交于 2020-01-09 05:33:10
问题 I'm writing a Java SE (desktop) application that has to access different databases all of which will have the same data model (same schema, tables, etc.). I want to reuse the JPA Entities that I already use in a Java EE application that front each database. To reuse the existing entity.jar file I'll have to repackage it with a different persistence.xml that has a resource_local data source. That's an build time inconvenience but not a big problem. The problem is that my desktop application

Spring Persistence archive and entitymanager is null when accessing from web-application

孤街醉人 提交于 2020-01-05 04:41:06
问题 I've created a jar file through spring roo (maven project - persistence archive) unit tests are running fine, the concerned files are on the following location jarFile/META-INF/persistence.xml jarFile/META-INF/applicationContext.xml jarFile/META-INF/applicationContext-jpa.xml jarFile/META-INF/ Unit tests are running fine. Because its a maven project I added it to local repository by executing the command "mvn install" and after that I added it as a dependency to another

Cannot call JNDI resource in persistence.xml file

空扰寡人 提交于 2020-01-04 11:44:28
问题 Although it seems many users faced the same problem, I have to post my own issue, taking in account that for now, no suggestion from those already present worked for me. Or maybe am I missing something? Here is my persistence.xml file (located uner resources/META-INF/ directory, in a maven project): <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="" xmlns:xsi="" xsi:schemaLocation="http:/

Eclipse - How to fix error “No persistence.xml file found in project” JPA issue

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-30 04:00:09
问题 Error "No persistence.xml file found in project" in Eclipse. Aim: Create a new project GWT+App engine+Maven Steps to create this: Google eclipse plugin: select "New Web Application Project". set the name etc. right-click on the project > Configure > Convert to Maven... Fix jdoconfig.xml file: xsi has the wrong value. see Validating jdoconfig with incorrect url Then I get the above error. The file exists at scr/META-INF/persistence.xml and also war/WEB-INF/classes/META-INF/persistence.xml But

JPA: configure persistence provider

天涯浪子 提交于 2019-12-25 11:57:03
问题 I got a simple java project created with maven (quickstart archetype) I am trying to configure JPA persistence for drools sessions (the code comes from drools documentation) I added drools-persistence-jpa, Bitronix Transaction Manager and com.h2database dependencies to my pom.xml I created a META-INF folder as Source-Folder in my Eclipse Project in "src/META-INF" I added the persistence.xml and file there. In my TestCase I have following code: [...] EntityManagerFactory emf =

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

北慕城南 提交于 2019-12-25 07:59:05
问题 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 EntityManager em; I get error JBAS011440: Can't find a persistence unit named manager1 in subdeployment "factory-ejb-1.0-SNAPSHOT.jar" of deployment "factory.ear" My persistence.xml <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0"

Maven EAR multimodule project not packaging persistence.xml

别说谁变了你拦得住时间么 提交于 2019-12-25 07:26:52
问题 I`m working in a EAR project with Maven which has 2 modules. Images speaks louder than words, so let me show you the structure: Parent pom project and modules sigea-model contains model, repository and service layers (The "M" in MVC ). sigea-web contains web pages and controller beans ( VC ) and sigea-ear is just a wrapper to package the other 2 modules in a EAR package. Configuration files in modules As you can see, sigea-ear has an empty META-INF folder. Both beans.xml files in sigea-model