The difference between CreateQuery and Createsqlquery in Hibernate is:
The former uses the HQL statement to query, the latter can use the SQL statement query
The former takes the bean generated by hibernate as the object to load the list back, while the latter is stored as an array of objects
So it's not very convenient to use createsqlquery and sometimes want to load the list back with hibernate-generated beans.
Suddenly discovered that Createsqlquery had a way to convert objects directly
Query query = session.createsqlquery (SQL). addentity (Xxxxxxx.class);
XXXXXXX represents the object of the bean generated by hibernate, which is the bean that the data table maps out. But this bean must have a mapping
Hehe after more attention, or from time to time to see the use of various methods hibernate object.
The difference between CreateQuery and createsqlquery in hibernate