Internal Website Search
1-50 of 200 resultsGROUP BY and HAVING clauses The GROUP BY clause enables grouping of query results. A JPQL query with a GROUP BY clause returns properties of generated groups instead of individual objects and fields. The position of a GROUP BY ... clause. When a GROUP BY clause exists in a JPQL query, database objects (or tuples of database objects | |
ObjectDB Object Database Features, derived attributes, grouping queries and aggregate queries) which are usually missing from Object Oriented ... groups . Ease of Use and Learning ObjectDB is very simple to use and is easier to learn than any ... to ObjectDB. Persistence is set using JPA/JDO annotations (e.g. @Entity , @ Id , @Index ). Transparent | |
JPA Entity Fields superclasses) can be classified into the following five groups : Transient fields Persistent fields Inverse (Mapped By) fields Primary key ( ID ) fields Version field The first three groups (transient ... two groups (primary key and version fields) can only be used in entity classes. Primary key fields | |
Auto Generated Values server, IDs are allocated in groups . The number of IDs in each allocation is specified by ... number generator for every database. This number generator is used to generate automatic object IDs ... @GeneratedValue with the AUTO strategy: @Entity public class EntityWithAutoId1 { @ Id @GeneratedValue | |
Group by date / time something like this: SELECT COUNT( id ) FROM stats WHERE YEAR(record_date) = 2009 GROUP BY DATE_FORMAT(record_date ... Hi, I'm trying to create reporting query that will return entities grouped by year / mont / day ... () or DAY() in ODB. So, how to build queries similar to something like this: SELECT COUNT( id ) FROM stats | |
ORDER BY clause (JPQL / Criteria API) BY c.name DESC Grouping ( GROUP BY) Order The ORDER BY clause is always the last in the query processing chain. If a query contains both an ORDER BY clause and a GROUP BY clause the SELECT clause receives groups rather than individual objects and ORDER BY can order these groups . For example: SELECT c | |
CriteriaQuery.groupBy(grouping) - JPA Method; Expression ... grouping ) Specify the expressions that are used to form groups over the query results. Replaces the previous specified grouping expressions, if any. If no grouping expressions are specified, any previously added grouping expressions are simply removed. This method only overrides | |
CriteriaQuery.groupBy(grouping) - JPA Method grouping ) Specify the expressions that are used to form groups over the query results. Replaces the previous specified grouping expressions, if any. If no grouping expressions are specified, any previously added grouping expressions are simply removed. This method only overrides the return type | |
Subquery.groupBy(grouping) - JPA Method; grouping ) Specify the expressions that are used to form groups over the subquery results. Replaces the previous specified grouping expressions, if any. If no grouping expressions are specified, any previously added grouping expressions are simply removed. This method only overrides the return type | |
AbstractQuery | |
AbstractQuery | |
Subquery.groupBy(grouping) - JPA Method ... grouping ) Specify the expressions that are used to form groups over the subquery results. Replaces the previous specified grouping expressions, if any. If no grouping expressions are specified, any previously added grouping expressions are simply removed. This method only overrides the return | |
JPA Primary Key an object database, ObjectDB supports implicit object IDs , so an explicitly defined primary key is not ... a primary key field: @Entity public class Project { @ Id @GeneratedValue long id ; // still set automatically : } The @ Id annotation marks a field as a primary key field. When a primary key field is defined | |
JPA Query Structure (JPQL / Criteria);of up to 6 clauses in the following format: SELECT ... FROM ... [WHERE ...] [ GROUP BY ... [HAVING ... (update and delete queries have a slightly different form). The other JPQL clauses, WHERE , GROUP BY ... ;( where ). Criteria GROUP BY / HAVING ( groupBy , having , count , sum , avg , min , max | |
Paths and Types in JPQL and Criteria API. The SELECT clause counts all these objects (this is an aggregate query with no GROUP BY - all the objects are considered as one group , and COUNT calculates its size). Criteria Query Paths and Types Paths ... can be divided into two main groups : FROM variable expressions , represented by subinterfaces of From | |
javax.persistence.Id JPA Annotation Id Target: METHOD, FIELD Implemented Interfaces: Annotation Specifies the primary key of an entity. The field or property to which the Id annotation is applied ... : @ Id public Long getId() { return id ; } See Also: Column GeneratedValue Since: JPA 1.0 The JPA | |
JDO Predefined ID Classes An object ID is a combination of a persistence capable class and a primary key. It provides a unique representation of a persistent object. The following classes serve as predefined ID classes for persistence capable classes with a simple single field primary key: Object IDs are used in many | |
JPA Metamodel API = entityType. getSupertype (); // Checks if the type has a single ID attribute: boolean hasSingleId = entityType. hasSingleIdAttribute (); // Gets a single ID attribute - including inherited: SingularAttribute id1 = entityType. getId (Long.class); // Gets a single ID attribute - excluding  | |
FROM clause (JPQL / Criteria API),FROM, GROUP , HAVING, IN, INDEX, INNER, IS, JOIN, KEY, LEADING, LEFT, LENGTH, LIKE,LOCATE, LOWER, MAX | |
JPA Query Expressions (JPQL / Criteria) Query expressions are the foundations on which JPQL and criteria queries are built. Every query consists of clauses - SELECT, FROM, WHERE, GROUP BY, HAVING and ORDER BY, and each clause consists of JPQL / Criteria query expressions. Atomic Expressions The atomic query expressions are: JPQL | |
JPA Queries are organized in this reference into three groups . SELECT and ORDER BY elements (including tuples): FROM clause | |
DELETE Queries in JPA/JPQL of SELECT queries. DELETE queries cannot include multiple variables and JOIN, and cannot include the GROUP | |
Criteria Query Selection and Results The JPA Criteria API interfaces in this group are used for setting the SELECT and ORDER BY clauses and for representing query results as tuples. SELECT Clause Elements The content of the SELECT clause in a criteria query is represented by Selection : Because Selection is a super interface | |
Comparison in JPQL and Criteria API comparison of any two values that belong to the same group as detailed above. Therefore, for example | |
JPA Annotations JPA defines dozens of annotations that can be divided into the following groups : Annotations for JPA aware classes: Annotations for fields in JPA persistable classes: Annotations for additional JPA configuration: Annotations for JPA lifecycle event callbacks: Java EE container annotations: Many | |
UPDATE SET Queries in JPA/JPQL UPDATE queries cannot include the GROUP BY, HAVING and ORDER BY clauses, but the WHERE clause | |
JPA Criteria API Queries , join , fetch ). WHERE clause ( where ). GROUP BY / HAVING clauses ( groupBy , having , count , sum | |
JPA Persistence Unit A JPA Persistence Unit is a logical grouping of user defined persistable classes (entity classes, embeddable classes and mapped superclasses) with related settings. Defining a persistence unit is optional when using ObjectDB, but required by JPA. persistence.xml Persistence units are defined in | |
Criteria Query From Elements The interfaces in this group are in use for setting a criteria query FROM clause. Criteria Query Variables The FROM clause in JPA queries (as in SQL) defines the query variables. Query variables are represented in criteria queries by descendant interfaces of the From interface: Range | |
Chapter 4 - JPA Queries (JPQL / Criteria) (and a criteria query) is explained by describing the main clauses of JPQL queries (SELECT, FROM, WHERE, GROUP | |
Database Transaction Replayer of the database at the end of a specific transaction. The ID of that transaction is used as the name of the file. A recording file, with the same transaction ID in its name, contains database operations ... ID is specified as a second argument the Replayer applies recorded operations | |
[ODB1] Chapter 4 - JDO Metadata database, ObjectDB always uses datastore identity with its own object- id class). 4.3   ... to its value at the beginning of the transaction. default-fetch- group (true | false) The default-fetch- group attribute indicates that a field should be managed in a group with other fields. When a persistent | |
Step 1: Create a Maven Web Project Next . Enter Group Id (e.g. Guestbook ), Artifact Id (e.g. Guestbook ), Version (e.g | |
Step 1: Create a Maven Web Project We start by creating a new Maven web project in NetBeans: Open the [New Project] dialog box, e.g. by using File New Project... Select Maven Maven Web Application and click Next . Choose a Project Name (e.g. Guestbook ) and select Java EE 5. Enter Maven Group Id (e.g. com.objectdb.tutorial.spring | |
[ODB1] Chapter 3 - Persistent Classes scripts (like ANT for example), but in most Java IDEs a plugin is required to integrate a JDO enhancer into the IDE Build command. A simple alternative that does not require a plugin and works on any Java IDE (and also from the command line) is to add a new simple main class to a project | |
[ODB1] Chapter 9 - ObjectDB Explorer create and compile the classes externally in your IDE , and then use the "File | Load New Classes" menu ... schema (for instance, a new persistent field added in the IDE ) is applied to the database automatically ... to renaming the class in the IDE , to avoid losing old persistent instances of the class. Similarly | |
[ODB1] Chapter 6 - Persistent Objects and improve efficiency, but they also have some limitations. An embedded object cannot have an object ID ... object). 6.2 Object IDs and Names Identifying database objects by unique IDs and by names ... two identifying methods for database objects. The first method, object IDs , is supported by JDO | |
Step 1: Install BIRT and ObjectDB Driver of the Eclipse IDE that includes BIRT built in. This option may be useful if you are not using the Eclipse IDE for Java EE Developers. Update your existing Eclipse IDE for Java EE Developers environment by installing the BIRT plugins using the Eclipse Update Manager (updating Eclipse IDE | |
Query.setGrouping(group) - JDO Method JDO Method in javax.jdo.Query void setGrouping ( String group ) Set the grouping expressions, optionally including a "having" clause. When grouping is specified, each result expression must either be an expression contained in the grouping , or an aggregate evaluated once per group | |
PersistenceManagerFactory.addFetchGroups(groups) - JDO Method JDO Method in javax.jdo.PersistenceManagerFactory void addFetchGroups ( FetchGroup... groups ) Add the FetchGroup s to the set of active fetch groups . FetchGroup s ... are internally serialized. Parameters: groups - an array of FetchGroups Throws: SecurityExceptionif | |
PersistenceManagerFactory.removeFetchGroups(groups) - JDO Method JDO Method in javax.jdo.PersistenceManagerFactory void removeFetchGroups ( FetchGroup... groups ) Remove the FetchGroup s from the set of active FetchGroup s. Existing FetchGroup s ... , and removeAllFetchGroups are internally serialized. Parameters: groups - an array of FetchGroups Throws | |
Step 2: Define a JPA Entity Class Serializable { private static final long serialVersionUID = 1L; @ Id @GeneratedValue private long id ... Long getId() { return id ; } public int getX() { return x; } public int getY() { return y; } @Override ... should represent Point objects in the database. Apart from the @Entity annotation and the id field | |
Step 2: Define a JPA Entity Class static final long serialVersionUID = 1L; @ Id @GeneratedValue private long id ; private int x; private ... () { return id ; } public int getX() { return x; } public int getY() { return y; } @Override public String ... objects in the database. Besides the @Entity annotation and the id field (and its annotations | |
Step 2: Define a JPA Entity Class.GeneratedValue; import javax.persistence. Id ; @Entity public class Guest implements Serializable { private static final long serialVersionUID = 1L; // Persistent Fields: @ Id @GeneratedValue Long id ; private ... and the id field (and its annotations) - the Guest class is an ordinary Java class. The next step is adding | |
Step 2: Define a JPA Entity Class; import javax.persistence.GeneratedValue; import javax.persistence. Id ; @Entity public class Guest implements Serializable { private static final long serialVersionUID = 1L; // Persistent Fields: @ Id @GeneratedValue Long id ; private String name; private Date signingDate; // Constructors: public | |
Step 2: Entity Class and Persistence Unit.GeneratedValue; import javax.persistence. Id ; @Entity public class Guest implements Serializable { private static final long serialVersionUID = 1L; // Persistent Fields: @ Id @GeneratedValue Long id ; private | |
JDO Annotations for Fetch Settings The following annotations are used to define JDO fetch groups and fetch plans: | |
JDO Annotations JDO defines dozens of annotations that can be divided into the following groups : | |
javax.jdo.PersistenceManager and DETACH_UNLOAD_FIELDS) and the active fetch groups determine the scope of fetching for the graph ... and DETACH_UNLOAD_FIELDS) and the active fetch groups determine the scope of fetching for the graph ... _UNLOAD_FIELDS) and the active fetch groups determine the scope of fetching for the graph of instances | |
javax.jdo.PersistenceManagerFactory Methods void addFetchGroups (FetchGroup... groups ) Add the FetchGroup s to the set of active fetch groups . FetchGroup s are made unmodifiable before being added. FetchGroup s that match existing ... , getFetchGroups , and removeAllFetchGroups are internally serialized. Parameters: groups - an array |