ObjectDB Database Search

1-50 of 137 results

javax.persistence.GeneratedValue

JPA Annotation GeneratedValue Target: METHOD, FIELD Implemented Interfaces: Annotation Provides for the specification of generation strategies for the values of primary keys. The GeneratedValue ... conjunction with the Id annotation. The use of the GeneratedValue annotation is only required

Auto Generated Values

Marking a field with the @ GeneratedValue annotation specifies that a value will be automatically ... @ GeneratedValue with the AUTO strategy: @Entity public class EntityWithAutoId1 { @Id @ GeneratedValue ... definition is equivalent: @Entity public class EntityWithAutoId2 { @Id @ GeneratedValue long id

javax.persistence.GeneratedValue.strategy

JPA Annotation Attribute in javax.persistence. GeneratedValue GenerationType strategy default AUTO (Optional) The primary key generation strategy that the persistence provider must use to generate the annotated entity primary key. Since: JPA 1.0

javax.persistence.GeneratedValue.generator

JPA Annotation Attribute in javax.persistence. GeneratedValue String generator default "" (Optional) The name of the primary key generator to use as specified in the SequenceGenerator or TableGenerator annotation. Defaults to the id generator supplied by persistence provider. Since: JPA 1.0

JPA Primary Key

a primary key field: @Entity public class Project { @Id @ GeneratedValue long id; // still set ... ; @ GeneratedValue annotation specifies that the primary key is automatically allocated by ObjectDB. Automatic value ... If an entity has a primary key field that is not marked with @ GeneratedValue , automatic primary key

JPA Annotations for Value Generation

Automatically generated values are mainly useful for primary key fields, but are supported by ObjectDB also for regular (non primary key) persistent fields. At the field level, the @ GeneratedValue with an optional GenerationType strategy is specified: The @ GeneratedValue annotation

Persist error @ManyToMany how to define correct entities relationships

too). @Entity public class Product implements Serializable { @Id @ GeneratedValue private long id ... implements Serializable { @Id //@ GeneratedValue private long id; @ManyToMany(cascade=CascadeType.PERSIST ... .persistence. GeneratedValue ; import javax.persistence.Id; import javax.persistence.ManyToMany; import javax

Step 2: Define a JPA Entity Class

; import javax.persistence. GeneratedValue ; import javax.persistence.Id; @Entity public class Guest ... @ GeneratedValue Long id; private String name; private Date signingDate; // Constructors: public

Step 2: Define a JPA Entity Class

. GeneratedValue ; import javax.persistence.Id; @Entity public class Guest implements Serializable { private static final long serialVersionUID = 1L; // Persistent Fields: @Id @ GeneratedValue Long id; private

Step 2: Entity Class and Persistence Unit

.Serializable; import java.sql.Date; import javax.persistence.Entity; import javax.persistence. GeneratedValue ... final long serialVersionUID = 1L; // Persistent Fields: @Id @ GeneratedValue Long id; private String

Step 2: Entity Class and Persistence Unit

. GeneratedValue ; import javax.persistence.Id; @Entity public class Guest implements Serializable { private static final long serialVersionUID = 1L; // Persistent Fields: @Id @ GeneratedValue Long id; private

Step 2: Entity Class and Persistence Unit

. GeneratedValue ; import javax.persistence.Id; @Entity public class Guest implements Serializable { private static final long serialVersionUID = 1L; // Persistent Fields: @Id @ GeneratedValue Long id; private String

Step 2: Entity Class and Persistence Unit

. GeneratedValue ; import javax.persistence.Id; @Entity public class Guest implements Serializable { private static final long serialVersionUID = 1L; // Persistent Fields: @Id @ GeneratedValue Long id

Error 363 - Failed to read value of inverse relationship

I've got two objects: @Entity public class EEvent { @Id @ GeneratedValue (strategy = GenerationType ... implements Serializable { private static final long serialVersionUID = 1L; @Id @ GeneratedValue private Long ... @ GeneratedValue private Long id; @Temporal(TemporalType.TIMESTAMP) private Date sendDate = new Date

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

.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence. GeneratedValue ; import ... ;          @Id @ GeneratedValue private long id;   ... Serializable {             @Id @ GeneratedValue

Find the error...JPA ENTITY HIBERNATE

.persistence.FetchType; import javax.persistence. GeneratedValue ; import javax.persistence.GenerationType ... Serializable { private static final long serialVersionUID = 1L; // @ GeneratedValue @Id @Column(name = "id") @ GeneratedValue (strategy = GenerationType.IDENTITY) private int id; @Column(name = "username") private

javax.persistence.TableGenerator

for the GeneratedValue annotation. A table generator may be specified on the entity class or ... ", allocationSize=1) @Id @ GeneratedValue (strategy=TABLE, generator="empGen") int id; ... } Example 2 ... _KEY", valueColumnName="GEN_VALUE", pkColumnValue="ADDR_ID") @Id @ GeneratedValue (strategy=TABLE

Uninitialized primary key (id = 0)

with no  @ GeneratedValue  and you do not initialize it manually. support Support Yes, at first, there is no @ GeneratedValue , but it do not work after I add this command: @ GeneratedValue ... ; @ GeneratedValue should solve the problem, unless you already have entity objects with IDs 0

EmbeddedId with Generated field value

annotation @ GeneratedValue like the following: Solution 1) class A { @Id @ GeneratedValue private long uid; ... } Solution 2) class CompositePK { @ GeneratedValue private long uid; ... } Actually I ... ) @Entity public static class A {     @Id @ GeneratedValue public long id;   

@OneToMany(fetch = FetchType.LAZY) list is always null

= "b", allocationSize = 1) public class Parent { @Id @ GeneratedValue (strategy = GenerationType.SEQUENCE ... @ GeneratedValue (strategy = GenerationType.SEQUENCE, generator = "b") private int id; @ManyToOne ... ;EntityManagerFactory), it fails. Entities: @Entity public class Parent { @Id @ GeneratedValue (strategy

General Performance Issues Illustrated with a Specific Method

.persistence. GeneratedValue ; import javax.persistence.GenerationType; import javax.persistence.Id ... public class Client implements Serializable , Identifiable { // @Id @ GeneratedValue (strategy ... ; import javax.persistence. GeneratedValue ; import javax.persistence.GenerationType; import javax

Step 2: Define a JPA Entity Class

Serializable { private static final long serialVersionUID = 1L; @Id @ GeneratedValue private long id

Step 2: Define a JPA Entity Class

static final long serialVersionUID = 1L; @Id @ GeneratedValue private long id; private int x; private

Criteria query error: Unexpected query token

long serialVersionUID = -7979088681300801112L; /** * Primary key for entity */ @Id // @ GeneratedValue ... ", initialValue = 1, allocationSize = 50) // @ GeneratedValue (strategy = GenerationType.SEQUENCE) @ GeneratedValue private Long id; /** * Version of object, supporting optimistic lock */ @Column (name = "opt

Can a Set be a foreign key?

{     @Id @ GeneratedValue     private long characterId;   ... characterLocation; and: @Entity public class Cell {     @Id @ GeneratedValue    ... {     @Id @ GeneratedValue     private long cellID;  

ID format in objectdb 2.x for JDOHelper.getObjectId

: private @Id @ GeneratedValue long id; // JPA code and then the ID will be injected automatically ... @Id @ GeneratedValue long id; but i think it only works in case of JPA not with JDO. Do you the any ... anyway:     @Id @ GeneratedValue     private long id; This should work

How to use JOIN FETCH?

javax.persistence. GeneratedValue ; import javax.persistence.Id; import javax.persistence ... class Person {   @Id @ GeneratedValue private long id;   private String name;   ... ;   } } @Entity public static class Address {   @Id @ GeneratedValue private long id;  

List of Enum Values in an entity

; import javax.persistence. GeneratedValue ; import javax.persistence.Id; import org.eummcr.datastore ... implements Serializable { private static final long  serialVersionUID = 1L; @Id @ GeneratedValue ... ;      @Id @ GeneratedValue Long id;       

Merge with Parent/Child entities not possible

. GeneratedValue ; import javax.persistence.Id; import javax.persistence.ManyToOne; import javax ... {   @Id   @ GeneratedValue   private long id;   @OneToMany(fetch = FetchType.LAZY ... ;   } } @Entity public static class ChildEntity {   @Id   @ GeneratedValue   private

Is it possible to remove parent/child entities without refresh?

.FetchType; import javax.persistence.FlushModeType; import javax.persistence. GeneratedValue ; import javax ... { @Entity public static class ParentEntity {   @Id   @ GeneratedValue   private long id ... ; @Id   @ GeneratedValue   private long id;   @ManyToOne(fetch = FetchType.LAZY

Remove an entity which attributes were changed - OptimisticLockException

;   @Id @ GeneratedValue long id;         int value ... .EntityManagerFactory; import javax.persistence. GeneratedValue ; import javax.persistence.Id; import javax.persistence ... ;     @ GeneratedValue         long id;  

Database Inconsistency or corruption

.IObjectValue {   @javax.persistence.Id   @javax.persistence. GeneratedValue (strategy ... ; @javax.persistence. GeneratedValue (strategy=javax.persistence.GenerationType.TABLE, generator ... ; @javax.persistence. GeneratedValue (strategy = javax.persistence.GenerationType.TABLE, generator

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 ... ") public List addresses; } @Entity public class Address { @Id @ GeneratedValue (strategy = GenerationType

Does ObjectDB support lazy loading?

A { @Id @ GeneratedValue Long id; @OneToMany(fetch=FetchType.LAZY, cascade=CascadeType.ALL) List list; } @Entity static class B { @Id @ GeneratedValue public Long id; int value; B(int value

@SequenceGenerator and single id in whole database

both the strategy and the generator attributes of the @ GeneratedValue annotation. By using the IDENTITY ... (name = "XXX", sequenceName = "Seq_XXX", initialValue = 1000) @ GeneratedValue (generator = "XXX") @Id

Error 613 - i cant put a list into a Squad object

.persistence.Entity; import javax.persistence. GeneratedValue ; import javax.persistence.Id; import javax ... ;@ GeneratedValue     private long id;     private int squadId

On ensuring ID available after persist

up to another element) I am using the following for the ID: @Id //@ GeneratedValue (strategy = GenerationType.AUTO)// Explicit for EclipseLink + Oracle or MySQL @ GeneratedValue //ObjectDB takes as AUTO public Long getId

Mysterious "Attempt to persist a reference to a non managed instance" error

.util.Map; import javax.persistence.Entity; import javax.persistence. GeneratedValue ; import javax ... Index implements Serializable {     @Id @ GeneratedValue private long id;   

Items in list are doubled, when the entity class is not enhanced

implements Serializable { private static final long serialVersionUID = 1L; @Id @ GeneratedValue private Long ... static final long serialVersionUID = 1L; @Id @ GeneratedValue private Long id; @ManyToOne private

Version 2.2.7 build 7/8 issue

Serializable { private static final long serialVersionUID = 1L; @Id @ GeneratedValue private Long id ... Serializable { private static final long serialVersionUID = 1L; @Id @ GeneratedValue private Long id

Join query problem with new statetment

BaseEntity implements Serializable, Convertable {     @ GeneratedValue (strategy ... , Convertable {     @ GeneratedValue (strategy = GenerationType.AUTO)     

Bug: ClassCastException by retrieval

.persistence. GeneratedValue ; import javax.persistence.GenerationType; import javax.persistence.Id ... class Node { @Id     @ GeneratedValue (strategy=GenerationType.IDENTITY) int id

@MappedSuperclass and @Transient not working as I expected

.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence. GeneratedValue ... @ GeneratedValue protected int id; @Version protected long version; @Transient protected EntityManagerFactory emf

"Unsupported auto value type java.lang.String" when persisting new instance

for primary key: @Id @ GeneratedValue (strategy=GenerationType.IDENTITY) private String ID; kiki Kristijan You cannot use @ GeneratedValue for string Id only for numeric Ids. Id fields whose type is string have to be assigned a value by the application. support Support

can't get HashMap out of the database

Fields: @Id @ GeneratedValue Long id; private String name; private Date signingDate; private HashMap ... class GuestHolder { // Persistent Fields: @Id @ GeneratedValue Long id; @OneToMany(fetch=FetchType

javax.persistence.GenerationType

JPA Enum GenerationType java.lang.Object ∟  java.lang.Enum ∟  javax.persistence.GenerationType Defines the types of primary key generation strategies. See Also: GeneratedValue Since: JPA 1.0 The Auto Generated Values article explains how to use GenerationType . Enum Constants AUTO

javax.persistence.Id

: @Id public Long getId() { return id; } See Also: Column GeneratedValue Since: JPA 1.0 The JPA

javax.persistence.SequenceGenerator

JPA Annotation SequenceGenerator Target: TYPE, METHOD, FIELD Implemented Interfaces: Annotation Defines a primary key generator that may be referenced by name when a generator element is specified for the GeneratedValue annotation. A sequence generator may be specified on the entity class or

New entity objects are duplicated on merge cascading

        @ GeneratedValue (strategy = GenerationType.AUTO)    ... ; @Id         @ GeneratedValue (strategy = GenerationType.AUTO ... A {         @Id @ GeneratedValue long id;     

Inverse OneToMany Mapping and EmbeddedId

; import javax.persistence . EntityManager ; import javax.persistence . GeneratedValue ; import javax ... A {          @Id          @ GeneratedValue ... ;   @Id          @ GeneratedValue ( strategy = IDENTITY )