About Persistence Context

forum_thread

Cannot sort descending, when ordering by caluculated float in a method

Hi, I have found an issue in ordering by a method. I have two entities : Invoice and InvoiceItem. public class InvoiceItem{ ..     private float price;     private float amount; .. }   public class Invoice{ ...   import java. util . *; import javax. persistence . *;   public final class F172 { ... Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell ...

 
forum_thread

openejb jpa jaas module

    hello , i've finished jpa jaas module. Here it is :   package com.bayner.auth; import com.bayner.jpa.Principals; import com.bayner.jpa.UserInfo; import com.bayner.jpa.UserPrincipal; ... . jpa . UserPrincipal ;   import javax. persistence . EntityManager ; import javax. persistence . ... Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell ...

 
issue

ObjectDB-2.6.9: Failed to commit transaction: Failed to set numeric value of field property Element.id using reflection

The following error is reported for objectdb-2.6.9.jar: Failed to commit transaction: Failed to set numeric value of field property com.greensoft.objectdb.test.entity.Element.id using reflection (error 613) Did not happen with objectdb-2.6.3_04 (which one can easily test and compare in the test console app for NetBeans8.1 provided, as explained below). To reproduce download the app and unpack, open in NetBeans8.1, perform Clean and Build, and Run: ... thread "main" [ ObjectDB 2.6.9 ] javax. persistence . RollbackException Failed to commit transaction : ... I found out why. Reasons include: 1. The Run context menu option (which invokes Ant) in my NetBeans project was over-writing ...

 
forum_thread

Multi-thread access to single EM's entities

If my entity classes have synchronized getters and setters, is it reliable for multiple threads to access a single EM's managed entities, as long as only the thread that created the EM interacts directly with it?  I've tested this and it seems to work... but I know better than to depend on the observable behavior of multithreaded code. When I run this example and examine the database, the entity contains the value set by the second thread, as expected.   ... as expected.   import javax. persistence . Entity ; import javax. persistence . ... Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell ...

 
forum_thread

mappedBy problem

If I put the mappedBy element to the @OneToMany, the owned side (the many side) will never persist ! for example @Entity public class Employee { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) public Long id; public String name; @OneToMany(targetEntity=Address.class,mappedBy="employee") public List<Address> addresses; }   @Entity... Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell ...

 
api-jpa

JPA Queries

Reference (JavaDoc) of all the JPA query types, including Query, TypedQuery, CriteriaBuilder, CriteriaQuery, Tuple, Root, Expression, Order, etc.... Query and TypedQuery interfaces: javax.persistence.Query javax.persistence.TypedQuery The JPA ... Interface used to interact with the persistence context. See JavaDoc Reference Page... 's getCriteriaBuilder ...

 
api-jpa

javax.persistence.PersistenceUnit

Expresses a dependency on an EntityManagerFactory and its associated persistence unit.(Annotation of JPA)

 
forum_thread

Query on Embedded Primary Key?

Hi, I am trying to use Embedded Primary Key - but seems I can't retrieve them correctly with the query below - the query seem to work fine for other field (in the code = primkeycopy). The error I get when is below - it complains about a casting issue. Let me know how to fix it - Thanks  EKK   ... import java. util . List ; import javax. persistence . Embeddable ; import javax. persistence . ... Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell ...

 
forum_thread

Class fields selection to store

In a class how do I define which are the fields to be stored? (using JDO API) It's using persistence-modifier="persistent" ? If I have a class with 40 fields and I only want to store one of the fields should I do the following? <class name="Car">    <field name="Wheels" persistence-modifier="persistent" /> </class> Which are the value used for fields that I do not want to store? ... to be stored? (using JDO API) It's using persistence-modifier="persistent" ? If I have a class with 40 fields ... Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell ...

 
issue

New entity objects are duplicated on merge cascading

When merge is cascaded to a new entity object that has not been persisted yet - it becomes persisted twice. This was demonstrated by a Java EE application in this forum thread but may be reproduced also in a simple console test case: ... import java. util . *;   import javax. persistence . *;   @ Entity public class I110 ... Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell ...