persistence.xml

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 jndi.properties 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

EntityManagerFactory not being injected using @PersistenceUnit

送分小仙女□ 提交于 2019-12-24 16:25:02
问题 I'm a java beginner. I'm in trouble to configure a persistance unit using JTA transactions. I need to use a PostgreSQL database that is already defined, configured and populated. Using netbeans, i created the persistance.xml and glassfish-resources.xml as fallows: <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

Different persistence units for different Maven profiles

元气小坏坏 提交于 2019-12-24 09:07:11
问题 I want to use two different databases depending on the selected Maven profile. For the profile "production" I want to use a MySQL database and for the "development" profile I want to use an in-memory HSQLDB. I found out that it is possible to have two persistence.xml files. One in "src/main/resources/META-INF" and the other one stored in "src/test/resources/META-INF". This gives the possibility to choose a different database for testing. But is it also possible to do the database selection

How to implement Spring's @Transactional Annotation using Hibernate, HikariCP and persistence.xml

我的梦境 提交于 2019-12-24 07:58:59
问题 I need to implement Spring's @Transactional annotation but I'm not being able to do so. I had tried a lot of methods in the past 3 weeks but none of them worked. I'm also need to use EntityManager. To test if Spring's was working, I tried to inject the EntityManager using @PersistenceContext (I also tried using @PersistenceUnit and/with EntityManagerFactory) but always I got nullPointerException. @PersistenceContext(unitName = "sistema") protected EntityManager entityManager; Basically I need

How to specify a jdbc.url in the persistence.xml relative to the application folder?

大城市里の小女人 提交于 2019-12-24 07:29:08
问题 Once I deploy my application with JPA the user chooses to install it somewhere. Then however the property set as: <property name="javax.persistence.jdbc.url" value="jdbc:derby:db;create=true"/> gets interpreted into the following exception: couldn't create database in \db. Throughout development it used to be the relative path to the project folder, and not the root as it's now. What should I do to make the path remain relative to the folder in which the application is installed? Or at the

Persistence deployment issue

谁说我不能喝 提交于 2019-12-23 05:32:15
问题 I have a hibernate project, which uses JPA. my persistence.xml contents is as follows: <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="Demo-PU" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <non-jta-data-source>java:/DemoDS<

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

三世轮回 提交于 2019-12-22 17:23:26
问题 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

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

旧巷老猫 提交于 2019-12-22 17:23:09
问题 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