Using SQL statements in Hibernate

Source: Internet
Author: User

In hibernate with SQL statements, statements are createsqlquery, a column or columns of data, to convert it to an object, there are two ways,

For entity classes that have been managed by hibernate, add the following. addentity then use curly braces in the SQL statement, after select from, each {table name. *}, you can query the object.

For the DTO class for data transmission, use Setresulttransformer. Then, before the select from, the column name and the DTO's property name one by one as up.

Millions data storage, with the Foreign Key Association will reduce the efficiency can choose to use redundant fields, many to one of the associated object attributes to a number of attributes, but in this case modify one side, to batch modify the number of one side.

Using SQL statements in Hibernate

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.