About Id

forum_thread

Persist error @ManyToMany how to define correct entities relationships

I have Product entities containing a list of Category enties. Each product can have multiple Category but all sue the same limited set of Category entities. There is not changes made to Category from Product. The category ID is taken from the webservice Object ID (unique too). ... all refering to same limited set of Category entities (via ID). There is not changes made to Category from Product. The category ID is taken from the webservice Object ID (unique too). @ Entity ...

 
manual

JPA Primary Key

Explains how to define and use primary keys in JPA, including composite and embedded primary keys.... public class Project { @Id javax.persistence.Id JPA annotation Specifies the primary key of an entity. See ...

 
forum_thread

c.o.jpa.type.EntityTypeImpl.getIdType() returns null

hi, i currently try to use objectdb for a new project. i wanted to use it in combination with spring-data-jpa (M2), but i'm not able to use the automatic repository feature because the following code fails         EntityType<T> type = metamodel.entity(domainClass); ... is null type EntityTypeImpl<X>  (id=57) m_attrMap LinkedHashMap<K,V>  (id=74) m_declAttrMap LinkedHashMap<K,V>  (id=78) m_entityName "Foo" (id=80) m_errorManager JPE  (id=83) ...

 
forum_thread

Need help to make this test work and define proper annotations for entities Lists

Hi, I can't get this simple test case to work, i know it is probably due to the lack of proper annotations on entities list, could anyone help me to define them? NB in this test case I didn't set all entities methods for the sake of clarity, also in actual application no field are public nor static and no entity is static.    ... ; import javax. persistence . Id ; import javax. persistence . Persistence ; import ... implements Serializable { @ Id @ GeneratedValue private long id ; ...

 
issue

Merge throw exception "Attempt to reuse an existing primary key value"

Hi,   if Id = 0 I got javax.persistence.EntityExistsException: com.objectdb.o.UserException: Attempt to reuse an existing primary key value (ru.dz.train.test.ZeroIdTest$MyEntity:0)   if Id=1 no exception code : ... 19:15 Hi, if Id = 0 I got javax.persistence.EntityExistsException: ...   if Id=1 no exception code : import javax. persistence . *; ... ( ) ; final int Id = 0 ; em. getTransaction ( ) . begin ...

 
issue

When using inheritance, you can specify, which ID to use

When storing objects with inheritance, it should be possible to choose, which ID (parent or child class) should be used for new object. For example: public EntityA() {     @Id     long id;     String field1; }   ... with inheritance, it should be possible to choose, which ID (parent or child class) should be used for new object. For example: public EntityA ( ) { @ Id long id ; String field1 ; }   ...

 
forum_thread

Left join fetch behaviour doesn't retrieve children?

Hello support, I'm a little bit confused about a left join fetch behaviour. In this test case, i try to fetch my 3 children using a left join fetch. But my collection is null after closing the em. It was expected to be fetched before closing the em, no ? In fact, that is the objective of the fetch purpose (i guess ?). ... ; import javax. persistence . Id ; import javax. persistence . ManyToMany ; import ... class MyEntity {   @ Id private String name ;   public String ...

 
forum_thread

On ensuring ID available after persist

This reports on a possible solution to a common problem: I was trialling ObjectDB on an existing, functioning, large JavaEE/JPA web application, which until now had used EclipseLink+MySQL and then Oracle+MySQL. On trying it out on ObjectDB I hit a problem with my very extensive entity wiring code, which relies on an "external" entity object having a non-null id after it has been passed to EntityManager.persist, thus: ... relies on an "external" entity object having a non-null id after it has been passed to EntityManager.persist, thus: Element ... element) I am using the following for the ID: @ Id //@GeneratedValue(strategy = GenerationType.AUTO)// Explicit for ...

 
forum_thread

ID format in objectdb 2.x for JDOHelper.getObjectId

Hi, I am trying to upgrade the objectdb from 1.x to 2.x. I installed and configured as per object db tuotrial. I am just wondering, in objectdb 1.x, when i am tring to get the object id for a persistable object, i am getting an integer as a result e.g Object obj = JDOHelper.getObjectId(logTestRunImpl) used to return suppose 1 obj.toString() = 1 but the same code when i am trying to execute for the same object in object db 2.x, i am getting ... in objectdb 1.x, when i am tring to get the object id for a persistable object, i am getting an integer as a result e.g ... is not an integer and this object has two feild object id and type id. Can you please let me know if there is any change in ...

 
forum_thread

Should derived fields of an EmbeddedId be manually maintained by app code?

If I have an Entity which has a primary key which is derived and I am implementing it using @EmbeddedId, am I responsible for maintaining the derived fields of the @EmbeddedId? I could not find anything in the JPA 2.0 spec http://download.oracle.com/auth/otn-pub/jcp/persistence-2.0-fr-oth-JSpec/persistence-2_0-final-spec.pdf?e=1317047713&h=54831c176e81a244a4c309e13eba0b27 which tells me what to expect. ... EContainer singleton ) { this . id . cont = singleton. id ; this . container = singleton ; }   ...