Internal Website Search

1-50 of 200 results

Strings in JPQL and Criteria Queries

String values may appear in JPQL queries in various forms: as  string literals - e.g. 'abc' , ''. as parameters - when string values are assigned as arguments. as  path expressions - in navigation to persistent string fields. as results of predefined JPQL string manipulation functions

Inserted entities with strings as keys and indices needs more and more ram memory in comparing to primitive integers as keys and indices

Hello, I have a problem with inserting of many entities. We use strings as primary key and indices ... . Can you explain this and do you have an idea for the case that strings are used for keys and indices? See both examples. btc_es BTC EmbeddedSystems Correction. The case with strings as primary key

String Encoding Issue

Hi all Encounter a character encoding issue when i try to retrieve a String column containing Chinese character. Retrieve a String column on odb file.  em = emf.createEntityManager(); Query ... ();) {     System.out.println(itr.next().getName()); // name is a string column

Memory consumption of empty Strings

for an enhancement of objectdb: My program has several entities which contain many String . Often some of these String are empty (""). To avoid unnecessary memory consumption, the String within the entities are initialized like: String firstName = ""; In this case every "empty" attribute shares the same String

Possible issue with String fields

to commit transaction: String index out of range: 5 (error 613) at com.objectdb.jpa.EMImpl.commit ... .StringIndexOutOfBoundsException: String index out of range: 5 at java.lang. String .charAt( String .java:695) at com.objectdb.o.SYH ... When I comment out the fields that are strings all works out fine. I tried replacing the jdbc field

failure to enforce NOT NULL for java.lang.String

.IDENTITY) private Long id; @Unique @Persistent(nullValue=NullValue.EXCEPTION) private String username; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getUsername() { return username; } public void setUsername( String username) { this.username = username

ORDER BY problem, when String starts with language specific character

anaq x ObjectDB uses the ordinal Java String lexicographical order, which is based on the order ... fields - name and normalizedName , and just keeping strings in name using the decomposed form ... .*; public final class T352 {     public static void main( String [] args)   

Error reading UTF string

Good day, I have many errors like this, when try to use java.util.UUID as string in querys. 16:18 ... .objectdb.o.InternalException: Error reading UTF string at org.jboss.as.ejb3.tx.CMTTxInterceptor ... reading UTF string at granat.dp.ejb.PersonBean.find(PersonBean.java:287) [DP-ejb.jar:] at sun.reflect

"Unsupported auto value type java.lang.String" when persisting new instance

. String for field hr.hzmo.network.model.Device.ID (error 323) at com.objectdb.jpa.EMImpl.persist ... .java:71) Caused by: com.objectdb.o.UserException: Unsupported auto value type java.lang. String ... for primary key: @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private String ID; kiki

String Contains Query Result - Possible?

Hi, I have a managed database for an Entity, "Program", containing a String field, "description", that is effectively a unique sub- string of a system generated description. Example ... even when using wildcards as the input string will be larger than the string being searched for. Presently

substring works with string but not with char

with a string parameter select f from Foo f where substring(f.name, 1, 1) = ?1 but when i use a char ... of the left side expression is String and the type on the right side expression (the parameter) is Character . In ObjectDB as in Java char is comparable to int but not to String . Maybe an exception

javax.persistence.DiscriminatorType.STRING

JPA Enum Constant in javax.persistence.DiscriminatorType STRING String as the discriminator type. Since: JPA 1.0

javax.persistence.EnumType.STRING

JPA Enum Constant in javax.persistence.EnumType STRING Persist enumerated type property or field as a string . Since: JPA 1.0

Query Parameters in JPA

with different parameter values (arguments) is more efficient than using a new query string for every query ... getCountryByName( EntityManager em, String name) { TypedQuery query = em. createQuery ( "SELECT c FROM ... identified in a query string by their special form, which is a colon (:) followed by a valid JPQL

Index Definition

; @Entity public class EntityWithSimpleIndex { @Index String indexedField1; @Index ( unique ="true") int ... .BigInteger , java.math.BigDecimal. java.lang. String . java.util.Date , java.sql.Date , java.sql.Time ... EntityWithCompositeIndex { String firstName; String lastName; } When indexed fields are specified

JPA Criteria API Queries

JPQL JPQL queries are defined as strings , similarly to SQL. JPA criteria queries, on the other hand ... rather than at runtime. On the other hand, for many developers string based JPQL queries, which are very similar to SQL queries, are easier to use and understand. For simple static queries - string based JPQL

Literals in JPQL and Criteria Queries

including NULL , boolean literals ( TRUE and FALSE ), numeric literals (e.g. 100 ), string literals ... literals (e.g. 077 , 077L ), a feature that is not currently supported by all JPA implementations. String Literals JPQL follows the syntax of SQL for string literals in which strings are always enclosed in

JPA Persistable Types

, Mapped superclasses, Embeddable classes. Simple Java data types: Primitive types, Wrappers, String ... public class Address { String street; String city; String state; String country; String zip; } Instances ... . java.lang. String . java.util.Date , java.util.Calendar , java.sql.Date , java.sql.Time , java.sql

SELECT clause (JPQL / Criteria API)

country names as String instances, rather than Country objects: SELECT c.name FROM Country AS c Using ... of the above query are received as a list of String values: TypedQuery query = em. createQuery ( "SELECT c.name FROM Country AS c", String .class); List results = query. getResultList (); Only singular

Database Explorer

a query string . In the [Parameters] table provide arguments for parameters (if any). An entity ... Multi Line String  command to edit a multi-line string . Reference fields can be edited using ... : The [Encoding] combo box is useful when strings in the database are not encoded using Unicode. ObjectDB

JPA Entity Fields

{ String name; @ManyToOne Department department; } @Entity public class Department { @OneToMany ... = id; } private String str; String getStr() { return str; } void setStr( String str) { this.str

JPA Queries

interface) is the only neccessary interface for defining and running string based JPQL queries  ... ) can be done by concatenating JPQL strings into a valid complete JPQL query. JPA 2 introduced the JPA Criteria ... , and is equivalent to a JPQL query string (i.e. to a String instance containing JPQL). An essential

JPA Named Queries

A named query is a statically defined query with a predefined unchangeable query string . Using ... query strings from the Java code. It also enforces the use of query  parameters rather than embedding literals dynamically into the query string and results in more efficient queries. @NamedQuery

Posting Sample Code

;  public static void main( String [] args) {         ... {         private String name;         MyEntity( String name) {            

Defining a JPA Entity Class

; } public int getY() { return this.y; } // String Representation: @Override public String toString() { return String .format("(%d, %d)", this.x, this.y); } } As you can see above, an entity class

JPA Query API

and Named Queries Building queries by passing JPQL query strings directly to the createQuery method, as shown above, is referred to in JPA as dynamic query construction because the query string ... queries,  based on Java objects that represent query elements (replacing string based JPQL). JPA

Comparison in JPQL and Criteria API

by using any comparison operator. String values can be compared by using any comparison operator. Equality operators (=, , == , != ) on strings in queries follow the logic of Java's equals ... , a double value can be compared to a BigInteger instance but not to a String instance. [NOT] BETWEEN

Online Backup

; em.createQuery("objectdb backup").getSingleResult(); The backup query string is always exactly ... , the backup target could be specified as a String value: Query backupQuery = em.createQuery("objectdb backup"); backupQuery.setParameter("target", "backup"); backupQuery.getSingleResult(); When a string

Paths and Types in JPQL and Criteria API

, string , date). Simple type values are more useful in queries. They have special operators and functions (e.g. for strings and for numbers ), they can be compared by all six comparison operators ... types (number, boolean, string , date). For a path expression to be valid the user defined persistable

GROUP BY and HAVING clauses

of comparable values (numeric, strings , dates). MAX - returns the maximum of comparable values (numeric, strings , dates). The following query counts for every letter the number of countries with names ... the initial letter as a String object, the second cell contains the number of countries in

Database Schema Evolution

any type to String (using toString() if necessary). From String to numeric types including enum types

JPA Metamodel API

only one additional method for getting the entity name: String entityName = entityType. getName ... details. For example: // Get the field (or property) name: String name = attr. getName (); // Get Java

ObjectDB Object Database Features

. String Date types : java.util.Date, java.sql.Date, java.sql.Time and java.sql.Timestamp. Math types ... (Boolean, Byte, Short, Character, Integer, Long, Float and Double). java.lang. String Dates: java

Enable intern() for Retrieved Strings

Implement a setting, where the developer can specify which Strings should be loaded via the String ... of instantiating every first name with a new String , the user should be able to specify that this field should be loaded via String . intern() (with all its advantages and disadvantages). mlaggner Manuel Laggner

[ODB1] Chapter 7 - JDOQL Queries

one of the following two newQuery( ... ) forms: Query newQuery(Extent candidates, String filter) Query newQuery(Class cls, String filter) In the first form, the candidate class is automatically set to the class ... collection, rather than an Extent : Query newQuery(Class cls, Collection candidates, String filter) Querying

[ODB1] Chapter 2 - A Quick Tour

;Hello World The HelloWorld sample program manages a list of strings in the database. Each time the program is run another string is stored in the database and all the strings in the database are printed ... a list of two strings "Hello World 0" and "Hello World 1". Program Source Code The program consists

[ODB1] Chapter 6 - Persistent Objects

reachability is applicable to all persistent types, including system types, such as String and ArrayList ... ObjectDB returns the numeric ID of the object as a string . The ability to convert Object IDs to strings , and the ability to convert strings back to object IDs (as shown in the next section), make object

Step 2: Entity Class and Persistence Unit

String name; private Date signingDate; // Constructors: public Guest() { } public Guest( String name) { this.name = name; this.signingDate = new Date(System.currentTimeMillis()); } // String Representation: @Override public String toString() { return name + " (signed on " + signingDate

Step 2: Entity Class and Persistence Unit

final long serialVersionUID = 1L; // Persistent Fields: @Id @GeneratedValue Long id; private String name; private Date signingDate; // Constructors: public Guest() { } public Guest( String name) { this.name = name; this.signingDate = new Date(System.currentTimeMillis()); } // String Representation

Step 2: Entity Class and Persistence Unit

; private String name; private Date signingDate; // Constructors: public Guest() { } public Guest( String name) { this.name = name; this.signingDate = new Date(System.currentTimeMillis()); } // String Representation: @Override public String toString() { return name + " (signed on " + signingDate

Step 2: Entity Class and Persistence Unit

final long serialVersionUID = 1L; // Persistent Fields: @Id @GeneratedValue Long id; private String name; private Date signingDate; // Constructors: public Guest() { } public Guest( String name) { this.name = name; this.signingDate = new Date(System.currentTimeMillis()); } // String Representation

Step 2: Define a JPA Entity Class

String name; private Date signingDate; // Constructors: public Guest() { } public Guest( String name) { this.name = name; this.signingDate = new Date(System.currentTimeMillis()); } // String Representation: @Override public String toString() { return name + " (signed on " + signingDate + ")"; } } 

Step 2: Define a JPA Entity Class

@GeneratedValue Long id; private String name; private Date signingDate; // Constructors: public Guest() { } public Guest( String name) { this.name = name; this.signingDate = new Date(System.currentTimeMillis()); } // String Representation: @Override public String toString() { return name + " (signed

[ODB1] Chapter 9 - ObjectDB Explorer

are provided in the "Edit" menu and in the content menu. Use the "Edit Multi Line String " command to edit a multi line string . Use the "Set Reference" command to set a reference field to a new object ... " combo box should reflect the encoding of strings in the database. ObjectDB stores String instances in

[ODB1] Chapter 4 - JDO Metadata

contains all the fields with primitive types (e.g. int), types defined in java.lang (e.g. String ... . Wrapper objects, strings , dates, collections and arrays are embedded by default. To use them as non ... . String field, empty collection, 0 size array, and so on). primary-key The primary-key attribute, defined

Step 2: Define a JPA Entity Class

public String toString() { return String .format("(%d, %d)", this.x, this.y); } } The new class

Step 2: Define a JPA Entity Class

() { return id; } public int getX() { return x; } public int getY() { return y; } @Override public String toString() { return String .format("(%d, %d)", this.x, this.y); } } The new class should represent Point

JDO Predefined ID Classes

, to use a String primary key define a primary key field of type String : @PersistenceCapable public class MyClass { @PrimaryKey String id; } Persistent objects with a String primary key (including instances of MyClass ) can be represented uniquely by StringIdentity , as a combination of a class and a string value.

[ODB1] Chapter 8 - ObjectDB Server

the connection URL string . 8.1  Running an ObjectDB Server The ObjectDB server is a pure Java ... string (as explained in section 5.1 ) when connecting to the database. The reload attribute specifies ... connection string "objectdb://localhost/my/db.odb" refers to a database file db.odb in

[ODB1] Chapter 3 - Persistent Classes

, Character , Integer , Long , Float , Double , Number and String . Selected classes in package java ... class eMain { public static void main( String [] args) { // Always start by calling the enhancer: com ... method accepts as an argument a string specifying the classes to be enhanced. The syntax is adopted