eclipselink

Sort child rows of each group in the desired order and take the desired number of top rows in each group in JPA

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 21:28:55
问题 Is it possible to sort child rows of each group (child rows of each parent row) in the desired order and take the desired number of top rows in each group in JPA? For example, I have three tables in MySQL database. category sub_category product The relationship between these tables is intuitive - one-to-many in the order in which they appear. I'm executing the following criteria query on the sub_category table. CriteriaBuilder criteriaBuilder=entityManager.getCriteriaBuilder(); CriteriaQuery

JPA + StoredProcedureCall + object type IN parameter

六月ゝ 毕业季﹏ 提交于 2019-12-12 20:40:31
问题 I'm trying to do a simple thing: call stored procedure which have a object type parameter. This is what I have in db: create or replace TYPE TEST_TYPE AS OBJECT ( test_field varchar(100) ) and CREATE OR REPLACE PROCEDURE TEST_PROC ( PARAM1 IN TEST_TYPE ) AS BEGIN END TEST_PROC; This is what I have in my java code: @Embeddable @Struct(name = "TEST_TYPE", fields = {"TEST_FIELD"}) public class TestStruct { private String testField; public String getTestField() { return testField; } public void

how to import csv file into mongodb in Java

China☆狼群 提交于 2019-12-12 19:11:20
问题 I'm using EclipseLink as API for mongodb. I need to update my database each time from given csv files. Is there any way to import a CSV file into MongoDB with java? or is it possible to execute a raw mongo command like this in java enviroment? mongoimport --db users --collection contacts --type csv --file /opt/backups/contacts.csv 回答1: mongoimport --db users --collection contacts --type csv --headerline --file /opt/backups/contacts.csv --collection parameter is optional. If it is not passed,

How to format Json output

*爱你&永不变心* 提交于 2019-12-12 18:33:49
问题 Please help me how to get JSON output as below: { "_costMethod": "Average", "fundingDate": 2008-10-02, "fundingAmount": 2510959.95 } Instead of: { "@type": "sma", "costMethod": "Average", "fundingDate": "2008-10-02", "fundingAmount": "2510959.95" } 回答1: Based on the output from your question, you are currently not using EclipseLink JAXB (MOXy)'s native JSON binding. The following should help. Java Model Below is my best guess at your object model based on your post. I have added the metadata

Why does eclipselink consume the whole allocationSize each time it's rebooted?

↘锁芯ラ 提交于 2019-12-12 17:47:50
问题 I've just noticed that for my entity's id, eclipselink assigns an id 1 + the previously greated assigned IN THE SAME SESSION (1), as opposed to in the element table (2). This goes against my application expectations. What's the easiest way to tell it to do 2? @Id @GeneratedValue(strategy = GenerationType.AUTO) private int objId; And here is what I have in the database: ij> connect 'jdbc:derby:db'; ij> set schema memo; 0 Zeilen eingef?gt/aktualisiert/gel?scht ij> select * from meaning; OBJID

Is there any tool to validate @XmlPath annotations? [closed]

心不动则不痛 提交于 2019-12-12 16:38:59
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 months ago . Is there any tool to validate @XmlPath annotations used from MOXy JAXB at a specific xml file at compile time from Eclipse or IntelliJIdea java framework or something else? 回答1: There is no corresponding IDE tooling yet. You could use the EclipseLink MOXy JAXBContext to generate an XML schema and then use it to

How does the JPA handle partial, non-disjoint inheritance (using InheritanceType.JOINED in class-per-table scenario) along with EntityManager.find()?

…衆ロ難τιáo~ 提交于 2019-12-12 13:59:52
问题 I have a problem modeling/understanding partial , non-disjoint inheritance with JPA annotations. Here are the four tables: CREATE TABLE Persons ( id INTEGER NOT NULL, first_name VARCHAR(50) NOT NULL, last_name VARCHAR(50) NOT NULL, PRIMARY KEY (id)); CREATE TABLE Referees ( id INTEGER NOT NULL, license_nbr VARCHAR(10) DEFAULT NULL NULL, PRIMARY KEY (id), CONSTRAINT referees_persons_fk FOREIGN KEY (id) REFERENCES Persons (id) ON DELETE CASCADE ON UPDATE CASCADE); CREATE TABLE Coaches ( id

@ManyToOne(updatable=false) - how it should work?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 12:24:55
问题 I want to have a read-only functionality in one of my entities. I know that in JPA 2.0 we don't have such functionality per se. I thought we can achieve it using updateable=false, insertable=false but I don't think I get how it works. Assume that I have two entities: OrderedItem and Customer : @Entity public class OrderedItem { @Id @GeneratedValue private int id; private String name; @ManyToOne @JoinColumn(updatable = false) private Customer owner; // bunch of simple getters and setters }

With Eclipselink/JPA, can I have a Foreign Composite Key that shares a field with a Primary Composite Key?

落爺英雄遲暮 提交于 2019-12-12 10:57:15
问题 My database has two entities; Company and Person. A Company can have many People, but a Person must have only one Company. The table structure looks as follows. COMPANY ---------- owner PK comp_id PK c_name PERSON ---------------- owner PK, FK1 personid PK comp_id FK1 p_fname p_sname It has occurred to me that I could remove PERSON.OWNER and derive it through the foreign key; however, I can't make this change without affecting legacy code. I have modeled these as JPA-annotated classes;

How to replace EclipseLink 2.3.2 with EclipseLink 2.5 in WebLogic Server 12c

 ̄綄美尐妖づ 提交于 2019-12-12 08:49:14
问题 I currrently try to run Docx4j in WebLogic Server 12c. WebLogic Server 12c comes with EclipseLink 2.3.2. There is a similar Post describing the situation which unfortunately yield no answer. Docx4j does not work with the JAXB (MOXy) implementation which is part of EclipseLink 2.3.2. I got Docx4j running standalone with EclipseLink 2.5. So I am very confident that using EclipseLink 2.5 with Weblogic Server 12c will solve the issue with Docx4j. How can I replace the EclipseLink Vesion 2.3.2 the