Internal Website 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: Class ProjectId { int departmentId; long projectId; } ObjectDB does

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

, the following query deletes all the Country instances: int count = em. createQuery ("DELETE FROM ... instances to zero: int count = em. createQuery ("UPDATE Country SET area = 0"). executeUpdate

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

. The combination of the clear and flush methods can be used to save memory in large 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

, int , long , float and double . Equivalent wrapper classes from package java.lang: Boolean , Byte

DELETE Queries in JPA/JPQL

the  executeUpdate method:    int deletedCount = em. createQuery ("DELETE FROM Country

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

javax.persistence.StoredProcedureQuery

.1 int executeUpdate () Return the update count of -1 if there is no pending result or if the first ... exceeds the query timeout value set and the transaction is rolled back Since: JPA 2.1 int getFirstResult ... query Inherited from: Query Since: JPA 2.0 int getMaxResults () The maximum number of results

javax.persistence.Query

. Public Methods int executeUpdate () Execute an update or delete statement. Return: the number ... is rolled back Since: JPA 1.0 int getFirstResult () The position of the first result the query object ... int getMaxResults () The maximum number of results the query object was set to retrieve. Returns

javax.persistence.TypedQuery

- JPA Queries (JPQL / Criteria) explains how to use TypedQuery . Public Methods int executeUpdate ... Since: JPA 1.0 int getFirstResult () The position of the first result the query object was set ... SELECT query or a Criteria API query Inherited from: Query Since: JPA 2.0 int getMaxResults

[ODB1] Chapter 7 - JDOQL Queries

if the field exists but its type cannot be compared with an int value, a JDOUserException is thrown ... objects can be obtained using the size() method: int count = result.size(); Iteration over the result ... class contains a field with the name age and a type comparable to int . This section describes

[ODB1] Chapter 3 - Persistent Classes

, int , long , float and double . Selected classes in package java.lang : Boolean , Byte , Short ... fields of types like int [] or Object[] ). Any class in which a persistent array is modified ... is valid in Java (for example from int to float and from float to int ) the old value is converted

javax.persistence.TableGenerator

", allocationSize=1) @Id @GeneratedValue(strategy=TABLE, generator="empGen") int id; ... } Example 2 ... , generator="addressGen") int id; ... } See Also: GeneratedValue Since: JPA 1.0 The Auto Generated Values article explains how to use TableGenerator . Public Annotation Attributes int allocationSize default

javax.persistence.MapKeyColumn

field or property; "_"; "KEY". Example: @Entity public class Item { @Id int id; ... @ElementCollection ... statements generated by the persistence provider. Since: JPA 2.0 int length default 255 (Optional) The column ... (Optional) Whether the database column is nullable. Since: JPA 2.0 int precision default 0 (Optional

javax.persistence.MapKeyClass

and vice versa. Example 1: @Entity public class Item { @Id int id; ... @ElementCollection ... Item { @Id int id; ... @ElementCollection Map images; ... } Example 3: @Entity public class Company { @Id int id; ... @OneToMany(targetEntity=com.example.VicePresident.class) @MapKeyClass(com.example

javax.persistence.criteria.CriteriaBuilder

,  int  from) Create expression to locate the position of one string ... extraction Since: JPA 2.0 Expression substring ( Expression  x,  int  from) Create ... ( Expression  x,  int  from,  int  len) Create an expression for substring extraction

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

javax.persistence.MapKeyJoinColumn

public class Company { @Id int id; ... @OneToMany // unidirectional @JoinTable(name="COMPANY ... VideoStore { @Id int id; String name; Address location; ... @ElementCollection @CollectionTable(name ... id; String title; ... } Example 3: @Entity public class Student { @Id int studentId; ... @ManyToMany

javax.persistence.OneToOne

: One-to-one association from an embeddable class to another entity. @Entity public class Employee { @Id int id; @Embedded LocationDetails location; ... } @Embeddable public class LocationDetails { int officeNumber; @OneToOne ParkingSpot parkingSpot; ... } @Entity public class ParkingSpot { @Id int id; String garage

javax.persistence.Column

is included in SQL INSERT statements generated by the persistence provider. Since: JPA 1.0 int ... is nullable. Since: JPA 1.0 int precision default 0 (Optional) The precision for a decimal (exact numeric ... when generating the DDL for the column. Since: JPA 1.0 int scale default 0 (Optional) The scale for a decimal

javax.persistence.AssociationOverride

in the ContactInfo class @Entity public class Employee { @Id int id; @AssociationOverride( name ... .class) List phoneNumbers; } @Entity public class PhoneNumber { @Id int number; @ManyToMany(mappedBy

[ODB1] Chapter 2 - A Quick Tour

private int age; 9 10 // Constructors: 11 public Person() {} 12 public Person(String firstName, String lastName, int age) { 13 this.firstName = firstName; 14 this.lastName = lastName; 15 this.age

[ODB1] Chapter 4 - JDO Metadata

contains all the fields with primitive types (e.g. int ), types defined in java.lang (e.g. String ... : embedded value types: primitive type ( boolean , byte , short , char , int , long , float or double

javax.jdo.spi.StateManager

boolean getBooleanField (PersistenceCapable pc,  int  field, boolean  ... Since: JDO 1.0 byte getByteField (PersistenceCapable pc,  int  field, byte  ... for the field Since: JDO 1.0 char getCharField (PersistenceCapable pc,  int  field, char

javax.jdo.spi.PersistenceCapable

Public Methods void jdoCopyFields (Object other,  int [] fieldNumbers) Copy field values ... ( int id, String name, and Float salary) would have the method generated: void ... key field in the ObjectId. For example, an ObjectId class that has three key fields ( int id, String

javax.jdo.FetchPlan

leaving no active fetch group. Return: the FetchPlan Since: JDO 2.0 int getDetachmentOptions ... int getFetchSize () Return the fetch size, or FETCH_SIZE_OPTIMAL if not set, or FETCH_SIZE_GREEDY ... of all currently active fetch groups Since: JDO 2.0 int getMaxFetchDepth () Return the maximum fetch

javax.jdo.identity.IntIdentity

; javax.jdo.identity.IntIdentity This class is for identity with a single int field. Since: JDO 1.0 Public ...  pcClass,  int  key) Constructor with class and key. Parameters: pcClass - the class key - the key Since: JDO 1.0 Public Methods int compareTo (Object o) Determine the ordering

StateManager.setIntField(pc,field,currentValue,newValue) - JDO Method

JDO Method in javax.jdo.spi.StateManager void setIntField (   PersistenceCapable pc,     int  field,     int  currentValue,     int  newValue ) Mark the field as modified by the user. Parameters: pc - the calling

StateManager.getIntField(pc,field,currentValue) - JDO Method

JDO Method in javax.jdo.spi.StateManager int getIntField (   PersistenceCapable pc,     int  field,     int  currentValue ) Return the value for the field. Parameters: pc - the calling PersistenceCapable instance field - the field number

javax.jdo.FetchGroup

of this FetchGroup. Return: the post-load property Since: JDO 2.2 int getRecursionDepth (String  ... Since: JDO 2.2 int hashCode () Return the hashCode for this instance. The hash code should combine ... ;memberName,  int  recursionDepth) Set the recursion-depth for this member. The default is 1

javax.jdo.listener.InstanceLifecycleEvent

NotSerializableException. Since: JDO 2.0 Public Constructors InstanceLifecycleEvent (Object source,  int ... (Object source,  int  type, Object target) Creates a new event object ... " Since: JDO 2.0 int getEventType () Returns the event type that triggered this event. Return

javax.jdo.identity.LongIdentity

key - the key Since: JDO 1.0 Public Methods int compareTo (Object o) Determine the ordering ... class name. Inherited from: SingleFieldIdentity Since: JDO 2.0 int hashCode () Return the cached

StateManager.providedIntField(pc,field,currentValue) - JDO Method

JDO Method in javax.jdo.spi.StateManager void providedIntField (   PersistenceCapable pc,     int  field,     int  currentValue ) The value of the field requested to be provided to the StateManager . Parameters: pc - the calling PersistenceCapable

StateManager.replacingIntField(pc,field) - JDO Method

JDO Method in javax.jdo.spi.StateManager int replacingIntField (   PersistenceCapable pc,     int  field ) The replacement value of the field in the calling instance. Parameters: pc - the calling PersistenceCapable instance field - the field number Return: the new value for the field Since: JDO 1.0

javax.jdo.identity.ObjectIdentity

: pcClass - the class param - the key Since: JDO 1.0 Public Methods int compareTo (Object o ... class name. Return: the target class name. Inherited from: SingleFieldIdentity Since: JDO 2.0 int