eclipselink

Brainstorming: Weird JPA problem, possibly classpath or jar versioning problem?

吃可爱长大的小学妹 提交于 2019-12-12 07:07:28
问题 I'm seeing a weird error message and am looking for some ideas as to what the problem could be. I'm sort of new to using the JPA. I have an application where I'm using Spring's Entity Manager Factory (LocalContainerEntityManagerFactoryBean), EclipseLink as my ORM provider, connected to a MySQL DB and built with Maven. I'm not sure if any of this matters..... When I deploy this application to Glassfish, the application works as expected. The problem is, I've created a set of stand alone unit

Null Pointer Exception Entity Manager

 ̄綄美尐妖づ 提交于 2019-12-12 06:32:14
问题 I am getting a Null Pointer exception when i try to persist and Account. Turns out the entityManager is null but I can't figure out why. Here is the relevant code, any ideas? I have tried to do package com.test.bank2.account; import org.springframework.transaction.annotation.Transactional; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; @Transactional public class AccountRepositoryImpl implements AccountRepository{ @PersistenceContext(unitName =

Getting ClassNotFoundException org.eclipse.persistence.jpa.rs.resources.MetadataResource

柔情痞子 提交于 2019-12-12 06:16:17
问题 I'm trying to walk through the JPA-RS tutorials like: http://java.dzone.com/articles/introducing-eclipselink-jpa-rs or http://www.eclipse.org/eclipselink/documentation/2.5/solutions/restful_jpa.htm But after trying to deploy (using the maven and glassfish plugin) the application on my glassfish I get the following error stacktrace: WebModule[/rest]Servlet /rest threw load() exception java.lang.ClassNotFoundException: org.eclipse.persistence.jpa.rs.resources.MetadataResource at org.glassfish

Unexpected behaviour of EntityManager.merge()

人盡茶涼 提交于 2019-12-12 06:15:31
问题 I am using embedded glassfish (3.1.2.2) with junit (4.11), with JDK 1.7, though my source and target is set to 1.6 (maven-compiler-plugin configuration). Following is my code: Person.java @Entity public class Person implements Serializable { private static final long serialVersionUID = 81398385247591972L; @Id @GeneratedValue private Long id; @Version private Long version; @Column(length = 15, nullable = false, unique = true, updatable = false) private String username; @Column(length = 50)

EclipseLink Core 2.5.2 missing Import-Package javax.xml.bind

自闭症网瘾萝莉.ら 提交于 2019-12-12 06:14:04
问题 The EclipseLink bundle (org.eclipse.persistence/org.eclipse.persistence.core/2.5.2) is missing the import statement javax.xml.bind in its header entry of Import-Package . I get the same error described here: Glassfish 4 moxy eclipselink 2.5.2 oxm object graph troubles I add to declare javax.xml.bind as bootdelegated in OSGi, otherwise EclipseLink MOXy is not working properly. Is it possible to fix this? 回答1: Fixed this bug in EclipseLink 2.5.3. Also, EclipseLink 2.6.0 does not contain this

JPA EclipseLink ManyToMany with Data

℡╲_俬逩灬. 提交于 2019-12-12 05:12:56
问题 I'm currently trying to implement a ManyToMany Relationship with Data in the JoinTable. I'm following this approach with the Eclipselink JPA Framework. But I'm getting the following exception: org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:210) ... 23 more Caused by: Exception [EclipseLink-7298] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.ValidationException Exception Description:

use of EntityManagerFactory causing duplicate primary key exceptions

谁说胖子不能爱 提交于 2019-12-12 05:11:13
问题 Hey guys, my goal is create an EntityManager using properties dependent on which database is in use. I've seen something like this done in all my Google searches(I made the code more basic for the purpose of this question): @PersistenceUnit private EntityManagerFactory emf; private EntityManager em; private Properties props; @PostConstruct public void createEntityManager(){ //if oracle set oracle properties else set postgres properties emf = Persistence.createEntityManagerFactory("app-x"); em

Id generator in jpa (eclipselink) inheritance return random values

安稳与你 提交于 2019-12-12 04:55:45
问题 I'm using eclipselink in my web application (i use vaadin with oracle as DATABASE) but i'm facing a problem with the Id values. I have this simple schema : encaiss (@MappedSuperclass contains just Id) | | Encaissement (it extends encaiss so as to have the ID) / \ / \ Encaissement_Technique (extends Encaissement) Encaissement_espece / \ / \ Encaissement_Cheque Encaissement_Virement (both extend Encaissement_Technique to have the ID) When i create an instance of Encaissement_virement for

JPA 2.1 testing: persisting the pre-loaded data

ⅰ亾dé卋堺 提交于 2019-12-12 04:43:46
问题 I'm testing my JPA classes using Arquillian against "remote" containers (Glassfish 4 and WildFly 10, to be specific). I want to: Generate the database schema from the JPA entities' definitions (as opposed to SQL scripts). Pre-load some data to imitate "the data that was already there". For a most trivial example, to test if I can remove an entity without creating it in the same test first. Be able to perform queries, inserts, updates, deletes, etc. There are javax.persistence.* properties

SPRING, JPA(EclipseLink) with JTA Transaction Manager(JBoss 7) - NOT Committing to Database

淺唱寂寞╮ 提交于 2019-12-12 04:37:59
问题 I have created an example - SPRING, JPA(EclipseLink persistence provider) with JTA Transaction Manager(JBoss 7). I have observed that all the data in database is being shown in UI properly for the read operations. But when it comes to save/update or delete operation the services layer is not committing the work to database. No exception is caught(I have checked the console/log too and also debugged the code where I can see entityManager.persist/remove is being invoked without any exception).