About Id

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 ...

 
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

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

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) ...

 
tutorial

Step 1: Create a Maven Web Project

Explains how to create a Eclipse Web Maven project with Spring and ObjectDB/JPA support.... list and click Next . Enter Group Id (e.g.  Guestbook ), Artifact Id (e.g.  Guestbook ), Version (e.g.  1.0 ) and Package ( guest ), and ...

 
tutorial

Step 1: Create a Maven Web Project

Explains how to create a NetBeans Web Maven project with Spring and ObjectDB/JPA support.... ) and select Java EE 5. Enter Maven Group Id (e.g. com.objectdb.tutorial.spring ). Enter Maven Version (e.g. 1.0 ... <repository > <id > objectdb </id > <name > ...

 
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: ... static class Book { @ Id @ GeneratedValue ( strategy = ... . AUTO ) private Long id ;   @ OneToMany ( cascade = ... static class Chapter { @ Id @ GeneratedValue ( strategy = ...

 
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 ; }   ...

 
forum_thread

Possible issue for default id generator

First all, congratulations to Objectdb team for the excellent work. Possible issue for default id generator when strategy is sequence. Error: Incomplete definition of auto value in field MyTestCase$MyEntity.idgenerator name is missing (error 342) Please see attached file MyTestCase.java lines 35 and 36. I am not an expert but in my opinion there is no default generator but the element generator is optional. Thanks. ... for the excellent work. Possible issue for default id generator when strategy is sequence. Error: Incomplete definition of ... . SEQUENCE ) //, generator="seq") @ Id @ SequenceGenerator ( name = "seq" ) ...

 
forum_thread

Conflicting modifiers .... (javax.persistence.Id, javax.persistence.ManyToOne)

I have two classes a Container type class and another class that is 'contained' by that class. The contained class, CompoundKeyMapItem, represents an alternate implementation of an object held in a Map, and uses a Compound Primary Key. The contained class therefore uses an @IdClass. This all works fine on Eclipselink. However when I try and run this in ObjectDb I get the following error; ... (javax.persistence.Id, javax.persistence.ManyToOne) (error 322) at ... (javax.persistence.Id, javax.persistence.ManyToOne) at com.objectdb.o.MSG.d(MSG.java:61) at ... ; import javax. persistence . Id ; import javax. persistence . NamedQueries ; import ...