Internal Website Search

1-50 of 200 results

JPA Annotations

JPA defines dozens of annotations that can be divided into the following groups: Annotations for JPA aware classes: Annotations for fields in JPA persistable classes: Annotations for additional JPA configuration: Annotations for JPA lifecycle event callbacks: Java EE container annotations : Many

JPA Annotations for Relationships

. The four relationship modes are represented by the following annotations : Unlike ORM JPA implementations, ObjectDB does not enforce specifying any of the annotations above. Specifying a relationship annotation enables configuring cascade and fetch policy, using the following enum types: Additional

JPA Annotations for Fields

The way a field of a persistable class is managed by JPA can be set by the following annotations : Additional annotations (and enum) are designated for enum fields: Other additional annotations (and enum) are designated for date and calendar fields: Chapter 2 of the ObjectDB manual explains how to use all the above annotations .

JPA Annotations for Classes

JPA defines three types of persistable classes which are set by the following annotations : Chapter 2 of the ObjectDB manual explains these annotations in detail. Entity and mapped super classes can be further configured by annotations that specify cache preferences and lifecycle event listener

JPA Annotations for Callback Methods

The following annotations can mark methods as JPA callback methods: The Lifecycle Events section of the ObjectDB Manual explains how to use all these annotations on callback methods and with listener classes.

JPA Annotations for JPQL Queries

The following annotations are used to define static named JPA queries: The JPA Named Queries section of the ObjectDB Manual explains and demonstrates how to use these annotations to define named JPQL queries.

JPA Annotations for Value Generation

with an optional GenerationType strategy is specified: The @GeneratedValue annotation can also reference a value generator, which is defined at the class level by using one of the following annotations

JPA Annotations for SQL Queries

The following JPA annotations are designated for SQL queries on relational databases: ObjectDB supports only the preferred JPA query language, JPQL, and silently ignores all the above annotations .

JPA Annotations for Mapping (ORM)

The following JPA annotations and enums are designated for mapping a JPA object model to a relational database, and are not required by ObjectDB: ObjectDB silently ignores all the above annotations .

JPA Annotations for Java EE

The following JPA annotations are in use to integrate JPA into a Java EE application and are managed by the Java EE container:

JPA Annotations for Access Modes

Persistence fields can either be accessed by JPA directly (as fields) or indirectly (as properties and get/set methods). JPA 2 provides an annotation and an enum for setting the access mode: More details are provided in chapter 2 of the ObjectDB manual.

JPA Entity Fields

either the Java transient modifier (which also affects serialization) or the JPA @Transient annotation ... the @Transient annotation ). Storing an entity object in the database does not store methods or code ... ). Every persistent field can be marked with one of the following annotations : OneToOne , ManyToOne

Index Definition

definition uses JDO’s @Index and @Unique annotations to define indexes (JPA's @Index  cannot be applied to fields): import javax.jdo. annotations .Index; import javax.jdo. annotations .Unique ... of the @Index or @Unique annotations : @Entity @Index ( members ={"lastName","firstName"}) public class

JPA Lifecycle Events

, package and private ) but should not be static . The annotation specifies when the callback method ... it with more than one annotation . By default, a callback method in a super entity class is also invoked for entity ... annotation : @Entity @EntityListeners (MyListener.class) public class MyEntityWithListener { } Multiple

JPA Persistable Types

way to declare a class as an entity is to mark it with the Entity annotation : import javax ... can be set explicitly by using the name attribute of the Entity annotation : @Entity ( name ="MyName ... object. A class is declared as embeddable by marking it with the Embeddable annotation : @Embeddable

Auto Generated Values

Marking a field with the @GeneratedValue annotation specifies that a value will be automatically ... also supports this annotation for non-key numeric persistent fields as well. Several different value generation ... number generator is also used to generate numeric values for primary key fields annotated by

JPA Named Queries

and @NamedQueries Annotations The following  @NamedQuery annotation defines a query ... : @NamedQuery ( name ="Country.findAll", query ="SELECT c FROM Country c") The  @NamedQuery annotation ... for the  setLockMode and  setHint methods. Every  @NamedQuery annotation is attached

JPA Persistence Unit

that are added to the default META-INF/orm.xml mapping file. Every annotation that is described in ... to annotations . Both JPA mapping files and JDO package.jdo files are supported. This manual focuses on using annotations which are more common and usually more convenient. Details on using XML metadata

JPA Primary Key

automatically : } The @Id annotation marks a field as a primary key field. When a primary key field is defined ... ; @GeneratedValue annotation specifies that the primary key is automatically allocated by ObjectDB. Automatic value ... class using the @IdClass annotation . The ID class reflects the primary key fields and its objects

JDO Annotations for Index Definition

The following annotations are used to define indexes on persistent fields: The Index Definition section of the ObjectDB manual explains these annotations in details.

JDO Annotations for Mapping (ORM)

The following JDO annotations and enums are designated for mapping a JDO object model to a relational database, and are not required by ObjectDB: ObjectDB silently ignores all the above annotations .

JDO Annotations for Classes

JDO supports two modes of persistable classes that can be set by the following annotations : Non persistable classes that should be enhanced (because of accessing persistent fields of other classes directly) can be marked with: The identity mode of persistence capable classes can be specified by using:

Miscellaneous JDO Annotations

This section contains miscellaneous JDO annotations and associated enum types:

JDO Annotations for Fields

The way a field of a persistable class is managed by JDO can be set by the following annotations and enum types:

JDO Annotations for Fetch Settings

The following annotations are used to define JDO fetch groups and fetch plans:

JDO Annotations

JDO defines dozens of annotations that can be divided into the following groups:

Step 4: Add a Controller Class

. annotation .Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind. annotation .RequestMapping; import org.springframework.web.servlet.ModelAndView; @Controller ... ); } } The GuestController class is defined as a Spring managed web controller using the @Controller annotation

Step 4: Add a Controller Class

.http.HttpServletRequest; import org.springframework.beans.factory. annotation .Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind. annotation .RequestMapping ... a Spring managed web controller using the @Controller annotation . A GuestDao component

Step 3: Define a Spring DAO Component

.transaction. annotation .Transactional; @Component public class GuestDao { // Injected database ... it into the  em field (because it is annotated with the  @PersistenceContext annotation ). Handles transactions automatically for methods that are annotated with the  @Transactional

Step 3: Define a Spring DAO Component

.springframework.transaction. annotation .Transactional; @Component public class GuestDao { // Injected database ... it into the  em field (because it is annotated with the  @PersistenceContext annotation ). Handles transactions automatically for methods that are annotated with the @Transactional annotation

javax.jdo.annotations.Persistent

JDO Annotation Persistent Target: ElementType.FIELD, ElementType.METHOD Implemented Interfaces: Annotation Annotation for defining the persistence of a member. This corresponds to the xml elements "field" and "property". Since: JDO 2.1 Public Annotation Attributes String cacheable default "true

javax.jdo.annotations.PersistenceCapable

JDO Annotation PersistenceCapable Target: ElementType.TYPE Implemented Interfaces: Annotation Annotation for whether the class or interface is persistence-capable. Since: JDO 2.1 Public Annotation ... Persistent [] members default {} Member declarations. Annotations for persistent members

javax.jdo.annotations.PersistenceAware

JDO Annotation PersistenceAware Target: ElementType.TYPE Implemented Interfaces: Annotation Annotation to specify that the class is persistence-aware. If used, this is the only JDO annotation ... " of the "class" element. Since: JDO 2.1 This annotation is a marker annotation (with no attributes).

javax.jdo.annotations.NotPersistent

JDO Annotation NotPersistent Target: ElementType.FIELD, ElementType.METHOD Implemented Interfaces: Annotation Annotation to specify that the member is not persistent. If used, this is the only JDO annotation allowed on a member. This corresponds to the xml attribute persistence-modifier

javax.jdo.annotations.Transactional

JDO Annotation Transactional Target: ElementType.FIELD, ElementType.METHOD Implemented Interfaces: Annotation Annotation to indicate that a member (field or property) is transactional but not ... " and "property" elements. Since: JDO 2.1 This annotation is a marker annotation (with no attributes).

javax.jdo.annotations.Serialized

JDO Annotation Serialized Target: ElementType.FIELD, ElementType.METHOD Implemented Interfaces: Annotation Annotation on a member (field or property) to indicate that the member is stored serialized ... .1 This annotation is a marker annotation (with no attributes).

javax.jdo.annotations.Unique

JDO Annotation Unique Target: ElementType.TYPE, ElementType.FIELD, ElementType.METHOD Implemented Interfaces: Annotation Annotation for a database unique constraint. Used for database schema ... Annotation Attributes Column [] columns default {} Columns that compose this unique constraint

javax.jdo.annotations.Columns

JDO Annotation Columns Target: ElementType.FIELD, ElementType.METHOD, ElementType.TYPE Implemented Interfaces: Annotation Annotation for a group of columns. Since: JDO 2.1 Public Annotation Attributes Column [] value default null The columns annotation information. Since: JDO 2.1

javax.jdo.annotations.Index

JDO Annotation Index Target: ElementType.TYPE, ElementType.FIELD, ElementType.METHOD Implemented Interfaces: Annotation Annotation for a database index. Used for database schema generation to create indexes. Corresponds to the xml element "index". Since: JDO 2.1 Public Annotation Attributes Column

javax.jdo.annotations.EmbeddedOnly

JDO Annotation EmbeddedOnly Target: ElementType.TYPE Implemented Interfaces: Annotation Annotation for whether the class is only for persisting embedded into another object. Same as specifying @PersistenceCapable(embeddedOnly="true"). Since: JDO 2.1 This annotation is a marker annotation (with no attributes).

javax.jdo.annotations.ForeignKey

JDO Annotation ForeignKey Target: ElementType.TYPE, ElementType.FIELD, ElementType.METHOD Implemented Interfaces: Annotation Annotation for a database foreign-key. Corresponds to the xml element "foreign-key". Since: JDO 2.1 Public Annotation Attributes Column [] columns default {} Columns

javax.jdo.annotations.Uniques

JDO Annotation Uniques Target: ElementType.TYPE Implemented Interfaces: Annotation Annotation for a group of unique constraints. Since: JDO 2.1 Public Annotation Attributes Unique [] value default null The unique constraints. Since: JDO 2.1

javax.jdo.annotations.Value

JDO Annotation Value Target: ElementType.FIELD, ElementType.METHOD Implemented Interfaces: Annotation Annotation for the value of a map relation. Corresponds to the xml element "value". Since: JDO 2.1 Public Annotation Attributes String column default "" Name of the column to store the value in

javax.jdo.annotations.Queries

JDO Annotation Queries Target: ElementType.TYPE Implemented Interfaces: Annotation Annotation for a group of named queries. Since: JDO 2.1 Public Annotation Attributes Query[] value default null The named queries Since: JDO 2.1

javax.jdo.annotations.PrimaryKey

JDO Annotation PrimaryKey Target: ElementType.TYPE, ElementType.FIELD, ElementType.METHOD Implemented Interfaces: Annotation Annotation on a member to define it as a primary key member of a class or ... of a secondary table. Corresponds to the xml element "primary-key". Since: JDO 2.1 Public Annotation

javax.jdo.annotations.PersistenceCapable.members

JDO Annotation Attribute in javax.jdo. annotations .PersistenceCapable Persistent [] members default {} Member declarations. Annotations for persistent members of this class or interface can be specifed either here or on each member. Annotations for inherited members can only be specified here. Since: JDO 2.1

javax.jdo.annotations.Order

JDO Annotation Order Target: ElementType.FIELD, ElementType.METHOD Implemented Interfaces: Annotation Annotation for the ordering component of an ordered container member, such as Java Collections ... ". Since: JDO 2.1 Public Annotation Attributes String column default "" The name of the column to use

javax.jdo.annotations.Joins

JDO Annotation Joins Target: ElementType.TYPE Implemented Interfaces: Annotation Annotation for a group of joins. Since: JDO 2.1 Public Annotation Attributes Join [] value default null The join definitions used for the mapping of this type. Joins for secondary tables are usually defined

javax.jdo.annotations.Key

JDO Annotation Key Target: ElementType.FIELD, ElementType.METHOD Implemented Interfaces: Annotation Annotation for the key of a map relation. Corresponds to the xml element "key". Since: JDO 2.1 Public Annotation Attributes String column default "" Name of the column to store the key in

javax.jdo.annotations.Version

JDO Annotation Version Target: ElementType.TYPE Implemented Interfaces: Annotation Annotation for the versioning of the class. Corresponds to the xml element "version" of the "class" and "property" elements. Since: JDO 2.1 Public Annotation Attributes String column default "" Name of the column