ObjectDB Database Search

1-50 of 200 results

Literals in JPQL and Criteria Queries

, including NULL , boolean literals ( TRUE and FALSE ), numeric literals (for example , 100 ), string literals (for example , 'abc' ), enum literals (for example , mypackage.MyEnum.MY_VALUE ), and entity type literals (for example , Country ). Use JPQL literals sparingly. Queries that use parameters

SELECT clause (JPQL / Criteria API)

The ability to retrieve managed entities is a key advantage of JPQL. For example , the following ... . Projection of path expressions JPQL queries can also return results that are not entities. For example ... the FROM clause. Nested path expressions are also supported. For example , the following query retrieves

FROM clause (JPQL / Criteria API)

(you can use type expression to exclude descendant classes from iteration). For example , in ... (for example , Country with no package name). The default name can be overridden by specifying another name ... . For example , the following query returns all pairs of countries that share a common border: SELECT c1

Strings in JPQL and Criteria Queries

String values can appear in JPQL queries in several forms: As string literals , for example , 'abc ... a path expression), and the right operand is the pattern (usually a parameter or literal). For example ... in an ESCAPE clause. For example : '100%' LIKE '%\%' ESCAPE '\' is evaluated to TRUE . '100' LIKE

Retrieving JPA Entities

and its primary key. Given an EntityManager instance em , the following example retrieves an Employee ... method is useful when you need a reference to an entity but not its data, for example , to set ... object, unless the referenced object is already managed by the EntityManager . In the preceding example

JPA Persistable Types

) of their own. This leads to some limitations (for example , their instances cannot be shared by different ... and times: java.sql.Date - represents the date only ( for example , `2019-12-31 `). java.sql.Time - represents the time only ( for example , `23:59:59 `). java.sql.Timestamp - represents both date and time

Numbers in JPQL and Criteria Queries

numeric promotion principles. For example , the result of a binary arithmetic operation on an int value ... of a numeric argument. The result is always a positive number or zero. For example : ABS(-5) evaluates to 5 ... . For example : MOD(11, 3) evaluates to 2 . MOD(8, 4) evaluates to 0 . The MOD function takes two integer

Schema Update

the preceding example , is strict: A element must be a direct child of the element. A element ... within that package. The elements in the example rename the com. example .old1 and com. example .old2 packages. The com. example .old3 package is not renamed, but rename operations are specified for some of its classes

JPA Class Enhancer

(for example , the get and set methods). If you follow this practice, only user-defined persistable ... the syntax of import statements (for example , test.X for a single class or test.pc.* for a package ... with objectdb.jar as a Java agent. For example , if objectdb.jar is in c:\objectdb\bin , the JVM

JPA Entity Fields

-final entity field is persistent by default unless specified otherwise (for example , by using ... , such as Hibernate, or for changing default field settings. For example : @Entity public class ... ( mappedBy ="department") Set employees; } The mappedBy element in the preceding example specifies

Collections in JPQL and Criteria Queries

] EMPTY The IS [NOT] EMPTY operator checks whether a specified collection is empty. For example : c ... (collection) function returns the number of elements in a specified collection. For example : SIZE(c.languages ... . For example : 'English' MEMBER OF c.languages evaluates to TRUE if the languages collection contains

Privacy Policy

the use of the Service or from the Service infrastructure itself (for example , the duration of a page ... gifs) that permit the Company, for example , to count users who have visited those pages or opened an email and for other related website statistics (for example , recording the popularity of a certain

Database Doctor

for several reasons: Hardware failure (for example , a physical hard drive failure or RAM error). Software failure (for example , a bug in the operating system, Java, or ObjectDB). Copying a database file ... . Modifying the database file externally instead of through ObjectDB (for example , with malicious software

Setting and Tuning of JPA Queries

efficient result paging. For example , if each page displays pageSize results and pageId represents ... to all result objects that the query retrieves. For example , the following code sets a pessimistic WRITE ... . For example , setting a query hint on an EntityManager affects all queries that are created by

Storing JPA Entities

. Referenced entities If, however, the Address class in the previous example is an entity class ... ) private Address address; : } In the preceding example , the Employee entity class contains ... a separate persist call. Cascading can continue recursively, for example , to entities that the Address

Database Replication and Clustering

the master database. As shown in the example , you must specify a full URL, including the user ... server. Connecting to the database cluster The configuration example shows a master database managed ... this example . However, if the first URL becomes unavailable, the connection automatically and temporarily

Detached JPA Entities

have limited functionality: Many JPA methods, for example , lock , do not accept detached objects. Retrieval by ... = CascadeType . DETACH ) private Address address; : } In the example above, the Employee entity has an address ... Address address; : } In the example above, the Employee entity has an address field that references

JPA Query Structure (JPQL / Criteria)

operates on Java classes and objects. For example , a JPQL query can retrieve entities, unlike SQL ... . For example , JPQL keywords can be uppercase (e.g., SELECT ) or lowercase (e.g., select ... : SELECT c FROM Country AS c This example demonstrates a minimal JPQL query because the SELECT

JPA Named Queries

, you should choose names carefully to avoid collisions, for example , by using the unique entity name as a prefix. For example , you can add the preceding @NamedQuery to the Country entity class: @Entity ... their named queries by using the JPA 2 Metamodel interface. For example : em. getMetamodel (). managedType

DELETE Queries in JPA/JPQL

. For example , the EntityManager might not be aware that a DELETE query has removed an entity ... . For example , the following three equivalent queries delete all Country instances: DELETE FROM ... . A WHERE clause is supported and is essential for removing specific entities. For example

WHERE clause (JPQL / Criteria API)

this case, the WHERE clause filters these tuples before passing them to the SELECT clause. For example ... it as the WHERE clause predicate, overriding any previously set predicate. For example , the following ... arguments and combines them using a logical AND , overriding any previously set predicate: For example

Query Parameters in JPA

is inferred from the context. In the preceding example , comparing :name to a field of type String ... the application to JPQL injection attacks. For example , suppose the name parameter is received as user input ... the Date and Time (Temporal) Types section. For example , the following invocation passes a Date object

Database Schema Evolution

to the new type (for example , a change from int to Date ), the fields are not considered matching ... , as long as the elements are convertible (for example , from int[] to ArrayList ). From any object ... other map type, as long as the keys and values are convertible (for example , from HashMap to TreeMap ). Any

What's next?

below to create and run the example program from this chapter: These tutorials explain how to run the example program. You can start your own ObjectDB/JPA projects by modifying this example program

Database Transaction Replayer

file, such as my.odb in the example above. ObjectDB automatically locates the corresponding backup ... . You can also run the Replayer up to a specified transaction. For example : $ java -cp objectdb.jar com

Date and Time in JPQL and Criteria Queries

Date and time expressions can appear in JPQL queries in the following ways: As date and time literals --for example , {d '2011-12-31'} and {t '23:59:59'} . As parameters --when date and time values ... , MONTH , DAY , HOUR , MINUTE , and SECOND parts from a date or time value. For example : YEAR({d '2011

Is ObjectDB better than competing object databases?

is also unique in supporting features that are usually available only in relational databases. For example ... that during development you may find that an essential feature is missing. For example , some competing products

Defining a JPA Entity Class

String toString() { return String.format("(%d, %d)", this.x, this.y); } } As the example shows, an entity ... field that is not declared as static or transient is a persistent field. For example , the persistent

jakarta.persistence.Convert

of the attribute of the key or value type that is converted. Example 1: Convert a basic attribute ... ; ... } Example 2: Auto-apply conversion of a basic attribute @Converter(autoApply = true) public class ... id; ... // EmployeeDateConverter is applied automatically EmployeeDate startDate; } Example 3

JPA Criteria Query Expressions

how whitespace should be trimmed ( LEADING , TRAILING , or BOTH ). For more details and examples , see the Query Expressions section in the ObjectDB manual.

JPA Lifecycle Events

Callback methods are user-defined methods that are attached to entity lifecycle events. JPA invokes these methods automatically when the corresponding events occur. Internal callback methods Internal callback methods are defined within an entity class. For example , the following entity class

Apache License, Version 2.0, January 2004

indicated by a copyright notice that is included in or attached to the work (an example is provided

Server Configuration

the connection URL is resolved relative to the data path. For example , objectdb://localhost/my/db

JPA Named Queries Annotations

, cache usage, or fetch graphs. For details and examples , see the JPA Named Queries section

Logical Operators in JPQL and Criteria API

, Boolean expressions are represented by the Expression interface and its descendants. For example

JPA Metamodel Attributes

. For more information on the hierarchy and usage examples , see the Metamodel Attribute Interface Hierarchy section.

JPA Metamodel Types

explanation of the type interface hierarchy and examples , see the Metamodel Type Interface Hierarchy section.

JPA Criteria Queries

: Represents a query embedded within another query (for example , inside a WHERE clause). Unlike a top-level

JPA Metamodel and Graphs

and properties), covering singular, plural (collection), and map attributes. For detailed examples

CRUD Database Operations with JPA

} } em. getTransaction (). commit (); In the preceding example , all the Point objects whose x coordinate

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

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