eclipselink

Problem with JPA, EclipseLink and case sensitive mysql

谁都会走 提交于 2019-12-10 14:28:48
问题 My application is working fine in a Windows environment, but when I'm trying to test in a linux server, I have a problem with the JPA EclipseLink sql generated. I created all my tables in lower case, but when I look in the logs, I see something like that, all in upper case: INSERT INTO PFC(ID, ALUMN,PROPOSED_ID) VALUES (?, ?, ?) mixed with others like this (sequences) in lower case: INSERT INTO buzonmensajes (mensajeid, buzonid) VALUES (?, ?) bind => [27, 1] and of course, everything goes

Cannot get EclipseLink MOXy to work

大憨熊 提交于 2019-12-10 13:25:34
问题 I'm new to JAXB and I want to change the default namespace prefix using EclipseLink MOXy. My package-info.java has the following code lines: @javax.xml.bind.annotation.XmlSchema ( namespace="http://namespace.mysite.com/", xmlns = { @javax.xml.bind.annotation.XmlNs(prefix="myns", namespaceURI="http://namespace.mysite.com/") }, elementFormDefault = javax.xml.bind.annotation.XmlNsForm.UNQUALIFIED ) package com.core.mymodel; And my jaxb.properties file has the following line: javax.xml.bind

Syntax error parsing a trivial query with JPA

感情迁移 提交于 2019-12-10 12:59:36
问题 I created the entity bean with netbeans wizard and am trying to get data from database. No matter what SQL query do I use,it doesn't work. I tried using named query that was created by wizard: @NamedQuery(name = "Usr.findAll", query = "SELECT u FROM Usr u") It returns: Caused by: Exception [EclipseLink-8025] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): org.eclipse.persistence.exceptions.JPQLException Exception Description: Syntax error parsing the query [Usr.findAll], line 1,

EclipseLink MOXy: Logical operators in XmlPath annotation

≯℡__Kan透↙ 提交于 2019-12-10 11:05:32
问题 Do logical operators work in XmlPath annotations of EclipseLink MOXy? I tried and could not make it work (no Exception is thrown and nothing is bound to "elements"). For example, I would like to have in a bindings file something like this: <java-type name="Content"> <java-attributes> <xml-element java-attribute="elements" xml-path="/a/b/ | /c/d" type="ElementType" container-type="java.util.List" /> </java-attributes> </java-type> Is there a way to achieve the same result from a modification

JPA database delimiters

流过昼夜 提交于 2019-12-10 09:45:44
问题 I have a two entity classes called User and Group, both reserved words that need to be delimited in order for the database to accept them as tables. Annotating the entities with: @Table(name = "\"USER\"") does the trick, but I read that EclipseLink allows you to specify a global that automatically delimits names. According to http://dev.eclipse.org/mhonarc/lists/eclipselink-users/msg03434.html, you need to include the following in orm.xml: <persistence-unit-metadata> <persistence-unit

EclipseLink with Spring - Can't persist into Db

↘锁芯ラ 提交于 2019-12-10 09:26:24
问题 I am using Spring + EclipseLink 2 to manage entity on a Derby database. Select object from db works fine but when I try to persist one, nothing happens. Program executes correctly and no exception are thrown. I probably did something wrong, as I'm not familiar with Spring, thanks for your comments and suggestions :) The ServerDaoDb method : @Transactional public void addServer(Server server) { EntityManager em = emf.createEntityManager(); emf.createEntityManager().persist(server); em.close();

JPA 2.1: Introducing Java 8 Date/Time API

旧城冷巷雨未停 提交于 2019-12-10 02:11:55
问题 I'd like to add support for the Java 8 Date/Time API (JSR-310) in my JPA-enabled application. It's clear that JPA 2.1 does not support the Java 8 Date/Time API. As a workaround, the most common advise is to use an AttributeConverter. In my existing application, I changed my entities to use LocalDate / LocalDateTime types for the column mapping fields and added legacy setter/getters for java.util.Date to them. I created corresponding AttributeConverter classes. My application does now fail

How to apply Static Weaving Ant Task with Eclipse-Link JPA in Netbeans?

大城市里の小女人 提交于 2019-12-10 02:04:22
问题 I am using Netbeans 7.1.1 and a Glassfish 3.1.2 server. As JPA provider I decided to use eclipse-link 2.3.0 which is shipped with Netbeans. Since I want to use lazy fetching and my project consists of roughly 45 JPA Entity classes which do have lots of relations among them, I decided to use static weaving . Moreover, the @Entity classes are in a separate Class Lib Project, whereas the persistence.xml resides in the EJB project. I already followed the instructions here: http://wiki.eclipse.org

How to order by count() in JPA

我怕爱的太早我们不能终老 提交于 2019-12-09 17:17:43
问题 I am using This JPA-Query: SELECT DISTINCT e.label FROM Entity e GROUP BY e.label ORDER BY COUNT(e.label) DESC I get no errors and the results are sorted almost correct but there are some values wrong (either two values are flipped or some single values are completly misplaced) EDIT: Adding COUNT(e.label) to my SELECT clause resolves this problem for this query. But in a similar query which also contains a WHERE clause the problem persists: SELECT DISTINCT e.label, COUNT(e.label) FROM Entity

how to use JPA life-cycle events to get entity data

拟墨画扇 提交于 2019-12-09 10:37:51
问题 I have a RESTful API that makes use of an entity class annotated with @EntityListners. And in the EntityListner.java, I have a method annotated with @PostPersist. So, when that event fires, I want to extract all the information regarding the entity that just got persisted to the database. But when I try to do that, Glassfish is generating an exception and the method in EntityListner class is not executing as expected. Here is the code public class EntityListner { private final static String