eclipselink

Changing naming strategy of @Table and @Column with EclipseLink to lower-case

雨燕双飞 提交于 2019-12-11 10:00:44
问题 When defining a JPA Entity like this: @Entity @Table public class CaseExample implements Serializable { @Id Long id; @Basic String fooBar; } the automatically created SQL table name is "CASEEXAMPLE" and the column name "FOOBAR". How can I change that from upper-case to lower-case-with-underscore e.g. "case_example" and "foo_bar" without having to add a name="foo_bar" to every single @Table and @Column? Is the naming strategy defined by JPA or implemenation dependend? I use JPA 2.0 with

Embedded AttributeOverride on update not working

落爺英雄遲暮 提交于 2019-12-11 09:55:28
问题 I have entity with embedded two ModelId classes, where one is EmbeddedId and the other references another entity. @Entity public class Report implements Serializable { @EmbeddedId private final ModelId id; @AttributeOverride(name = "id", column = @Column(name = "scheme_id") @Embedded private ModelId schemeId; public void changeScheme(ModelId schemeId) { this.schemeId = schemeId; } } @Embeddable public class ModelId implements Serializable { private Integer id; } I can insert and select Report

JPA mapping Interface as @Entity in EclipseLink

僤鯓⒐⒋嵵緔 提交于 2019-12-11 09:45:03
问题 I have to map the interface as entity to use different implementations in collections. @Entity @Table(name = "OPTION") @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name = "TYPE", discriminatorType = DiscriminatorType.STRING) public interface FilterOption { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) public Long getId(); public void setId(Long id); public Object getValue(); ... } I'm recieving an error : Internal Exception: Exception [EclipseLink-7161]

OSGi - running outside eclipse

旧时模样 提交于 2019-12-11 08:23:27
问题 I have been working on getting my OSGi application to run outside eclipse. It has certainly wasn't as easy as I thought out would be certainly not just a case of running java -jar org.eclipse.osgi_3.7.1.jar and installing the plugins. I'm hoping this is the last problem java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/ This works fine in Eclipse. I have a persistence bundle and several fragmentation bundles that I load depending on the database type that I

JPQL count Parent Objects on Multiple Children Match in OneToMany Relationship

流过昼夜 提交于 2019-12-11 08:09:53
问题 In a JavaEE JPA web application, Feature entity has bidirectional ManyToOne relationship with Patient Entity. I want to write a query to count the number of Patients who have one or more matching criteria features. I use EclipseLink as the Persistence Provider. For example, I want to count the number of patients who have a feature with 'variableName' = 'Sex' and 'variableData' = 'Female' and another feature with 'variableName' = 'smoking' and 'variableData' = 'yes'. How can I write a JPQL

EclipseLink Moxy unmarshall and getValueByXPath gives null

白昼怎懂夜的黑 提交于 2019-12-11 08:05:09
问题 I use the below code to get unmarshall and query the unmarshelled object by Xpath. I am able to get the object after unmarshalling, but while querying by XPath, the value is coming as null. Do I need to specify any NameSpaceResolver? Please let me know if you are looking for any further information. My code: JAXBContext jaxbContext = (JAXBContext) JAXBContextFactory.createContext(new Class[] {Transaction.class}, null); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StreamSource

How to enable weaving in EclipseLink?

大城市里の小女人 提交于 2019-12-11 07:46:41
问题 I receive the following warning on the GlassFish terminal while deploying an application that has lazy fetching in entities, WARNING: Reverting the lazy setting on the OneToOne or ManyToOne attribute [zoneTable] for the entity class [class entity.ZoneCharge] since weaving was not enabled or did not occur. for whatever entities are listed in the project. My persistence.xml file looks something like the following. <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http:/

Update without select in EclipseLink 2.7

懵懂的女人 提交于 2019-12-11 07:37:49
问题 I need a solution to update entity without select using EclipeLink 2.7. Here I found the following solution: EntityManager entityManager = entityManagerFactory.createEntityManager(); entityManager.getTransaction().begin(); UnitOfWork unitOfWork = ((EntityManagerImpl) entityManager.getDelegate()).getUnitOfWork(); AbstractSession session = unitOfWork.getParent(); session.updateObject(entity); entityManager.getTransaction().commit(); And this is what I get: Caused by: java.lang

Rcp with eclipselink enable dynamic weaving

不羁的心 提交于 2019-12-11 07:34:16
问题 I am using eclipselink in an rcp application, when for first time application uses the database i get these warning messages. Also the application lags for 1-2 seconds until jpa to login successfully. How to stop this warning, is this warning lags the application? [EL Info]: 2012-05-08 12:28:31.186--ServerSession(981252826)--EclipseLink, version: Eclipse Persistence Services - 2.3.2.v20111125-r10461 [EL Warning]: 2012-05-08 12:28:31.774--ServerSession(981252826)--Reverting the lazy setting on

EclipseLink/MySQL/Glassfish - Table is not created, even though connection works fine

早过忘川 提交于 2019-12-11 07:25:49
问题 I am trying to setup a basic JPA application that creates a simple table in mySQL. I use glassfish 4.1, I have created connection pool/resource and pinged successfully the database from administration panel. I created a web application project which contains just one simple entity and a persistence.xml under src/META-INF folder. <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance