eclipselink

jpa eclipselink subquery in from clause

放肆的年华 提交于 2019-12-11 12:03:24
问题 I read here https://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Querying/JPQL#Sub-selects_in_FROM_clause that eclipselink support subquery in from clause but when i'm using this query queryString2="SELECT NEW dz.com.naftal.erp.domain.view.MouvementProduitView('VAR',t.cds,SUM(t.mntttc)) " + "FROM (SELECT DISTINCT m.mouvementProduitViewPK.cds as cds,m.mouvementProduitViewPK.referenceDocument,m.mouvementProduitViewPK.typeDocument " + "m.mntttc as mntttc FROM

How to avoid loading lazy bidirectional relationships with MOXy?

大城市里の小女人 提交于 2019-12-11 12:00:03
问题 My question is a follow up to this comment. I'm mixing JPA and JAXB (MOXy) annotations on the same class, which works fine most of the time. As described in the linked thread, @XmlInverseReference prevents cycle exceptions when bidirectional relationships are marshalled. But in order to detect the cycle, MOXy has to inspect the back reference of the linked entity, which leads to extra SQL SELECTs if a lazy relation needs to be populated. To illustrate the problem in detail, consider this made

Not able to read environment variable in persistence.xml

醉酒当歌 提交于 2019-12-11 11:59:22
问题 I have a Maven3 project where I'm using the tomcat7-maven-plugin. I would like to set the path for the embedded database via an environment variable argument to the jvm. Reading the variable with System.getenv("myDataDir") within a Java-Method returns the correct path. But when I try to set the variable ${myDataDir} in my persistence.xml and then I start tomcat with "mvn tomcat:run" I get FileNotFoundExceptions because the variable is not replaced with the actual value (it says e.g. Cannot

EclipseLink : EntityManager.merge() : Why TENANT_ID not added runtime for UPDATE operation?

。_饼干妹妹 提交于 2019-12-11 11:42:27
问题 I have gone through EclipseLink Single Table Multi-Tenancy feature spec. BELOW is some portion by reading, I am little bit surprised. Task 4: Perform Operations and Queries The tenant discriminator column is used at runtime through entity manager operations and querying. The tenant discriminator column and value are supported through the following entity manager operations: persist() find() refresh() The tenant discriminator column and value are supported through the following queries: Named

Can MOXy serialize POJO with getters only without need to explicitly put annotation at each getter?

风流意气都作罢 提交于 2019-12-11 11:19:38
问题 So given I have class Name: class Name { private String first; private String middle; private String last; public getFirst() { return first; } public getMiddle() { return middle; } public getLast() { return last; } } I would like to serialize instances of this class using the mapping XML without having to list each property in the mapping XML: <java-types> <java-type name="Name"> <java-attributes> <xml-element java-attribute="first"/> <xml-element java-attribute="middle"/> <xml-element java

Internal Exception: org.postgresql.util.PSQLException: ERROR: relation “producttype_productitem” does not exist

安稳与你 提交于 2019-12-11 11:10:09
问题 During the process of educating myself on JAX-RS and JPA. I stumbled upon the following exception when i ran the project on Glassfish server 3.1.2 . However JPA implementation is working fine as a standalone application. Internal Exception: org.postgresql.util.PSQLException: ERROR: relation "producttype_productitem" does not exist Position: 65 Error Code: 0 Call: SELECT t1."productCode", t1.COST, t1.ITEMCODE, t1.ITEMNAME FROM ProductType_ProductItem t0, "ProductItem" t1 WHERE ((t0.ProductType

Why does JPA update the OrderColumn instead of setting it on creation?

余生长醉 提交于 2019-12-11 11:03:02
问题 I want to add a NOT NULL constraint to my table on my OrderColumn. Running my code with the constraint I get a constraint violation error. Running without the constraint I see that the row is first inserted without the OrderColumn, and then updated immediately after with the correct OrderColumn. Is there a reason for this behavior? My entity managing the OrderColumn: @Entity @Table(name="INSPECTION") public class Inspection implements Serializable { ... @OneToMany(cascade={CascadeType.PERSIST

Version of parent object is not incremented if one-to-many relationship of the parent object is modified

南楼画角 提交于 2019-12-11 10:45:52
问题 I am using EclipseLink as a JPA provider. I am facing issue with version attribute not being updated whenever a child is added/removed in parent object. There is a class Company. The Company class has a property Set. The Company class a version field. Whenever I update any non-relationship attribute, the version field of Company instance is increment. However, if I add an instance of Employee class to one-to-many collection employees, version field of Company instance is NOT incremented.

Does Eclipselink use (dynamic) bytecode weaving under Apache Felix?

萝らか妹 提交于 2019-12-11 10:43:14
问题 I'm using the Eclipselink bundles from Springsource (version 1.1.0) inside Apache Felix. My (JPA annotated) entity classes get persisted etc., so the basic mechanism works. However, I'm doubting that bytecode weaving is done. How can I verify if Eclipselink uses weaving on my classes? Is weaving generally supported when running in Felix? I didn't change anything about my configuration or startup scripts, do I have to? 回答1: See Eclipse docs - bottom of page; import org.eclipse.persistence

Eclipse Link strange behavior after re attaching entity tree

牧云@^-^@ 提交于 2019-12-11 10:38:14
问题 I have a standard JEE7 application using Eclipse Link as JPA engine and an Entity tree will all entities annotated with CascadeType.ALL in their OneToMany relationships. All Entities have @GeneratedValue ids from database sequences. During a transaction I have fetched a managed instance of an Entity tree, then I detach the root then set null to all @Id fields and @Version fields of the tree and merge the root Entity. As I expect all managed Entities in the tree, except from two, have new Ids.