persistence.xml

How to work with javax.persistence.sql-load-script-source?

这一生的挚爱 提交于 2019-12-08 02:34:29
问题 I want to automatically insert data into my MySQL tables. Therefore I try to use the JPA property "javax.persistence.sql-load-script-source" in my persistence.xml : <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="my-PU" transaction

Deployed war to tomcat can't throws java.lang.NoClassDefFoundError: javax/persistence/PersistenceException

为君一笑 提交于 2019-12-07 21:58:11
问题 I'm new to this forum and also new to JPA / EJB. I'm trying to deploy a .war file containing a small application to a tomcat server. The application is using JTA to communicate with the Derby db. When I run and deploy the application from and eclipse top the tomcat server running in eclipse, everything works perfect, but when I export a .war file and try to browse the application it throws an java.lang.ClassNotFoundException: javax.persistence.PersistenceException. My persistence file looks

It is possible to override properties in a persistence.xml that is located in a jar dependency

烈酒焚心 提交于 2019-12-07 13:34:05
问题 I have a java-ee web application that uses a persistence unit that is packaged as a jar dependency (Entity classes, EJB repositories, persistence.xml). In order to get some acceptance tests running for the web application i need to override a property in the packaged persistence.xml. To be specific i need to disable the by default active eclipselink shared object cache by setting the following property. <property name="eclipselink.cache.shared.default" value="false"/> This is necessary

How to externalize properties of persistence.xml for JBOSS 7.1.1?

筅森魡賤 提交于 2019-12-06 16:28:29
My persistence.xml is currently present in the application war(in META-INF folder.). However, for the application to be run across multiple DBs the persistence needs to be changed again and again. I want to avoid it. But, I am not able to understand how will i configure the properties(like dialect) in the persistence.xml from, say, a property file which i would change based on my DB, hence not compelling me to update and redeploy my war. My problem can also be resolved if i can configure the dialect in the datasource in standalone.xml where i have mentioned other DB details. I am not being

META-INF/persistence.xml cannot be opened because it does not exist

爷,独闯天下 提交于 2019-12-06 14:44:53
I'm creating a basic spring-maven project that should run as a java application (in process, not over a web server). My application context resides under the resources folder which is in my classpath: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:ox="http://www

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

删除回忆录丶 提交于 2019-12-06 14:37:37
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]. Premature end of file. curl -v http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd * Trying 2600:1402:f000:392::f6b... * TCP_NODELAY set * Connected to xmlns.jcp.org (2600:1402:f000:392::f6b) port 80 (#0) > GET /xml/ns/persistence/persistence_2_1.xsd HTTP/1.1 > Host: xmlns.jcp.org > User-Agent: curl/7.54.0 > Accept: */* > < HTTP/1.1 301 Moved

How to work with javax.persistence.sql-load-script-source?

回眸只為那壹抹淺笑 提交于 2019-12-06 14:05:09
I want to automatically insert data into my MySQL tables. Therefore I try to use the JPA property "javax.persistence.sql-load-script-source" in my persistence.xml : <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="my-PU" transaction-type="JTA"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> <jta-data-source>jdbc

Glassfish 3.1.2 “Could not resolve a persistence unit corresponding to the persistence-context-ref-name”

a 夏天 提交于 2019-12-06 12:59:41
My project has the following structure: EAR (derp.ear) | |____ derp-ui.war | |____ busctrl.jar | |____META-INF | | _______ persistence.xml (persistence name of "DEJPA") The persistence.xml file: <?xml version="1.0" encoding="UTF-8" ?> <persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"> <persistence-unit name="DEJPA" transaction-type="JTA"> <provider>org.eclipse.persistence.jpa.PersistenceProvider<

Deployed war to tomcat can't throws java.lang.NoClassDefFoundError: javax/persistence/PersistenceException

强颜欢笑 提交于 2019-12-06 11:18:51
I'm new to this forum and also new to JPA / EJB. I'm trying to deploy a .war file containing a small application to a tomcat server. The application is using JTA to communicate with the Derby db. When I run and deploy the application from and eclipse top the tomcat server running in eclipse, everything works perfect, but when I export a .war file and try to browse the application it throws an java.lang.ClassNotFoundException: javax.persistence.PersistenceException. My persistence file looks like this: <?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns

Create Entity Manager Factory without persistence.xml

左心房为你撑大大i 提交于 2019-12-06 10:46:33
问题 Is there a way to create the EntityManagerFactory without a persistence unit defined ? Can you give all the required properties to create an entity manager factory? I need to create the EntityManagerFactory from the user's specified values at runtime. Updating the persistence.xml and recompiling is not an option. Currently I am using eclipselink dynamic persistence so i need to create the EntityManagerFactory without a persistence unit defined ? I have groups of runtime entities that need to