jpa-2.0

How to implement a temporal table using JPA?

时光总嘲笑我的痴心妄想 提交于 2019-12-02 16:41:07
I would like to know how to implement temporal tables in JPA 2 with EclipseLink. By temporal I mean tables who define validity period. One problem that I'm facing is that referencing tables can no longer have foreign keys constraints to the referenced tables (temporal tables) because of the nature of the referenced tables which now their primary keys include the validity period. How would I map the relationships of my entities? Would that mean that my entities can no longer have a relationship to those valid-time entities? Should the responsability to initialize those relationships now do by

Stakover flow error with Jackson applied on JPA Entities to generate JSON

喜欢而已 提交于 2019-12-02 13:51:38
问题 I have a JPA code with OneToMany relationship. A Customer has a list of Item to check out. However, the code continue to generate StackOverflowError . Once, I had resolved this one by applying @JsonIgnore while fetching the List<Item> from Customer entity. But even that does not seem to work anymore. In Customer class: @OneToMany(mappedBy = "customer", orphanRemoval = true) @JsonIgnore private List<Item> items; In Item class: @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "CUSTOMER_ID"

Why cannot a JPA mapping attribute be a LinkedHashset?

荒凉一梦 提交于 2019-12-02 11:31:04
问题 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

DB2 + JPA throwing an error: column not found in the table

爱⌒轻易说出口 提交于 2019-12-02 07:50:12
The DB2-express is throwing an error that seems impossible, when JPA tries to persist an entity: ReportingSQLException: "ITEMID" is not valid in the context where it is used.. INSERT INTO NULLID."DynamicDatabaseTable" ("colname", "rownumber", "value") VALUES (?, ?, ?) [params=?, ?, ?] Since ITEMID is not used in the query above, how can this error be? The ITEMID is an auto-identity-generated column. I have tried executing manually the query and it works OK, so anybody know what's all about? Even after lot of googling, I'm totally clueless here. The database table in DB2 is fine, I have triple

EJB 3.1 Transaction, EntityManager

↘锁芯ラ 提交于 2019-12-02 07:32:56
I have an application which processes IQ stanzas via smack (eventbased java library). We now switch from vanilla Tomcat to glassfish 3.1 and i would like to switch to ejb 3.1. @Stateless public class DispatchIQService { private static Logger log = Logger.getLogger(DispatchIQService.class); @PersistenceContext(unitName="hq") private EntityManager em; .... public void process(XMPPConnection connection, IQ rawRequest) { log.debug("Raw Provider IQ: " + rawRequest.toXML()); RawResponse answer = null; try{ StateWrapper state = new StateWrapper(em, connection, rawRequest); // parsing raw xml from

2nd level cache invalidation with native queries

十年热恋 提交于 2019-12-02 07:21:51
I have an application that uses 2nd level cache on a JBoss AS 7 installation (Infinispan 2nd level cache provider). We have some update JPQL Queries that invalidate the cache- I wonder what will be the effect if we include some native SQL queries in our application. Will the Query cache be invalidated ? Also I remember using the sqlQuery.addSynchronizedQuerySpace("") instruction on Hibernate to prevent cache invalidation for some native SQL queries. Is it possible to do it also with JPA ? Thanks! I came across this question when dealing with the same problem today, so I thought I'd post my

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

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> <

Why is this JPA 2.0 mapping giving me an error in Eclipse/JBoss Tools?

一曲冷凌霜 提交于 2019-12-02 04:36:36
问题 I have the following situation: (source: kawoolutions.com) JPA 2.0 mappings ( It might probably suffice to consider only the Zip and ZipId classes as this is where the error seems to come from ): @Entity @Table(name = "GeoAreas") @Inheritance(strategy = InheritanceType.JOINED) @DiscriminatorColumn(name = "discriminator", discriminatorType = DiscriminatorType.STRING) public abstract class GeoArea implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name =

javax.persistence.EntityExistsException with SequenceGenerator

戏子无情 提交于 2019-12-02 03:46:07
I am inserting some records in Oracle DB. For the uniqueness, I am using SequenceGenerator. Below is the code: public class XxspPoInLineLocqty implements Serializable { @Id @SequenceGenerator(name = "SequenceLocIdGenerator", sequenceName = "LINE_LOCQTY_JPA_ID_SQ") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SequenceLocIdGenerator") @Column(name="LINE_LOCQTY_JPA_ID") private Long lineLocqtyJPAId; //other fields.. } XxspPoInLineLocqty is having @ManyToOne relation with XxspPoInLine. When I am persisting XxspPoInLine entity, I am receiving below error: javax.persistence