About Entity

forum_thread

Can a Set<E> be a foreign key?

I have two classes, Cell and Character.  Basically, the cell is like a room, and contains a variable (private Set<Long> cellHeldCharacters;) which holds the IDs of the characters within the cell (The IDs are Primary Keys).  Can I use the Foreign Key annotation for the variable, or is it illegal/unrecommended to do it for a Set? For a better picture, I have: ... Set? For a better picture, I have: @ Entity public class Character {   @ Id ... characterLocation ; and: @ Entity public class Cell {   @ Id @ ...

 
forum_thread

IDs of Entities suddenly became UUIDs?

Hi, We're having our system with ObjectDB 2.4.5 in production since this year April and it works just fine. However, now we've discovered that suddenly partial Objects in some DBs in production do have a UUID String as their id instead of Long which is of course causing a lot of troubles. Note that this even occurrs on the same "Table" -- some saved Entitities of same type do still have a Long ID, others a String UUID. Our Base-Entity everything inherits from is declared as usual with Long: ... have a Long ID, others a String UUID. Our Base-Entity everything inherits from is declared as usual with Long: @ ... of them having mixed Long and UUID String ids in the same entity type!?? Alex edit ...

 
forum_thread

Object explorer cannot open odb file. ObjectDB many-to-many relationship

I created a data model to test many-to-many relationship with a link table as following (full code in attachement) ... as following (full code in attachement) @ Entity public class User { @ Id ... assignements ; }   @ Entity public class Project { @ Id ... assignements ; }   @ Entity @ IdClass ( Assignement. PK . class ) ...

 
forum_thread

Repair broken references in entities

Hello, it is possible to recover an entity that has been removed automatically by CascadeType.Remove. After cascade remove the removed entity will be persisted with the identical primary key. Are all broken references in other entities on this removed/persisted entity repaired again? best regards ... Hello, it is possible to recover an entity that has been removed automatically by CascadeType.Remove. After cascade remove the removed entity will be persisted with the identical primary key. Are all broken ...

 
forum_thread

Access entity version before commit transaction

Hi, I have a usecase where I need to write the updated entity id to the database before commiting the transaction: 1. Change entity field e.g. from a to b 2. Create a change entry in database containing the new version of the entity ... I have a usecase where I need to write the updated entity version to the database before commiting the transaction: 1. Change entity field e.g. from a to b 2. Create a change entry in database ...

 
forum_thread

Entity Management Config questions

Hi, the manual states the following regarding config of Entities: http://www.objectdb.com/java/jpa/setting/entities  : <cache ref="weak" level2="0mb" /> The <cache> element specifies settings of the two cache mechanisms for entities: #1 2010-12-20 07:36 Hi, the manual states the following regarding config of Entities: http://www.objectdb.com/java/jpa/setting/ent ...

 
forum_thread

Query results are not up to date for entities, not primitives

When using the CriteriaBuilder to query, the retrieved list are not refreshed according to the latest updates. But, when using the JPQL Query, the list are refreshed. What is the problem? ... the query mode, from CriteriaBuilder to JPQL or from Entity to Primitive. What´s now? ... in not being seen by queries : "Updating entity objects in the database using an UPDATE query may be slightly more ...

 
forum_thread

Problem with @Basic(fetch = FetchType.LAZY)

I have a class where two fields are annotated with @Basic(fetch = FetchType.LAZY) due to them containing quite long Strings and me loading ALL entities of the database on application startup (swing app) This class should hopefully demonstrate the problem: ... import javax. persistence . *;   @ Entity public class Sample { private String title ... that you want to load lazily - keep them in separate entity objects. For example, you can define an entity class, LargeString , ...

 
manual

Index Definition

Describes how to define indexes in JPA entity classes and explains how indexes are used in JPQL queries. Querying without indexes requires iteration over entity objects in the database one by one. This may take a significant amount of time if many entity objects have to be examined. Using proper indexes the iteration can be ...

 
issue

Super class' field access fails

I have a base class: public abstract class HotObject extends BaseObject {   private Integer activity;   protected HotObject() {     activity = 1;   }   public Integer getActivity() {     return activity;   }   public void setActivity(Integer activity) {     this.activity = activity;   } ... And I have an inherited class: @ Entity public class HotTag extends HotObject implements ... ( ) ; }   @ Entity public abstract static class A { ...