ObjectDB Database Search

51-100 of 200 results

JPA Metamodel API Types

The following interfaces and enum represent types in the JPA Metamodel API:  See the Metamodel Type Interface Hierarchy section for more details and examples .

JPA Named Queries

Metamodel interface. For example : em. getMetamodel (). managedType (MyEntity.class); Following

Defining a JPA Entity Class

, any field that is not declared as static or transient is a persistent field. For example

JPA Metamodel API

variables in the FROM clause: See the JPA Metamodel API page (in the ObjectDB manual) for more details and examples .

What's next?

This chapter introduced the basic principles of JPA using ObjectDB. You can go into details by reading the other chapters of this manual. If you prefer to get started with ObjectDB right away you can follow one of the following tutorials to create and run the example program that was described in

CRUD Database Operations with JPA

entity } } em. getTransaction (). commit (); In the above example all the Point objects whose x

Chapter 6 - Configuration

changes the value of $objectdb . For example , in a web application, in which objectdb.jar is located in

Posting Sample Code

and runnable). You may use the following example as an initial template for your test case: package

Server User List

. For example , a value "192.18.0.0-192.18.194.255,127.0.0.1" allows connecting from any IP address in

jakarta.persistence.MapKeyClass

is not used when MapKeyClass is specified and vice versa. Example 1: @Entity public class Item { @Id int ... ; // map from image name to image filename ... } Example 2: // MapKeyClass and target type of relationship ... ; ... } Example 3: @Entity public class Company { @Id int id; ... @OneToMany(targetEntity = com. example

jakarta.persistence.Column

field. If no Column annotation is explicitly specified, the default values apply. Example 1: @Column ... ; } Example 2: @Column(name = "DESC", columnDefinition = "CLOB NOT NULL", table = "EMP_DETAIL") @Lob public String getDescription() { return description; } Example 3: @Column(name = "ORDER_COST", updatable

jakarta.persistence.MapKeyJoinColumn

and the default values apply. Example 1: @Entity public class Company { @Id int id; ... @OneToMany ... ") Map organization; } Example 2: @Entity public class VideoStore { @Id int id; String name; Address ... ; ... } Example 3: @Entity public class Student { @Id int studentId; ... @ManyToMany // students and courses

jakarta.persistence.ManyToMany

notation is the name of the respective embedded field or property. Example 1: // In Customer class ... PhoneNumber class: @ManyToMany(mappedBy = "phones") public Set getCustomers() { return customers; } Example ... , mappedBy = "phones") public Set getCustomers() { return customers; } Example 3: // In Customer class

jakarta.persistence.Embeddable

or property of an embeddable class which is not persistent. Example 1: @Embeddable public class ... ; ... } Example 2: @Embeddable public class PhoneNumber { protected String areaCode; protected String ... PhoneServiceProvider { @Id protected String name; ... } Example 3: @Embeddable public class Address { protected

jakarta.persistence.AttributeOverride

the same as in the original mapping. Example 1: @MappedSuperclass public class Employee { @Id protected ... ) { ... } } Example 2: @Embeddable public class Address { protected String street; protected String city ... protected Address address; ... } Example 3: @Entity public class PropertyRecord { @EmbeddedId protected

jakarta.persistence.OneToOne

property. Example 1: One-to-one association that maps a foreign key column // On Customer class: @OneToOne ... customer; } Example 2: One-to-one association that assumes both the source and target share the same ... Integer id; ... } Example 3: One-to-one association from an embeddable class to another entity. @Entity

jakarta.persistence.OneToMany

, the cascade element and the orphanRemoval element apply to the map value. Example 1: One-to-Many ... ", nullable = false) public Customer getCustomer() { return customer; } Example 2: One-to-Many association ... ; } Example 3: Unidirectional One-to-Many association using a foreign key mapping // In Customer class

jakarta.persistence.OrderBy

. Example 1: @Entity public class Course { ... @ManyToMany @OrderBy("lastname ASC") public List getStudents() { ... } ... } Example 2: @Entity public class Student { ... @ManyToMany(mappedBy = "students") @OrderBy // ordering by primary key is assumed public List getCourses() { ... } ... } Example 3

jakarta.persistence.GeneratedValue

primary keys is not supported. Example 1: @Id @GeneratedValue(strategy = SEQUENCE, generator = "CUST_SEQ") @Column(name = "CUST_ID") public Long getId() { return id; } Example 2: @Id @GeneratedValue

jakarta.persistence.Lob

it defaults to CLOB ; for all other types it defaults to BLOB . Example 1: @Lob @Basic(fetch = LAZY) @Column(name = "REPORT") protected String report; Example 2: @Lob @Basic(fetch = LAZY) @Column(name

jakarta.persistence.JoinColumn

and the default values apply. Example : @ManyToOne @JoinColumn(name = "ADDR_ID") public Address getAddress() { return address; } Example : unidirectional one-to-many association using a foreign key mapping // In

jakarta.persistence.MapKeyColumn

of the following: the name of the referencing relationship field or property; " _ "; " KEY ". Example : @Entity ... is parameterized by length, for example , varchar or varbinary types. Default: 255 Since: Jakarta

jakarta.persistence.MapKey

when MapKey is specified and vice versa. Example 1: @Entity public class Department { ... @OneToMany ... ") public Department getDepartment() { ... } ... } Example 2: @Entity public class Department

jakarta.persistence.ManyToOne

with the dot notation is the name of the respective embedded field or property. Example 1: @ManyToOne(optional ... getCustomer() { return customer; } Example 2: @Entity public class Employee { @Id int id; @Embedded JobInfo

jakarta.persistence.EmbeddedId

. Relationship mappings defined within an embedded primary key type are not supported. Example 1: @Entity public ... empName, Date birthDay) {} Example 2: @Embeddable public class DependentId { String name; EmployeeId

jakarta.persistence.Basic

annotation. Example 1: @Basic protected String name; Example 2: @Basic(fetch = LAZY) protected String

jakarta.persistence.AssociationOverride

its join columns. Example 1: Overriding the mapping of a relationship defined by a mapped superclass ... { ... } Example 2: Overriding the mapping for phoneNumbers defined in the ContactInfo class @Entity public class

jakarta.persistence.SecondaryTables

Jakarta Persistence (JPA) Annotation Type jakarta.persistence.SecondaryTables Implemented Interfaces: Annotation Target: Type Specifies multiple secondary tables for an entity. Example 1: Multiple ... _HIST")}) public class Employee { ... } Example 2: Multiple secondary tables with differently named

jakarta.persistence.SecondaryTable

, and have the same names and types as the referenced primary key columns of the primary table. Example 1: Single ... { ... } Example 2: Single secondary table with multiple primary key columns. @Entity @Table(name

jakarta.persistence.TableGenerator

annotation. Example 1: @Entity public class Employee { ... @TableGenerator( name = "empGen", table ... ", allocationSize = 1) @Id @GeneratedValue(strategy = TABLE, generator = "empGen") int id; ... } Example 2

jakarta.persistence.Id

or field. Example : @Id public Long getId() { return id; } See Also: Column GeneratedValue

jakarta.persistence.IdClass

to be annotated. Example : @IdClass(EmployeePK.class) @Entity public class Employee { @Id String empName; @Id

jakarta.persistence.ForeignKey

the target database for foreign key constraint creation. For example , it might be similar to the following

jakarta.persistence.JoinTable

) using an underscore. Example : @JoinTable( name = "CUST_PHONE", joinColumns = @JoinColumn(name = "CUST_ID

jakarta.persistence.Inheritance

is used. Example : @Entity @Inheritance(strategy = JOINED) public class Customer { ... } @Entity public

jakarta.persistence.JoinColumns

specify both name and referencedColumnName . Example : @ManyToOne @JoinColumns({ @JoinColumn(name

jakarta.persistence.MapKeyEnumerated

, the enumerated type is assumed to be ORDINAL . Example : public enum ProjectStatus {COMPLETE, DELAYED, CANCELLED

jakarta.persistence.MapKeyTemporal

with the ElementCollection , OneToMany , or ManyToMany annotation. Example : @OneToMany @MapKeyTemporal(DATE

jakarta.persistence.MapsId

specified. In this example , the parent entity has simple primary key: @Entity public class Employee

jakarta.persistence.MappedSuperclass

. Example : Concrete class as a mapped superclass @MappedSuperclass public class Employee { @Id

jakarta.persistence.ConstructorResult

is retrieved for the constructed object. Example : Query q = em.createNativeQuery( "SELECT c.id, c.name

jakarta.persistence.ColumnResult

can be included in the query result by specifying this annotation in the metadata. Example : Query q = em

jakarta.persistence.Embedded

may be used to override mappings declared or defaulted by the embeddable class. Example : @Embedded

jakarta.persistence.DiscriminatorColumn

to DiscriminatorType.STRING . Example : @Entity @Table(name = "CUST") @Inheritance(strategy = SINGLE_TABLE

jakarta.persistence.ElementCollection

. The CollectionTable annotation specifies a mapping to a database table. Example : @Entity public class

jakarta.persistence.DiscriminatorValue

, should be specified for each concrete entity class in the hierarchy. Example : @Entity @Table(name = "CUST

jakarta.persistence.EntityResult

. Example : Query q = em.createNativeQuery( "SELECT o.id, o.quantity, o.item, " + "i.id, i.name, i

jakarta.persistence.FetchType

is permitted to eagerly fetch data for which the LAZY strategy hint has been specified. Example

Step 3: Define a Spring DAO Component

the application to the Spring Framework. For instance, in this example the Spring container: Manages

Step 3: Define a Spring DAO Component

the application to the Spring Framework. For instance, in this example the Spring container: Manages