eclipselink

How do you use EclipseLink 2.3 as persistence provider in NB 7?

旧时模样 提交于 2019-12-02 09:53:43
I downloaded the latest EclipseLink 2.3 and want to give it a try. But I cannot find a way to choose EclipseLink 2.3 as a persistence provider in NB7. Here's what I did. 1. Go to my project's persistence.xml. In Design view-> Persistence Provider drop down menu -> New Persistence Library 2. I added the EclipseLink 2.3 jar files and gave it a name. 3. Hit OK. Nothing happened. It still shows "EclipseLink (JPA 2.)(Default) as my Persistence Provider. And I cannot find the newly created library in the drop down menu. (But if I go Project Properties->Libaries->Add Library I can see it got created)

ScrollableCursor from EclipseLink throws SQLException: The result set is closed. on remote env

人盡茶涼 提交于 2019-12-02 08:20:54
I have problem with ScrollableCursor. On my local environment it works well but on remote env I got exception: Internal Exception: java.sql.SQLException: The result set is closed. Error Code: 0 at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:340) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.processExceptionForCommError(DatabaseAccessor.java:1620) at org.eclipse.persistence.queries.ScrollableCursor.getPosition(ScrollableCursor.java:251) at org.eclipse.persistence.queries.ScrollableCursor.retrieveNextObject(ScrollableCursor.java

Jpa prepersist callback not called on parent

99封情书 提交于 2019-12-02 07:40:19
问题 My code @Entity @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) public class SiteMessage implements Identifiable{ @PrePersist public void onCreate1(){ System.out.println("Executed onCreate1"); } } @Entity @Table(name = "feedback") public class Feedback extends SiteMessage { @PrePersist public void onCreate2(){ System.out.println("Executed onCreate2"); } } When i save Feedback entity i expect that i will see: Executed onCreate1 and Executed onCreate2, but i've seen only Executed

JPQL “NOT MEMBER OF” query using criteria API

此生再无相见时 提交于 2019-12-02 07:25:09
Given the following JPA annotated entity classes: @Entity @Table("foo") public class Foo { @Id private int id; @Column(name="name") private String name; @ManyToMany @JoinTable(name = "foo_tags", joinColumns = {@JoinColumn(name = "foo")}, inverseJoinColumns = {@JoinColumn(name = "tag")}) private Collection<Tag> tags; ... } @Entity @Table(name = "tag") public class Tag { @Id private String tag; ... } I'm trying to formulate a query to get all Foo instances that lack a given tag. The following JPQL query does the trick SELECT f FROM Foo f WHERE :tag NOT MEMBER OF f.tags However, I'm having

Why cannot a JPA mapping attribute be a LinkedHashset?

若如初见. 提交于 2019-12-02 06:56:17
Motivated by this question, I've tried to change the following: @ManyToMany(cascade={CascadeType.REMOVE, CascadeType.MERGE}) private Set<Expression> exps = new LinkedHashSet<Expression>(); to: @ManyToMany(cascade={CascadeType.REMOVE, CascadeType.MERGE}) private LinkedHashSet<Expression> exps = new LinkedHashSet<Expression>(); However, such a move results in: Exception [EclipseLink-1] (Eclipse Persistence Services - 2.1.0.v20100614-r7608): org.eclipse.persistence.exceptions.DescriptorException Exception Description: The attribute [exps] is not declared as type ValueHolderInterface, but its

Limitation of JPA 1.0 using @IdClass with *nested* composite primary keys?

无人久伴 提交于 2019-12-02 06:45:48
问题 Given the following example (departments - projects): A department has the following properties (composite primary key): @Entity @IdClass(DeptId.class) public class Department { @Id @Column(name="number") private Integer number; @Id @Column(name="country") private String country; @Column(name="name") private String name; @OneToMany(mappedBy="dept") private Collection<Project> projects; ... } Here the PK class: public class DeptId implements Serializable { private Integer number; private

Does Eclipselink support queries containing regular expression?

萝らか妹 提交于 2019-12-02 06:32:36
问题 I've seen that DBMS like MySQL supports query containing regular expressions. Does Eclipselink support this? I have to retrieve entities having some String attribute matching some regular expression as SELECT X FROM Person X WHERE X.name <some keyword> (A-Z)* 回答1: MySQL uses REGEX or RLIKE for regular expression queries. JPQL does not support these operators, so you can use a native SQL query. In EclipseLink you could define your own ExpressionOperator for these, and use it in an Expression

What collections does jpa return?

核能气质少年 提交于 2019-12-02 06:27:59
Does JPA ( Eclipselink in this case) always return IndirectList where Entity have a List? Is ok that list or It should be converted to another list( maybe linkedlist)? Analysis If we look at EclipseLink's IndirectList's API , it says: To use an IndirectList: declare the appropriate instance variable with type IndirectList (jdk1.1) or Collection/List/Vector (jdk1.2). TopLink will place an IndirectList in the instance variable when the containing domain object is read from the datatabase. With the first message sent to the IndirectList, the contents are fetched from the database and normal

QueryDSL duplicate identification variable/equality syntax error with any on Set?

人盡茶涼 提交于 2019-12-02 05:43:17
I have JPA entities as outlined here: QueryDSL JPA syntax error with contains on Set? Now I try to have multiple restrictions on the Set tags in a single query: Set<Tag> withTags = ...; Set<Tag> withoutTags = ...; q.where(license.tags.any().in(withTags)); q.where(license.tags.any().in(withoutTags).not()); When the query is executed I get the following exception: Exception [EclipseLink-8019] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): org.eclipse.persistence.exceptions.JPQLException Exception Description: Error compiling the query [select distinct license from License license where

Flexible marshalling with JAXB

别等时光非礼了梦想. 提交于 2019-12-02 05:15:43
问题 I'm hoping to have a flexible way of marshalling objects. A verbose version for single objects and a less-verbose version for multiple object versions. For example, consider my department model: GET /locations/1: <location id='1'> <link rel="self" href="http://example.com/locations/1"/> <link rel="parent" href="http://example.com/serviceareas/1"/> <name>location 01</name> <departments> <department id='1'> <link rel="self" href="http://example.com/departments/1"/> <name>department 01</name> <