Internal Website Search

1-50 of 200 results

JPA Named Queries

A named query is a statically defined query with a predefined unchangeable query string. Using named queries instead of dynamic queries may improve code organization by separating the JPQL ... whose name is  "Country.findAll" that retrieves all the  Country objects in the database

SELECT clause (JPQL / Criteria API)

country names as String instances, rather than Country objects: SELECT c. name FROM Country AS c Using path expressions , such as c. name , in query results is referred to as projection. The field values ... c. name FROM Country AS c", String.class); List results = query. getResultList (); Only singular

Query Parameters in JPA

execution, because it eliminates the need for repeated query compilations. Named Parameters (: name ) The following method retrieves a Country object from the database by its name : public Country getCountryByName( EntityManager em, String name ) { TypedQuery query = em. createQuery ( "SELECT c FROM

Schema Update

... ... A element has two roles: If the optional new- name attribute is specified, the package name is changed from the original name , which is specified by the required name attribute, to the new name . All the classes in that package are moved to the new package name . In addition, whether or not a new

FROM clause (JPQL / Criteria API)

, and the same query can also be written as follows: SELECT c FROM Country c By default, the name of an entity class in a JPQL query is the unqualified name of the class (e.g. just Country with no package name ). The default name can be overridden by specifying another name explicitly in the @Entity 's

ORDER BY clause (JPQL / Criteria API)

Expressions The following query returns names of countries whose population size is at least one million people, ordered by the country name : SELECT c. name FROM Country c WHERE c.population 1000000 ORDER BY c. name When an ORDER BY clause exists it is the last to be executed. First the FROM clause

JPA Persistable Types

, package or private) and it can be either concrete or abstract. Entity Class Names Entity classes are represented in queries by entity names . By default, the entity name is the unqualified name of the entity class (i.e. the short class name excluding the package name ). A different entity name

Database Connection using JPA

an argument a name of a persistence unit . As an extension, ObjectDB enables specifying a database URL (or ... a persistence unit name . To use ObjectDB embedded directly in your application (embedded mode ... name extension is odb or objectdb and required for other file name extensions (e.g. 

Paths and Types in JPQL and Criteria API

. For example, c.capital. name is a nested path expression that continues from the Capital entity object to its name field. A path expression can be extended further only if its type is also a user defined ... class must contain a persistent field (or property) with a matching name . The path expression

EntityManagerFactory.addNamedQuery(name,query) - JPA Method

; name ,     Query  query ) Define the query, typed query, or stored procedure query as a named query such that future query objects can be created from it using the createNamedQuery ... parameter binding) in effect when the named query is added is retained as part of the named query

javax.persistence.JoinColumn.name

JPA Annotation Attribute in javax.persistence.JoinColumn String name default "" (Optional) The name of the foreign key column. The table in which it is found depends upon the context. If the join ... ): The concatenation of the following: the name of the referencing relationship property or field

ManagedType.getDeclaredSet(name) - JPA Method

;String  name ) Return the Set-valued attribute declared by the managed type that corresponds to the specified name . Parameters: name - the name of the represented attribute Return: declared SetAttribute of the given name Throws: IllegalArgumentException - if attribute of the given name is not declared in the managed type Since: JPA 2.0

ManagedType.getDeclaredCollection(name) - JPA Method

(   String  name ) Return the Collection-valued attribute declared by the managed type that corresponds to the specified name . Parameters: name - the name of the represented attribute Return: declared CollectionAttribute of the given name Throws: IllegalArgumentException - if attribute

ManagedType.getSet(name) - JPA Method

  name ) Return the Set-valued attribute of the managed type that corresponds to the specified name . Parameters: name - the name of the represented attribute Return: SetAttribute of the given name Throws: IllegalArgumentException - if attribute of the given name is not present in the managed type Since: JPA 2.0

ManagedType.getCollection(name) - JPA Method

; String  name ) Return the Collection-valued attribute of the managed type that corresponds to the specified name . Parameters: name - the name of the represented attribute Return: CollectionAttribute of the given name Throws: IllegalArgumentException - if attribute of the given name is not present in the managed type Since: JPA 2.0

ManagedType.getSingularAttribute(name) - JPA Method

(   String  name ) Return the single-valued attribute of the managed type that corresponds to the specified name . Parameters: name - the name of the represented attribute Return: single-valued attribute with the given name Throws: IllegalArgumentException - if attribute of the given name is not present in the managed type Since: JPA 2.0

ManagedType.getDeclaredSingularAttribute(name) - JPA Method

getDeclaredSingularAttribute (   String  name ) Return the single-valued attribute declared by the managed type that corresponds to the specified name . Parameters: name - the name of the represented attribute Return: declared single-valued attribute of the given name Throws: IllegalArgumentException

ManagedType.getDeclaredMap(name) - JPA Method

;String  name ) Return the Map-valued attribute declared by the managed type that corresponds to the specified name . Parameters: name - the name of the represented attribute Return: declared MapAttribute of the given name Throws: IllegalArgumentException - if attribute of the given name is not declared in the managed type Since: JPA 2.0

ManagedType.getMap(name) - JPA Method

  name ) Return the Map-valued attribute of the managed type that corresponds to the specified name . Parameters: name - the name of the represented attribute Return: MapAttribute of the given name Throws: IllegalArgumentException - if attribute of the given name is not present in the managed type Since: JPA 2.0

ManagedType.getList(name) - JPA Method

  name ) Return the List-valued attribute of the managed type that corresponds to the specified name . Parameters: name - the name of the represented attribute Return: ListAttribute of the given name Throws: IllegalArgumentException - if attribute of the given name is not present in the managed type Since: JPA 2.0

ManagedType.getDeclaredList(name) - JPA Method

;String  name ) Return the List-valued attribute declared by the managed type that corresponds to the specified name . Parameters: name - the name of the represented attribute Return: declared ListAttribute of the given name Throws: IllegalArgumentException - if attribute of the given name is not declared in the managed type Since: JPA 2.0

ManagedType.getDeclaredList(name,elementType) - JPA Method

;String  name ,    Class  elementType ) Return the List-valued attribute declared by the managed type that corresponds to the specified name and Java element type. Parameters: name - the name of the represented attribute elementType - the element type of the represented

ManagedType.getDeclaredSet(name,elementType) - JPA Method

;String  name ,    Class  elementType ) Return the Set-valued attribute declared by the managed type that corresponds to the specified name and Java element type. Parameters: name - the name of the represented attribute elementType - the element type of the represented attribute

ManagedType.getList(name,elementType) - JPA Method

  name ,    Class  elementType ) Return the List-valued attribute of the managed type that corresponds to the specified name and Java element type. Parameters: name - the name ... : ListAttribute of the given name and element type Throws: IllegalArgumentException - if attribute

ManagedType.getSet(name,elementType) - JPA Method

  name ,    Class  elementType ) Return the Set-valued attribute of the managed type that corresponds to the specified name and Java element type. Parameters: name - the name ... : SetAttribute of the given name and element type Throws: IllegalArgumentException - if attribute of the given

ManagedType.getCollection(name,elementType) - JPA Method

; String  name ,    Class  elementType ) Return the Collection-valued attribute of the managed type that corresponds to the specified name and Java element type. Parameters: name - the name of the represented attribute elementType - the element type of the represented

ManagedType.getDeclaredCollection(name,elementType) - JPA Method

(   String  name ,    Class  elementType ) Return the Collection-valued attribute declared by the managed type that corresponds to the specified name and Java element type. Parameters: name - the name of the represented attribute elementType - the element type

ManagedType.getDeclaredAttribute(name) - JPA Method

;String  name ) Return the attribute declared by the managed type that corresponds to the specified name . Parameters: name - the name of the represented attribute Return: attribute with given name Throws: IllegalArgumentException - if attribute of the given name is not declared in the managed type Since: JPA 2.0

ManagedType.getAttribute(name) - JPA Method

  name ) Return the attribute of the managed type that corresponds to the specified name . Parameters: name - the name of the represented attribute Return: attribute with given name Throws: IllegalArgumentException - if attribute of the given name is not present in the managed type Since: JPA 2.0

ManagedType.getMap(name,keyType,valueType) - JPA Method

  name ,    Class  keyType,    Class  valueType ) Return the Map-valued attribute of the managed type that corresponds to the specified name and Java key and value types. Parameters: name - the name of the represented attribute keyType - the key type

ManagedType.getDeclaredMap(name,keyType,valueType) - JPA Method

;String  name ,    Class  keyType,    Class  valueType ) Return the Map-valued attribute declared by the managed type that corresponds to the specified name and Java key and value types. Parameters: name - the name of the represented attribute keyType

ManagedType.getSingularAttribute(name,type) - JPA Method

(   String  name ,    Class  type ) Return the single-valued attribute of the managed type that corresponds to the specified name and Java type. Parameters: name - the name ... attribute with given name and type Throws: IllegalArgumentException - if attribute of the given name

ManagedType.getDeclaredSingularAttribute(name,type) - JPA Method

getDeclaredSingularAttribute (   String  name ,    Class  type ) Return the single-valued attribute declared by the managed type that corresponds to the specified name and Java type. Parameters: name - the name of the represented attribute type - the type of the represented attribute Return

EntityManager.createNamedQuery(name,resultClass) - JPA Method

  name ,    Class  resultClass ) Create an instance of TypedQuery for executing a Java Persistence query language named query. The select list of the query must contain only a single item, which must be assignable to the type specified by the resultClass argument. Parameters: name

Query.getParameter(name) - JPA Method

JPA Method in javax.persistence.Query Parameter getParameter (   String  name ) Get the parameter object corresponding to the declared parameter of the given name . This method is not required to be supported for native queries. Parameters: name - parameter name Return: parameter

Query.getParameter(name,type) - JPA Method

JPA Method in javax.persistence.Query Parameter getParameter (   String  name ,  ... of the given name and type. This method is required to be supported for criteria queries only. Parameters: name - parameter name type - type Return: parameter object Throws: IllegalArgumentException

Query.getParameterValue(name) - JPA Method

JPA Method in javax.persistence.Query Object getParameterValue (   String  name ) Return the input value bound to the named parameter. (Note that OUT parameters are unbound.) Parameters: name - parameter name Return: parameter value Throws: IllegalStateException - if the parameter

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

JPA Method in javax.persistence.Query Query setParameter (   String  name ,  ... of java.util.Calendar to a named parameter. Parameters: name - parameter name value - parameter ... - if the parameter name does not correspond to a parameter of the query or if the value argument is of incorrect type Since: JPA 1.0

Query.setParameter(name,value) - JPA Method

JPA Method in javax.persistence.Query Query setParameter (   String  name ,    Object value ) Bind an argument value to a named parameter. Parameters: name - parameter name value - parameter value Return: the same query instance Throws: IllegalArgumentException

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

JPA Method in javax.persistence.Query Query setParameter (   String  name ,  ... of java.util.Date to a named parameter. Parameters: name - parameter name value - parameter value ... - if the parameter name does not correspond to a parameter of the query or if the value argument is of incorrect type Since: JPA 1.0

TypedQuery.setParameter(name,value) - JPA Method

JPA Method in javax.persistence.TypedQuery TypedQuery setParameter (   String  name ,    Object value ) Bind an argument value to a named parameter. Parameters: name - parameter name value - parameter value Return: the same query instance Throws

StoredProcedureQuery.setParameter(name,value,temporalType) - JPA Method

; String  name ,    Date value,     TemporalType  temporalType ) Bind an instance of java.util.Date to a named parameter. Parameters: name - parameter name ... : IllegalArgumentException - if the parameter name does not correspond to a parameter of the query or if the value argument is of incorrect type Since: JPA 2.1

StoredProcedureQuery.setParameter(name,value,temporalType) - JPA Method

; String  name ,    Calendar value,     TemporalType  temporalType ) Bind an instance of java.util.Calendar to a named parameter. Parameters: name - parameter name value - parameter value temporalType - temporal type Return: the same query instance Throws

StoredProcedureQuery.setParameter(name,value) - JPA Method

; String  name ,    Object value ) Bind an argument value to a named parameter. Parameters: name - parameter name value - parameter value Return: the same query instance Throws: IllegalArgumentException - if the parameter name does not correspond to a parameter of the query

Step 2: Entity Class and Persistence Unit

, enter src/main/java as Folder Name and click Finish . Open the [New Java Class] dialog box, e.g. by ... ; New Class . Enter  guest as the package name - use  exactly that case sensitive package name . Enter  Guest as the class name - use  exactly that case sensitive class name . Click

Step 2: Entity Class and Persistence Unit

) and selecting  New Class . Enter  guest as the package name - use  exactly that case sensitive package name . Enter  Guest as the class name - use  exactly that case sensitive class name . Click  Finish to create the new class. A new class that should represent Guest

[ODB1] Chapter 6 - Persistent Objects

the assignment of names to objects in the database and the storing of instances of any persistent type ... object). 6.2  Object IDs and Names Identifying database objects by unique IDs and by names ... . The second method, object names , is not supported by JDO, but ObjectDB supports it as an extension

[ODB1] Chapter 2 - A Quick Tour

ArrayList list; 18 try { 19 // Retrieve the list from the database by its name : 20 list = (ArrayList ... the database by its name "Hello World" using the getObjectById( ... ) method (line 20 ... to the database with the name "Hello World", using the Utilities.bind( ... ) static method (line 25

[ODB1] Chapter 4 - JDO Metadata

is the package name , X is the class name ), whose class file is a/b/X.class , is searched in ... with the name X.jdo must be dedicated to a single class whose name is X . Metadata for multiple ... elements. Both and elements have a required name attribute. The metadata above defines class A (in

JDOHelper.getPersistenceManagerFactory(overrides,name,resourceLoader,pmfLoader) - JDO Static Method

(   Map overrides,    String  name ,    ClassLoader ... a PersistenceManagerFactory configured based on the properties stored in the resource at name , or, if not found, returns a PersistenceManagerFactory with the given name or, if not found, returns a javax.persistence