persistence.xml

InvocationTargetException: javax/persistence/Persistence

不问归期 提交于 2019-12-11 04:29:45
问题 Im trying to follow the example in chapter 2 of the book Beginning Java EE 6 Platform with GlassFish 3. I am using EclipseLink, Derby and Maven from cmd in Windows. I really can't figure this out and would be grateful for some help! This line EntityManagerFactory emf = Persistence.createEntityManagerFactory("chapter02PU"); in my Main.java class generates the following error: [INFO] Error stacktraces are turned on. [INFO] Scanning for projects... [INFO] [INFO] ---------------------------------

eclipselink without persistence.xml

谁说胖子不能爱 提交于 2019-12-11 03:55:48
问题 I'm not a big fan of XML files. Therefore I'm wondering if there is a way to use eclipselink without its persistence.xml configuration file. Why? Because I want to manage different databases dynamically. It would be much easier to do it without the XML file. I'm surprised that I couldn't find anything on the web for now. 回答1: Not really, but you could create an EclipseLink ServerSession directly and wrap it with an EntityManagerFactoryImpl, but I would not suggest it. You would be better off

No Persistence provider for EntityManager named… error [duplicate]

心不动则不痛 提交于 2019-12-11 03:34:47
问题 This question already has answers here : No Persistence provider for EntityManager named X (6 answers) Closed 5 years ago . My persistence xml file is like that <?xml version="1.0" encoding="UTF-8"?> <persistence 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_1_0.xsd" version="1.0"> <persistence-unit name="hibernateEbru"> <provider

Can't find persistence unit and reverse engineering tools

寵の児 提交于 2019-12-11 02:58:36
问题 I'm currently creating my entities and DAO with Hibernate Tools and reverse engineering. My config is Eclipse Indigo, JBoss AS7, Hibernate Tools 3.4 and Hibernate 4. The problem is when I try to deploy my .jar to JBoss AS7 I get this : http://pastebin.com/1hvHBM7z And more precisely : Can't find a persistence unit named null in deployment "businessLayer.jar" Now, I searched about this issue and it suggests I should have a persistence.xml file under META-INF. The thing is, the generation didn

it's possible configure a persistence.xml for multiple data sources?

北慕城南 提交于 2019-12-10 23:58:13
问题 hi i just want to know how configure in a persistence.xml two datasources one of the data sources have a jar outside from the other. I'm tried but i really don't if it's possible 回答1: Yeah, you can have two datasources configured in a persistence.xml. You would just need two separate elements. <persistence> <persistence-unit name="datasourceOne"> <jta-data-source>java:/DefaultDS</jta-data-source> <jar-file>../MyApp.jar</jar-file> <class>org.acme.Employee</class> <class>org.acme.Person</class>

Spring Cannot find class [org.hibernate.ejb.HibernatePersistence]

别等时光非礼了梦想. 提交于 2019-12-10 12:54:28
问题 Im working on a java spring project on eclipse, and while Im trying to run the project through a JUnit test, I get and error : Cannot find class [org.hibernate.ejb.HibernatePersistence] . I looked for a lot of similar problems and no one could resolve mine. I build and rebuild the project properly but still the same problem. First this my JUnit test : @Test public void test() { try { ClassPathXmlApplicationContext app = new ClassPathXmlApplicationContext( new String[] { "applicationContext

Hibernate Error java.lang.NoSuchMethodError

匆匆过客 提交于 2019-12-09 19:57:50
问题 I'm using Jersey as Rest web service and Hibernate entity manager to persist JPA models. and I'm using Tomcat 8 as container. Here is the content of the persistence.xml file : <persistence 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" version="2.0"> <persistence-unit name="manager1" transaction-type="JTA"> <properties> <!

Problems with generating sql via eclipseLink - missing separator

♀尐吖头ヾ 提交于 2019-12-09 02:47:35
问题 i'am using eclipseLink with jpa. in my persistence.xml, i defined to generate a create.sql file. the file will be generated, but with missing ';'-separators for each sql statement. is there a possibility to define a separator in the persistence.xml or in some other way? Example persistence.xml: <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> <exclude-unlisted-classes>false</exclude-unlisted-classes> <class>de.company.project.models.User</class> <properties> <property name

Play framework 2 + JPA with multiple persistenceUnit

不想你离开。 提交于 2019-12-08 13:04:06
问题 I'm struggling with Play and JPA in order to be able to use two different javax.persistence.Entity model associated to two different persistence units (needed to be able to connect to different DB - for example an Oracle and a MySQL db). The problem come from the Transaction which is always bind to the default JPA persitenceUnit (see jpa.default option). Here is two controller actions which show the solution I found to manually define the persistence : package controllers; import models

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

风格不统一 提交于 2019-12-08 07:53:03
问题 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