eclipselink

Why EclipseLink is adding discriminator column for joined inheritance strategy?

爱⌒轻易说出口 提交于 2019-12-01 16:37:14
问题 I am using JOINED inheritance strategy with EclipseLink JPA implementation. I have noticed that EclipseLink is adding discriminator column, named by default DTYPE, to the database schema. I understand, that discriminator is needed for one table inheritance strategy, but why for JOINED strategy? EclipseLink needs this column because I've got errors after removing it. Is this column added for performance reasons, etc? I am not particularly happy about that since from the point of view of

REST+EJB+JPA 框架在 Eclipse+TomEE 的开发环境搭建

送分小仙女□ 提交于 2019-12-01 16:34:36
Apache TomEE结合了众多开源Java EE的实现,诸如GlassFish、JBoss和Apache Geronimo,同时也是仅有的6个通过认证的JavaEE引擎之一。 一、准备工作 下载TomEE, http://mirrors.hust.edu.cn/apache/tomee/tomee-1.7.1/apache-tomee-1.7.1-plume.zip ,该版本内核为Tomcat 7,解压即可。 下载Eclipse for JavaEE, 必须是Kepler或以上版本 ,否则不支持Tomcat 7 jdk1.7或以上版本 + Maven 3.x 二、环境搭建步骤及关键代码 1、Eclipse+TomEE 1) 启动Eclipse,菜单Window-Preference-Server-Runtime Environment-Add,增加TomEE(与增加tomcat方法相同); 2) Window-Show View-Servers,增加Server,选择上一步的TomEE; 3) 双击上一步中的Server,勾选如下内容并保存: 增加后需要手动将 tomee.xml和system.properties 导入(import - File System)到localhost-config文件夹下。 4) 创建TomEE数据源:在Servers项目中的“TomEE

Generate DDL for JPA 2.0 with EclipseLink

我的梦境 提交于 2019-12-01 15:08:54
I've created my model classes with JPA 2.0 annotations. At runtime, I will use EclipseLink 2.2.0, but I've been careful to use only pure JPA annotations in my model classes. Now, how do I generate the schema DDL for the database ? I want to use the EclipseLink API to generate the DDL from the classes, but not at runtime. Instead, I want a Java class to run on the command line and which outputs the DDL. What this guy did for Hibernate , I want for EclipseLink. I'd also settle for an Ant task or some plugin for Maven. Also, I chose to name my file jpa.xml instead of persistence.xml ; bonus

Where did the EclipseLink/Maven repository go to? (again)

喜你入骨 提交于 2019-12-01 14:30:43
问题 Yes, I know, the subject was asked before, but the repository moved again. Has anybody seen it? I would be much obliged. 回答1: A quick search reveals a long list of mirrors, most of them returning 404s but their cache entry is still viewable (for now). So it does seem like the files have been removed at the source, and rather recently too. Here are a few mirrors that still have the files (for now): http://linorg.usp.br/eclipse/rt/eclipselink/maven.repo/ http://mirror.neu.edu.cn/eclipse/rt

Generate DDL for JPA 2.0 with EclipseLink

荒凉一梦 提交于 2019-12-01 13:58:48
问题 I've created my model classes with JPA 2.0 annotations. At runtime, I will use EclipseLink 2.2.0, but I've been careful to use only pure JPA annotations in my model classes. Now, how do I generate the schema DDL for the database ? I want to use the EclipseLink API to generate the DDL from the classes, but not at runtime. Instead, I want a Java class to run on the command line and which outputs the DDL. What this guy did for Hibernate, I want for EclipseLink. I'd also settle for an Ant task or

CacheRetrieveMode.BYPASS of EclipseLink is not useful

人走茶凉 提交于 2019-12-01 12:56:19
Follow my code: Company cc = em.find(Company.class, clientUser.getCompany().getId()); System.out.println(cc.getCompany_code()); HashMap findProperties = new HashMap(); findProperties.put(QueryHints.CACHE_RETRIEVE_MODE, CacheRetrieveMode.BYPASS); Company oo = em.find(Company.class, clientUser.getCompany().getId(), findProperties); System.out.println(oo.getCompany_code()); Just like the example "Used as EntityManager properties". here But, there are nothing different between the two outputs. What are you expecting to be different and why? Note that CACHE_RETRIEVE_MODE only affects the shared

Persist a List with order and duplicates in JPA/EclipseLink

扶醉桌前 提交于 2019-12-01 12:36:52
I have basically two Entities Entity1 and Entity2 . Entity1 contains this bit of Code: @OneToMany(cascade=CascadeType.PERSIST) @OrderColumn List<Entity2> e = new LinkedList<Entity2>(); and Entity2 contains some stuff, but nothing relevant. I want to add some instances to the list e , and most importantly i want to add some duplicates (the same reference) twice or more to the list. Still i want JPA to persist both and i want JPA to persist the Order of the list. So far this works, if i add only unique items. If i add a duplicate, JPA actually wants to persist the correct data (ID od Entity1, ID

JPA - Using Multiple data sources to define access control

本小妞迷上赌 提交于 2019-12-01 12:27:06
I am totally new to JPA and JSF and hope you can help me with my questions. My application is built using JSF 2.0 Framework, using JPA 2.0/EclipseLink running on Glassfish 3+, MySQL. I set one persistence unit called "loginPU" using data source: "jdbc/loginDataSource" "jdbc/loginDataSource" connects to MySQL using "login1" (defined in mysql . user table) and only has access to customer . user and customer . roles tables, with only select privileges. I created 2 other data sources "jdbc/admin" and "jdbc/staff" in Glassfish JDBC Resources and both with different privileges The login

Using EclipseLink JPA to store XML type to PostgreSQL

亡梦爱人 提交于 2019-12-01 12:02:36
I am new to JPA, and I have a question on how to use JPA to store XML type to PostgreSQL. I am simply expanding an existing POJO to include persisting an additional XML field to a column. The POJO looks something like this (I purposely left out a bunch of other columns to make this shorter, before adding this additional XML type, this POJO can persist into PostgreSQL just fine via JPA). public class Finding implements Serializable { private static final long serialVersionUID = -5814053129578212916L; ... @Column(name = "PLUGIN_TEXT_XML") private String pluginTextXML; public void setPluginText

How to store date-time in UTC into a database using EclipseLink and Joda-Time?

南楼画角 提交于 2019-12-01 10:54:46
I have been fumbling with the following EclipseLink Joda-Time converter for a long time to store date-time in UTC into MySQL database with no success at all. import java.util.Date; import org.eclipse.persistence.mappings.DatabaseMapping; import org.eclipse.persistence.mappings.converters.Converter; import org.eclipse.persistence.sessions.Session; import org.joda.time.DateTime; public final class JodaDateTimeConverter implements Converter { private static final long serialVersionUID = 1L; @Override public Object convertObjectValueToDataValue(Object objectValue, Session session) { //Code to