ObjectDB Database Search

1-50 of 200 results

How to convert a boolean to an int in the query?

How to convert a boolean to an int in the query? I have five parameters of type boolean in ... for your help galandor Orlov Sergey Consider adding an int field to your entity class, that will sum them. You can calculate it in a JPA lifecycle event . Currently you cannot convert boolean to int in

JPA Entity Fields

(which only affects persistence): @Entity public class EntityWithTransientFields { static int transient1; // not persistent because of static final int transient2 = 0; // not persistent because of final transient int transient3; // not persistent because of transient @Transient int transient4; // not

Defining a JPA Entity Class

; @Entity public class Point { // Persistent Fields: private int x; private int y; // Constructor: Point ( int x, int y) { this.x = x; this.y = y; } // Accessor Methods: public int getX() { return this.x; } public int getY() { return this.y; } // String Representation: @Override public String toString

JPA Primary Key

, char , int , long , float , double . Equivalent wrapper classes from package java.lang: Byte ... (ProjectId.class) public class Project { @Id int departmentId; @Id long projectId; : } When an entity ... can represent primary key values: public class ProjectId { int departmentId; long projectId

Index Definition

; @Entity public class EntityWithSimpleIndex { @Index String indexedField1; @Index ( unique ="true") int indexedField2; // unique @Index ( name ="i3") int indexedField3; @Unique Integer indexedField4 ... : Primitive types: boolean , byte , short , char , int , long , float , double. Equivalent wrapper

Numbers in JPQL and Criteria Queries

of a binary arithmetic operation on an int value and a double value is double . The ABS Function The ABS ... is used as with binary arithmetic operations in Java (e.g. for int and long operands the MOD  ... demonstrate only integer expressions, but all the numeric types ( byte , short , int , long , float

Database Schema Evolution

from int to Date ) the fields are not considered as matching and the new field is initialized ... type to any numeric type. In this context numeric types are: byte , short , char , int , long ... collection or array type, as long as the elements are convertible (e.g. from int [] to ArrayList

Running JPA Queries

method. For example, the following query deletes all the Country instances: int count = em ... all the Country instances to zero: int count = em. createQuery ("UPDATE Country SET area = 0

ObjectDB Object Database Features

System Types (for persistent fields) Primitive types (boolean, byte, short, char, int , long, float ... . Primary Key Data Types Primitives (boolean, byte, short, char, int , long, float and double). Wrappers

Storing JPA Entity Objects

transactions: em. getTransaction (). begin (); for ( int i = 1; i

Strings in JPQL and Criteria Queries

returns the number of characters in the argument string as an int . For example: LENGTH('United

JPA Persistable Types

, byte , short , char , int , long , float and double . Equivalent wrapper classes from package java

DELETE Queries in JPA/JPQL

queries are executed using the  executeUpdate method: int deletedCount = em. createQuery

Literals in JPQL and Criteria Queries

) are also supported. Following are examples of valid numeric literals in JPQL: int : 100, -127, 0, 07777 long

Query Parameters in JPA

(); } The form of ordinal parameters is a question mark (?) followed by a positive int number. Apart from

CRUD Database Operations with JPA

(); for ( int i = 0; i = 100) { em. remove (p); // delete entity } else { p.setX(p.getX() + 100); // update

Comparison in JPQL and Criteria API

, including primitive types ( byte , short , char , int , long , float , double ), wrapper types ( Byte

UPDATE SET Queries in JPA/JPQL

;"UPDATE Country SET population = 0, area = 0");    int updateCount = em. executeUpdate

Chapter 1 - Quick Tour

that contains points in the plane. Each point is represented by an object with two int fields, x and y

Step 2: Define a JPA Entity Class

; private int x; private int y; public Point() { } Point( int x, int y) { this.x = x; this.y = y; } public Long getId() { return id; } public int getX() { return x; } public int getY() { return y; } @Override

Step 2: Define a JPA Entity Class

static final long serialVersionUID = 1L; @Id @GeneratedValue private long id; private int x; private int y; public Point() { } Point( int x, int y) { this.x = x; this.y = y; } public Long getId() { return id; } public int getX() { return x; } public int getY() { return y; } @Override public String

InterfaceRef jakarta.persistence.StoredProcedureQuery

execution exceeds the query timeout value set and the transaction is rolled back Since: JPA 2.1 int ... effect during query execution. Inherited from: Query Since: JPA 3.2 int getFirstResult ... .persistence.criteria.CriteriaQuery} query Inherited from: Query Since: JPA 2.0 int getMaxResults

InterfaceRef jakarta.persistence.Query

. Public Methods int executeUpdate () Execute an update or delete statement. Return: the number ... () The cache storage mode that will be in effect during query execution. Since: JPA 3.2 int getFirstResult ... language SELECT query or a {@link jakarta.persistence.criteria.CriteriaQuery} query Since: JPA 2.0 int

InterfaceRef jakarta.persistence.TypedQuery

- JPA Queries (JPQL / Criteria) explains how to use TypedQuery . Public Methods int executeUpdate ... Since: JPA 3.2 int getFirstResult () The position of the first result the query object was set to retrieve ... Since: JPA 2.0 int getMaxResults () The maximum number of results the query object was set to retrieve

InterfaceRef jakarta.persistence.criteria.CriteriaBuilder

;x,  int  len) Create an expression for the leftmost substring of a string, Parameters: x ... ,  int  from) Create expression to locate the position of one string within another, returning ... Expression right ( Expression  x,  int  len) Create an expression for the rightmost substring

ClassRef jakarta.persistence.Timeout

is always a hint, and may be ignored by the provider. Since: JPA 3.2 Public Methods int milliseconds () The timeout in milliseconds. Since: JPA 3.2 Public Static Methods Timeout milliseconds ( int  milliseconds) Specify a timeout in milliseconds. Since: JPA 3.2 Timeout ms ( int  milliseconds) Specify

AnnotationRef jakarta.persistence.Column

is included in SQL INSERT statements generated by the persistence provider. Since: JPA 1.0 int length default ... , and is not portable across databases. Since: JPA 3.2 int precision default 0 (Optional) The precision ... should be inferred. Since: JPA 1.0 int scale default 0 (Optional) The scale for a column of SQL type

EnumRef jakarta.persistence.GenerationType

key of type Long, Integer, long , or int , the provider selects between TABLE , SEQUENCE ... identity column. May be used to generate primary keys of type Long, Integer, long , or int ... using a database sequence. May be used to generate primary keys of type Long, Integer, long , or int

Step 3: Add a Main Class

= emf.createEntityManager(); // Store 1000 Point objects in the database: em.getTransaction().begin(); for ( int i = 0; i

Step 3: Add a Main Class

.createEntityManager(); // Store 1000 Point objects in the database: em.getTransaction().begin(); for ( int i = 0; i

AnnotationRef jakarta.persistence.MapKeyColumn

generated by the persistence provider. Since: JPA 2.0 int length default 255 (Optional) The column ... which declares this column. May not be used in conjunction with () . Since: JPA 3.2 int precision ... that a provider-determined precision should be inferred. Since: JPA 2.0 int scale default 0 (Optional

AnnotationRef jakarta.persistence.TableGenerator

Annotation Attributes int allocationSize default 50 (Optional) The amount to increment by when allocating ... . Since: JPA 2.1 int initialValue default 0 (Optional) The initial value to be used to initialize the column

AnnotationRef jakarta.persistence.SequenceGenerator

Attributes int allocationSize default 50 (Optional) The amount to increment by when allocating sequence ... of the sequence generator. Since: JPA 2.0 int initialValue default 1 (Optional) The value from

InterfaceRef jakarta.persistence.Tuple

correspond to an element in the query result tuple Since: JPA 2.0 Object get ( int  i) Get the value ... - if i exceeds length of result tuple Since: JPA 2.0 X get ( int  i, Class  type

CriteriaBuilder.substring(x,from,len) - JPA Method

JPA Method in jakarta.persistence.criteria.CriteriaBuilder Expression substring (    Expression  x,     int  from,     int  len ) Create an expression for substring extraction. Extracts a substring of given length starting at the specified

StoredProcedureQuery.registerStoredProcedureParameter(position,type,mode) - JPA Method

JPA Method in jakarta.persistence.StoredProcedureQuery StoredProcedureQuery registerStoredProcedureParameter (    int  position,    Class  type,     ParameterMode  mode ) Register a positional parameter. All parameters must be registered

Timeout.ms(milliseconds) - JPA Static Method

JPA Static Method in jakarta.persistence.Timeout Timeout ms (    int  milliseconds ) Specify a timeout in milliseconds. (Abbreviation of milliseconds .) Since: JPA 3.2

Timeout.milliseconds(milliseconds) - JPA Static Method

JPA Static Method in jakarta.persistence.Timeout Timeout milliseconds (    int  milliseconds ) Specify a timeout in milliseconds. Since: JPA 3.2

Timeout.seconds(seconds) - JPA Static Method

JPA Static Method in jakarta.persistence.Timeout Timeout seconds (    int  seconds ) Specify a timeout in seconds. Since: JPA 3.2

Timeout.s(seconds) - JPA Static Method

JPA Static Method in jakarta.persistence.Timeout Timeout s (    int  seconds ) Specify a timeout in seconds. (Abbreviation of seconds .) Since: JPA 3.2

Timeout.milliseconds() - JPA Method

JPA Method in jakarta.persistence.Timeout int milliseconds () The timeout in milliseconds. Since: JPA 3.2

AnnotationAttrRef jakarta.persistence.Column.secondPrecision

JPA Annotation Attribute in jakarta.persistence.Column int secondPrecision default -1 (Optional) The number of decimal digits to use for storing fractional seconds in a SQL time or timestamp column. Applies only to columns of time or timestamp type. The default value -1 indicates that fractional

Query.getParameter(position,type) - JPA Method

JPA Method in jakarta.persistence.Query Parameter getParameter (    int  position,    Class  type ) Get the parameter object corresponding to the declared positional parameter with the given position and type. This method is not required to be supported by

Query.getParameter(position) - JPA Method

JPA Method in jakarta.persistence.Query Parameter getParameter (    int  position ) Get the parameter object corresponding to the declared positional parameter with the given position. This method is not required to be supported for native queries. Parameters: position - position

Query.getParameterValue(position) - JPA Method

JPA Method in jakarta.persistence.Query Object getParameterValue (    int  position ) Return the input value bound to the positional parameter. (Note that OUT parameters are unbound.) Parameters: position - position Return: parameter value Throws: IllegalStateException

CriteriaBuilder.right(x,len) - JPA Method

JPA Method in jakarta.persistence.criteria.CriteriaBuilder Expression right (    Expression  x,     int  len ) Create an expression for the rightmost substring of a string, Parameters: x - string expression len - length of the substring to return Return: expression for the rightmost substring Since: JPA 2.0

CriteriaBuilder.left(x,len) - JPA Method

JPA Method in jakarta.persistence.criteria.CriteriaBuilder Expression left (    Expression  x,     int  len ) Create an expression for the leftmost substring of a string, Parameters: x - string expression len - length of the substring to return Return: expression for the leftmost substring Since: JPA 2.0

Query.setParameter(position,value,temporalType) - JPA Method

JPA Method in jakarta.persistence.Query Query setParameter (    int  position,    Date value,     TemporalType  temporalType ) Bind an instance of java.util.Date to a positional parameter. Parameters: position - position value - parameter value

Query.setParameter(position,value,temporalType) - JPA Method

JPA Method in jakarta.persistence.Query Query setParameter (    int  position,    Calendar value,     TemporalType  temporalType ) Bind an instance of java.util.Calendar to a positional parameter. Parameters: position - position value

Query.setParameter(position,value) - JPA Method

JPA Method in jakarta.persistence.Query Query setParameter (    int  position,    Object value ) Bind an argument value to a positional parameter. Parameters: position - position value - parameter value Return: the same query instance Throws