Basic HQL and JPA QL queries Table 14.2 (Free web design)

Basic HQL and JPA QL queries Table 14.2 Standardized JPA QL functions Function Applicability UPPER(s), LOWER(s) String values; returns a string value CONCAT(s1, s2) String values; returns a string value SUBSTRING(s, offset, length) String values (offset starts at 1); returns a string value TRIM( [[BOTH|LEADING|TRAILING] char [FROM]] s) Trims spaces on BOTH sides of s if no char or other specification is given; returns a string value LENGTH(s) String value; returns a numeric value LOCATE(search, s, offset) Searches for position of ssin s starting at offset; returns a numeric value ABS(n), SQRT(n), MOD(dividend, divisor) Numeric values; returns an absolute of same type as input, square root as double, and the remainder of a division as an integer SIZE(c) Collection expressions; returns an integer, or 0 if empty All the standardized JPA QL functions may be used in the WHERE and HAVING clauses of a query (the latter you ll see soon). The native HQL is a bit more flexible. First, it offers additional portable functions, as shown in table 14.3. Table 14.3 Additional HQL functions Function Applicability BIT_LENGTH(s) Returns the number of bits in s CURRENT_DATE(), CURRENT_TIME(), CURRENT_TIMESTAMP() Returns the date and/or time of the database management system machine SECOND(d), MINUTE(d), HOUR(d), DAY(d), MONTH(d), YEAR(d) Extracts the time and date from a temporal argument CAST(t as Type) Casts a given type t to a Hibernate Type INDEX(joinedCollection) Returns the index of joined collection element MINELEMENT(c), MAXELEMENT(c), MININDEX(c), MAXINDEX(c), ELEMENTS(c), INDICES(c) Returns an element or index of indexed collections (maps, lists, arrays) Registered in org.hibernate.Dialect Extends HQL with other functions in a dialect
In case you need affordable webhost to host your website, our recommendation is ecommerce web host services.

Leave a Reply