Test Questions in Group B of hibernate Training

Source: Internet
Author: User

(1) In general, what are the matching relationships between the relational data model and the Object Model (multiple choice)
A) corresponding table class
B) record the corresponding object
C) attributes of the class corresponding to the fields in the table
D) Reference relationships between tables. dependencies between classes.

(2) which of the following statements about sessionfactory are true? (Multiple options)
A) For each database transaction, you should create a sessionfactory object
B) A sessionfactory object corresponds to a data inventory source.
C) sessionfactory is a heavyweight Object and should not be created at will. If there is only one data inventory source in the system, you only need to create one.
D) the load () method of sessionfactory is used to load persistent objects.

(3) There is a set-type orders attribute in the customer class, which is used to store the order object. In the customer. HBM. xml file, which element is used to map the orders attribute?
A) <set> B) <one-to-least> C) <allow-to-one> d) <property>

(4) <set> the element has a cascade attribute. If you want hibernate to cascade objects in the Set, what value should the casecade attribute take? (Single choice)
A) None
B) save
C) delete
D) Save-Update

(5) which of the following are session methods?
A) load ()
B) Save ()
C) Delete ()
D) Update ()
E) open ()
F) Close ()

(6) What are the printed results of the following programs? (Single choice)

Tx = session. begintransaction ();
Customer C1 = (customer) Session. Load (customer. Class, new long (1 ));
Customer C2 = (customer) Session. Load (customer. Class, new long (1 ));
System. Out. println (C1 = c2 );
TX. Commit ();
Session. Close ();

A) An error occurred while running. An exception is thrown.
B) print false
C) print true

(7) the following code modifies the name attribute of customer twice:
Tx = session. begintransaction ();
Customer customer = (customer) Session. Load (customer. Class,
New Long (1 ));
Customer. setname (/"Jack /");
Customer. setname (/"Mike /");
TX. Commit ();

How many update statements does hibernate need to submit to the database to execute the above program? (Single choice)
A) 0 B) 1 c) 2 D) 3

(8) What are the States of objects on the persistence layer? (Multiple options)
A) temporary status
B) independent status
C) Free Status
D) Persistence status

(9) In the following procedure, when does the customer object become persistent? (Single choice)
Customer customer = new customer (); // line1
Customer. setname (/"Tom/"); // line2
Session session1 = sessionfactory. opensession (); // line3
Transaction tx1 = session1.begintransaction (); // line4
Session1.save (customer); // line4
Tx1.commit (); // line5
Session1.close (); // line6

A) line1 B) line2 c) line3 d) line4 e) line5 f) line6

(10) In the following procedure, when does the customer object change to a free state? (Single choice)
Customer customer = new customer (); // line1
Customer. setname (/"Tom/"); // line2
Session session1 = sessionfactory. opensession (); // line3
Transaction tx1 = session1.begintransaction (); // line4
Session1.save (customer); // line4
Tx1.commit (); // line5
Session1.close (); // line6

A) line1 B) line2 c) line3 d) line4 e) line5 f) line6

(11) which of the following retrieval policies uses external link queries? (Single choice)
A) instant retrieval B) Delayed retrieval c) Urgent left outer link Retrieval

(12) What will happen if a latency search policy is used for the orders set of the customer class to compile or run the following Program (single choice)
Session session = sessionfactory. opensession ();
Tx = session. begintransaction ();
Customer customer = (customer) Session. Get (customer. Class, new long (1 ));
TX. Commit ();
Session. Close ();
Iterator orderiterator = Customer. getorders (). iterator ();

A) compilation error B) Compilation succeeded and c) Compilation succeeded, but an exception is thrown during runtime.

(13) which of the following statements about hql and SQL are true? (Multiple options)
A) There is no difference between hql and SQL.
B) hql is object-oriented, while SQL is used to manipulate relational databases.
C) Both hql and SQL contain select, insert, update, and delete statements.
D) hql is only used to query data and does not support insert, update, and delete statements.

(14) who implemented the transaction isolation level? (Single choice)
A) Java application B) hibernate c) Database System D) JDBC driver

(15) which of the following has good concurrency performance? (Single choice)
A) pessimistic lock B) optimistic lock

Answer:
(1) A, B, C (2) B, c (3) A (4) D (5) a, B, c, d, f (6) C (7) B (8) a, c, d (9) D (10) f (11) C (12) C (13) B, d (14) C (15) B

 

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.