hibernate, JPA mess

1.

hibernate is session.createQuery(); hql query, session.createSqlQuery(); sql query 
jpa is entityManager.createQuery; jpql query (class hql), entityManager.createNativeQuery; sql query.

2.

In jdbc, the subscript of setParameter is 1-based, and the subscript of hibernate's setParameter is 0-based.

3.

The MySQL IFNULL function is one of the MySQL control flow functions, it accepts two parameters and returns the first parameter if it is not NULL. Otherwise, the IFNULL function returns the second parameter.

4.

The mysql CONCAT() function is used to concatenate multiple strings into one string. It is one of the most important mysql functions. The following will introduce the mysql CONCAT() function in detail for your reference.

mysql CONCAT(str1,str2,…)
returns the string resulting from the connection parameters. If any parameter is NULL, the return value is NULL. There may be one or more parameters. If all arguments are non-binary strings, the result is a non-binary string. If the argument contains any binary string, the result is a binary string. A numeric argument is converted to its equivalent binary string format; to avoid this, use an explicit type cast, for example: SELECT CONCAT(CAST(int_col AS CHAR), char_col)

mysql> SELECT CONCAT(’My’, ‘S’, ‘QL’);

-> ‘MySQL’

mysql> SELECT CONCAT(’My’, NULL, ‘QL’);

-> NULL

mysql> SELECT CONCAT(14.3);

-> ‘14.3′

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326106389&siteId=291194637