eclipselink

Binding foreign key in Vaadin (EclipseLink)

99封情书 提交于 2019-12-12 04:36:32
问题 I'm using Vaadin and EclipseLink. There are 2 tables, one is Mail , second in Customer . PK for Customer is customer_id, PK for mail is mail_id. Table Mail has Customer_id as a foreign key. How do I bind it? I tried: binder.forField(fkCustomerId) .withConverter(new StringToBigDecimalConverter(FormMessages.NUMBERS_ONLY)) .bind(Mail::getCustomerId, Mail::setCustomerId); Then I checked the Mail-entity class and found @JoinColumn(name = "CUSTOMER_ID", referencedColumnName = "CUSTOMER_ID")

Getting sql connection via EclipseLink

Deadly 提交于 2019-12-12 03:46:15
问题 I am trying to obtain a reference to sql connection as mentioned in the following question : Getting a JDBC connection from EclipseLink Here is the actual code: Connection con = entityManager.unwrap(Connection.class); This is also mentioned in EclipseLink documentation. I keep getting following error from EclipseIDE: The method unwrap(Class<Connection>) is undefined for the type EntityManager 1 Quickfix Add cast to 'entityManager' If I apply the quickfix suggested by Eclipse, the code looks

JPA 2.0 & MySQL are not respecting case sensitive table names

空扰寡人 提交于 2019-12-12 03:46:00
问题 I have a strange issue my ear project: I have put the correct annotations on my entity class: @Entity @Table(name = "PRODUCTS") But when I deploy my application on glassfish 3.1.2.2, I find that JPA has created the tables with lowercase chars I am using EclipseLink 2.4.1 Please Help me. 回答1: I got the solution from Brian Vosburgh's comment: In the windows version of MySQL the names of table are set to lower case. On linux, by default, this configuration is disabled, and the tables'names set

Eclipselink: Difference between static and dynamic weaving

我怕爱的太早我们不能终老 提交于 2019-12-12 03:45:52
问题 I use eclipselink 2.6.3 and have the following code: public Temp getTemp() { EntityManager em=emf.createEntityManager(); String queryString="SELECT a FROM Temp a"; EntityGraph<Temp> eg = em.createEntityGraph(Temp.class); eg.addAttributeNodes("id"); //eg.addAttributeNodes("name"); Query query = em.createQuery(queryString); query.setHint("javax.persistence.fetchgraph", eg); List<Temp> items=query.getResultList(); em.close();// ENTITYMANAGER IS CLOSED return items.get(0); } public void temp(){

JPA count distinct multiple expressions

十年热恋 提交于 2019-12-12 03:44:23
问题 CriteriaBuilder.countDistinct(Expression e) It takes one expression only. How to count distinct multiple expressions? For example, Country Language ------------------------------- In JPA CriteriaQuery, how to count different pairs of (country, language)? Thanks, 回答1: You cannot do that with JPQL. JPQL BNF is very clear aggregate_expression ::= { AVG | MAX | MIN | SUM } ([DISTINCT] state_field_path_expression) | COUNT ([DISTINCT] identification_variable | state_field_path_expression | single

JPA one-to-one insert how to do it properly with eclipselink

不问归期 提交于 2019-12-12 03:09:41
问题 I am trying to do simple one-to-one mapping with JPA and EclipseLink. I have the following DB structure in PostgreSQL CREATE TABLE public.employee ( id SERIAL, firstname VARCHAR(20), lastname VARCHAR(20), CONSTRAINT employee_pkey PRIMARY KEY(id) ); CREATE TABLE public.employee_info ( id INTEGER NOT NULL, info TEXT DEFAULT ''::text NOT NULL, CONSTRAINT employee_info_pkey PRIMARY KEY(id), CONSTRAINT employee_info_fk FOREIGN KEY (id) ); and I am trying to reflect this as the following code:

How to find what version of EclipseLink my Eclipse Project is using?

假装没事ソ 提交于 2019-12-12 02:59:53
问题 I have a Maven jersey-quickstart-webapp Project I am developing in Eclipse. The project is a JERSEY REST backend with angularjs javascript frontend. I would like to know how to check what version of EclipseLink my project is using. Where can I find this property? I've searched high and low but I can't find it - I know that I did stumble across it before, so it definitely exists.... This question is trying to get to the bottom of the following question I posed months ago about a problem with

JPA - Query with 'composite values' in where-clause

戏子无情 提交于 2019-12-12 02:43:33
问题 I want to realize the following (for this example: MySQL) statement in JPA 2.1 with Eclipselink as the implementation: select * from account where (mailing_zip_code, id) > (56237, 275) order by mailing_zip_code asc, id asc limit 10; What I want to achieve is an implementation of the seek method for endless scrolling without using an offset in the query. With focus on the where clause, I am not able to find a correct name for this construct. In some places it is called 'composite value', but I

Eclipselink Static Weaving and Spring Boot is not Working

為{幸葍}努か 提交于 2019-12-12 02:43:07
问题 In a Spring Boot project we use Eclipselink as ORM. We configured the build to weave statically and to package as jar. The interesting thing is that starting the program with mvn spring-boot:run works without problem, but starting with java -jar archive.jar works only if all entities are listed in the persistence.xml. Without having the class in the persistence.xml I get the error: java.lang.IllegalArgumentException: No [ManagedType] was found for the key class [eltest.Customer] in the

jpa, eclips-link 2.5.1: OneToMany not working on columns not primary key

删除回忆录丶 提交于 2019-12-12 02:42:50
问题 I have these two entities: Anagrafica @Entity @Access(AccessType.FIELD) @Table(name = "S_MC_CC_USER") @SequenceGenerator(name = "SEQ_ID", sequenceName = "SEQ_ID", allocationSize = 1) public class Anagrafica implements Serializable{ private static final long serialVersionUID = 332466838544720886L; @EmbeddedId private AnagraficaId anagraficaId; @Column(name = "USER_ID") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_ID") private Long userId; @OneToMany(cascade =