eclipselink

How to handle java.util.Date with MOXy bindings file

这一生的挚爱 提交于 2021-02-20 17:55:52
问题 i'm new to MOXy and JaxB in general and I'm facing a problem with java.util.Date conversion. I'm unmarshaling an XML file (which I have no control of) to objects using a mapping file (I can neither manually annotate existing classes nor change them). My XML mapping file looks like this : <?xml version="1.0"?> <xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm" version="2.1"> <java-types> <java-type name="Observation"> <xml-type prop-order="date theoricalTime ci ch cr

How to handle java.util.Date with MOXy bindings file

♀尐吖头ヾ 提交于 2021-02-20 17:54:19
问题 i'm new to MOXy and JaxB in general and I'm facing a problem with java.util.Date conversion. I'm unmarshaling an XML file (which I have no control of) to objects using a mapping file (I can neither manually annotate existing classes nor change them). My XML mapping file looks like this : <?xml version="1.0"?> <xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm" version="2.1"> <java-types> <java-type name="Observation"> <xml-type prop-order="date theoricalTime ci ch cr

eclipselink static weaving with final fields on Java 9

不打扰是莪最后的温柔 提交于 2021-02-19 01:56:41
问题 I have some JPA annotated fields declared final like this: @Column(name = "SOME_FIELD", updatable = false, nullable = false) private final String someField; Those fields are stored in the database when the entity is inserted in the database. They cannot further be updated. For the Java programming language, such fields can be considered final. With the EclipseLink static weaving plugin, it's possible to lazy load entities, owing to some byte code instrumentation. I don't know if such

Eclipse does not show EclipseLink platform in JPA configuration [closed]

左心房为你撑大大i 提交于 2021-02-18 17:00:20
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . Improve this question I'm trying to set up JPA facet. All tutorials online state that I should select EclipseLink platform and not Generic. The thing is in my eclipse only Generic appears. I've installed Eclipse Web tools hoping that it would appear but looks like I need to add

Merge an entity, change its id, merge again, cause “mapped to a primary key column in the database. Updates are not allowed” error

百般思念 提交于 2021-02-18 05:20:44
问题 I have a JPA program where EclipseLink is the Persistence provider. When I merge an user entity, change its ID, and try to merge the same user instance again, an error is thrown. I rewrite my code to illustrate my problem in the simplest way. User user = userManager.find(1); userManager.merge(user); System.out.println("User is managed? "+userManager.contains(user); user.setId(2); userManager.merge(user); The above code is not in a transaction context. userManager is a stateless session bean

JPA Entity class giving error with 2 @GeneratedValue fields

霸气de小男生 提交于 2021-02-17 05:11:12
问题 I have two columns which will use @GeneratedValues, but when I am putting them like this it is giving error; " Exception Description: Class [class Testing] has two @GeneratedValues: for fields [Testing.SEQ_NO] and [Testing.ID]. Only one is allowed. " @Table(name = "TABLE1") @Entity public class Testing{ @GeneratedValue(strategy=GenerationType.AUTO) @Id private Long id; @Column(name = "LINKAGE_ID") private int linkageId; @Column(name = "TRANSFER_ID") private int transferId; @Column(name =

EclipseLink / JPA: How to programmatically get the number of SQL queries that have been performed

▼魔方 西西 提交于 2021-02-07 13:34:48
问题 I'm using JPA, by way of EclipseLink. In my unit tests, I'd like to test how many SQL queries were performed during an operation. That way, if a later modification causes the query count to explode (if lazy loading is triggered, for instance), the unit test will flag it as potentially needing optimization. I'm striking out in finding the correct API to do this. A pure-JPA solution would be ideal, but I'm fine with using EclipseLink-specific APIs in my unit tests. I looked at the EclipseLink

JPA 2.1 Create entity within JPA EntityListener

你说的曾经没有我的故事 提交于 2021-01-28 14:54:45
问题 I try to create a log entry as soon as one of my entities got changed or created. In order to do this, I registered an EntityListener on an AbstractEntity class. AbstractEntity has a List of LogEntries and the cascade type of this list is ALL (all of my entities inherits from AbstractEntity). Current implementation of my EntityListener: public class EntityChangeListener { @Inject SessionController sessionController; @PreUpdate public void preUpdate(AbstractEntity entity) { createLogEntryFor

JPA 2.1 Create entity within JPA EntityListener

百般思念 提交于 2021-01-28 14:42:56
问题 I try to create a log entry as soon as one of my entities got changed or created. In order to do this, I registered an EntityListener on an AbstractEntity class. AbstractEntity has a List of LogEntries and the cascade type of this list is ALL (all of my entities inherits from AbstractEntity). Current implementation of my EntityListener: public class EntityChangeListener { @Inject SessionController sessionController; @PreUpdate public void preUpdate(AbstractEntity entity) { createLogEntryFor

@AdditionalCriteria on a variable rather than a class in EclipseLink

非 Y 不嫁゛ 提交于 2021-01-28 06:25:08
问题 Just like in hibernate, in EclipseLink we have the annotation @AdditionalCriteria that allow us to add a filter on our data. In hibernate it as @Filter and you can either add it on top a a class or on a field like this. @Filter(name="test", condition=":deleted is null") public class MyClass { ... } or @Filter(name="test", condition=":deleted is null") private List<MyClass> list; In EclipseLink the @AdditionalCriteria only works for the first on, on a class. Is there any other annotation that