Analysis on the third Test of hirbernate

Source: Internet
Author: User
Tags return tag

Parsing: The HQL statement can execute T-SQL statements, but the steps involved are complex and require the introduction of various configurations such as jar packages.

Parsing:A final-modified member variable must be explicitly specified by the programmer for the initial value. Static is typically used to modify global variables

parsing: Hibernate-the concept of a named query that uses native SQL query statements in native SQL queries and named queries, and Hibernate uses native statement syntax. In a native SQL statement, the input to the string is enclosed in single quotation marks. Create a query to use the CreateQuery method. So BCD is not correct, only a is correct.

Parsing: A PreparedStatement can perform multiple executquery methods, for informational purposes only.

Resolution: A using HQL to deal with massive data performance is very low, can not be used this way.

The B.JDBC API has the best performance and is best suited for processing massive amounts of data.

C. If a one-time flush,hibernate will put the object of the operation into its own internal cache, it will cause memory overflow, so it cannot be used in this way.

D. It is also a good idea to purge the cache in a timely manner if it is broken into multiple flush. So the answer is choose BD.

Parsing: {l.*} in Hibernate represents a property of a query reference entity. * Indicates that all properties of the entity class are queried

Analysis: Please the great god advice, comments, understand very little.

Parsing: The DAO layer clears the cache in a timely manner, removing the memory from the internal cache after each insertion of a certain amount of data.

Analysis: Always feel some pits, the great God is willing to teach some.

Parse: A named query is configured with a <query> (corresponding HQL statement) or <sql-query> (corresponding to a native SQL statement) in the mapping file. Use the Session.getnamedquery () method to get the object that executes the named query, where the fill is the value of the Name property in the label above.

Parsing: The Addentity () method ties the alias of the SQL table to the entity class and determines the pattern of the query result set. Not an append instance, a error. Because the cat in the Createsqlquery and the cat in the addentity must be the same, D is wrong.

Analysis: D indicates a bit less appropriate.

Parse: Native SQL cannot span database

parsing: Criteria are dynamically generated query statements at run time, the angle is different, consider performance or query faster.

Resolution: Lesson

Resolution: A should be noted that the return result of native SQL when the type of a persisted class is not bound is encapsulated as an object array instead of an entity class object, so a is incorrect. The list of option B uses the correct generics and can query for the correct results. C is the primary way to name a query, using the return tag to bind the persisted class and referencing the entity with an alias, so that the query results are encapsulated as entity class objects and are correct. The error in D is that the result of the query is encapsulated as an entity class object instead of an object array. So the correct answer is BC

  Summary: Bit by bit, fresh memory, adhere to the end!!!

Analysis on the third Test of hirbernate

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.