eclipselink

Subqueries in select in eclipselink

放肆的年华 提交于 2021-01-28 04:38:47
问题 According to EclipseLink documentation it supports subqueries in the select clause (even if JPA doesn't require it). When I try to use this feature in JPA Criteria API: myCriteriaQuery .multiselect(Arrays.asList(mySubquery, ...)) .where(...) there is an error: java.lang.ClassCastException: org.eclipse.persistence.internal.jpa.querydef.SubQueryImpl cannot be cast to org.eclipse.persistence.internal.jpa.querydef.SelectionImpl at org.eclipse.persistence.internal.jpa.querydef.CriteriaQueryImpl

Eclipselink - @CascadeOnDelete doesn't work on @OneToOne relations

故事扮演 提交于 2021-01-27 18:17:20
问题 I have two relations in my class: @OneToOne(mappedBy = "poi", cascade = { CascadeType.ALL }) @CascadeOnDelete protected PoiDescription description; @OneToMany(mappedBy = "poi", cascade = { CascadeType.ALL }) @CascadeOnDelete protected List<PoiAdditional> additionals = new ArrayList<>(); In my generated DDL (for postgres) I becomes: ALTER TABLE POI_DESCRIPTION ADD CONSTRAINT FK_POI_DESCRIPTION_POI_ID FOREIGN KEY (POI_ID) REFERENCES POI (ID) ALTER TABLE POI_ADDITIONAL ADD CONSTRAINT FK_POI

Eclipselink - @CascadeOnDelete doesn't work on @OneToOne relations

时光总嘲笑我的痴心妄想 提交于 2021-01-27 18:05:27
问题 I have two relations in my class: @OneToOne(mappedBy = "poi", cascade = { CascadeType.ALL }) @CascadeOnDelete protected PoiDescription description; @OneToMany(mappedBy = "poi", cascade = { CascadeType.ALL }) @CascadeOnDelete protected List<PoiAdditional> additionals = new ArrayList<>(); In my generated DDL (for postgres) I becomes: ALTER TABLE POI_DESCRIPTION ADD CONSTRAINT FK_POI_DESCRIPTION_POI_ID FOREIGN KEY (POI_ID) REFERENCES POI (ID) ALTER TABLE POI_ADDITIONAL ADD CONSTRAINT FK_POI

Navigation method/s in criteria fetch joins in JPA 2.1

江枫思渺然 提交于 2021-01-27 17:10:48
问题 While using fetch joins in JPA criteria, there is no navigation method can be seen. Given below an example. Root<UserTable> root = criteriaQuery.from(entityManager.getMetamodel().entity(UserTable.class)); Fetch<UserTable, StateTable> fetch = root.fetch(UserTable_.stateTable, JoinType.INNER); To navigate through the entity in question, this Fetch type is required to be cast to a join like as follows. Join<UserTable, StateTable> join = (Join<UserTable, StateTable>) root.fetch(UserTable_

Database creation not working in eclipselink with glassfish 4 and Postgres

别来无恙 提交于 2021-01-27 13:11:33
问题 I want to create the database based on Entities. Configuration: Glassfish: GlassFish Server Open Source Edition 4.1 (build 13) Eclipselink: Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd (delivered with glassfish) Database: PostgreSQL Version: 9.4.2 Driver: PostgreSQL Native Driver Version: PostgreSQL 9.4 JDBC4.1 (build 1201) From the moment eclipselink starts creating the database I see the following statements in the logs after putting a lot of log parameters on finest: SELECT ID

JPA eclipse two foreign keys @IdClass implementation errors

跟風遠走 提交于 2021-01-05 08:55:52
问题 I'm very new to Java EE and JPA/Eclipselink, so please bear with me. I'm trying to create a @Id for a table with no primary key and two composite keys, I tried to apply from a solution I read here by using @IdClass to mark the two foreign keys as a composite key, but I get this error when compiling and deploying the server. Exception Description: Invalid composite primary key specification. The names of the primary key fields or properties in the primary key class [com.owl.server.objects

org.eclipse.persistence.indirection.IndirectMap cannot be cast to org.eclipse.persistence.queries.FetchGroupTracker using EclipseLink

﹥>﹥吖頭↗ 提交于 2020-12-15 04:55:33
问题 I have the following design: One sports game has two scores (one per team) and each score has multiple player stats, one per jersey number. Both relationships are mapped as Map . This is just multi-level aggregation. Game entity: @Entity @Table(name = "\"Games\"") @NamedQuery(name = Game.FIND_ALL, query = "SELECT ga FROM Game ga") @NamedEntityGraph(name = Game.FETCH_SCORES, attributeNodes = {@NamedAttributeNode("scores")}) @NamedEntityGraph(name = Game.FETCH_SCORES_AND_PLAYER_STATS,

JPA: EntityGraph and map

拟墨画扇 提交于 2020-12-13 18:46:05
问题 I use EclipseLink 2.6.3 as JPA provider. I have two entities: @Entity public class ClassA{ @Id private String uuid; private String comment; @OneToMany(fetch = FetchType.EAGER,cascade = CascadeType.ALL,mappedBy = "classA",orphanRemoval = false) @MapKey(name="code") private Map<String,ClassB> texts; //+ getters and setters } @Entity public class ClassB { @Id private String uuid; private String code; private String name; @ManyToOne @JoinColumn(name = "comeColname") private ClassA classA; //

JPA: EntityGraph and map

痴心易碎 提交于 2020-12-13 18:44:01
问题 I use EclipseLink 2.6.3 as JPA provider. I have two entities: @Entity public class ClassA{ @Id private String uuid; private String comment; @OneToMany(fetch = FetchType.EAGER,cascade = CascadeType.ALL,mappedBy = "classA",orphanRemoval = false) @MapKey(name="code") private Map<String,ClassB> texts; //+ getters and setters } @Entity public class ClassB { @Id private String uuid; private String code; private String name; @ManyToOne @JoinColumn(name = "comeColname") private ClassA classA; //