Internal Test pen Questions for the use of Hibernate to develop rental systems

Source: Internet
Author: User
Tags bulk insert

One, the choice question (total questions, 2.5 per question choice of one or more, the selection of the wrong choice cannot be divided)

1. In Hibernate, the following statement about the primary key generator is wrong (AC).

A Increment can be used for primary keys of type long, short, or byte

B Identity for databases that support identity columns such as SQL Server, DB2, MySQL, and so on

C Sequence for databases such as Oracle, SQL Server, and other supporting sequences

D Native by hibernate based on the underlying database to determine what the primary key generation strategy, is the use of the database to generate the value of the primary key

2. In Hibernate, the right thing to say about dirty checking and refreshing the cache is (AB).

A Dirty checks occur when a transaction commits

B The flush () method of the session is the method of refreshing the cache

C The flush () method of the session is not invoked until the commit () method of the session is executed

D Call the Flush () method before calling the commit () method when writing code

Parse: Dirty Check is the time of transaction commit, refresh cache do is dirty check

3. Use HQL to query all department information, the following is correct (AD).

A From Dept

B SELECT * FROM Cn.jbit.demo.entity.Dept

C Select Dept from Cn.jbit.demo.entity.Dept D

D Select D from Dept D

Parse: HQL statement cannot have *,c option should be written as Select D from Cn.jbit.demo.entity.Dept D

4. For the list () and iterate () methods of the query interface, it is correct to say (AD).

A Executes the list () method to query all eligible records

B Execute the Iterate () method to query all eligible records

C Executes the list () method to query all eligible primary key values

D Executes the iterate () method to query all eligible primary key values

5. In Hql, the method for binding parameters of the query interface is correct (ABCD).

A The Setparameter () method is used to bind arguments of any type

B Setparameter () There is an overloaded method

C SetProperties () There is an overloaded method

D The SetProperties () method is used to bind named arguments

6. In Hibernate, for the following mapping configuration, it is wrong to say (D).

<class name= "cn.jbit.hibernatedemo.entity.Emp" table= "EMP" schema= "Scott" >

<id name= "EmpNo" column= "EmpNo" type= "Java.lang.Integer" >

<generator class= "Assigned"/>

</id>

<property name= "Salary" type= "java.lang.Double" column= "SAL"/>

<property name= "HireDate" type= "Java.util.Date"/>

<many-to-one

Name= "Dept"

Column= "DEPTNO"

Class= "Cn.jbit.hibernatedemo.entity.Dept"

/>

</class>

A This configuration information describes the mapping of the CN.JBIT.HIBERNATEDEMO.ENTITY.EMP class and the EMP table

B That describes the EMP table for Scott users.

C The name attribute value in the <many-to-one> tag dept is the property name of the Cn.jbit.hibernatedemo.entity.Emp class

D The column attribute value in the <many-to-one> tag Deptno is the primary key name of the Dept table

Parsing: The column attribute value in the D option Deptno is the foreign key column in the EMP table

7. In the hibernate mapping file, the inverse attribute is said to be correct (ACD).

A The inverse property has two values: true, False

B <many-to-one> tags have inverse properties

C <set> tags have inverse properties

D The inverse property is used to specify the party that maintains the association relationship

Parse: No inverse attribute in many-to-one

8. In the hibernate mapping file, it is wrong to say that the deferred load configuration is (BD)

A <class> tag in the lazy attribute optional value: True, False

B Optional values for the lazy attribute in the <set> tab: True, proxy, and No-proxy

C < set> tag in the lazy attribute optional value: True, Extra, and false

D The optional value of the lazy attribute in the <many-to-one> tag: proxy, True, and False

Parsing: Class-level value: True,false

One-to-many or many-to-many-level values: True,false,extra

Multiple-to-one level values: Proxy,no-proxy,false

9. In the hibernate mapping file, the <component> tag statement is correct (ABC).

A <component> tags for mapping component classes

B <component> tags by <parent> specifies the whole class to which the component class belongs

C <component> tags by <property> specifying properties of the component class

D <component> tag has ID, name, class attribute

No id attribute in parse:<component> tag

10. MyBatis the root element of the specified configuration file is using (B).

A <sqlMapConfig>

B <configuration>

C <setting>

D <environments>

11. In MyBatis, the value of Executortype includes (ABD).

A Executortype.simple

B Executortype.batch

C Executortype.execute

D Executortype.reuse

Analytical:

Public final enum Org.apache.ibatis.session.ExecutorType {

Field descriptor #8 Lorg/apache/ibatis/session/executortype;
public static final enum Org.apache.ibatis.session.ExecutorType simple;

Field descriptor #8 Lorg/apache/ibatis/session/executortype;
public static final enum Org.apache.ibatis.session.ExecutorType reuse;

Field descriptor #8 Lorg/apache/ibatis/session/executortype;
public static final enum Org.apache.ibatis.session.ExecutorType BATCH;

12. The error about hibernate caching is (CD).

A Hibernate caches generally fall into three categories: first-level cache, level two cache, and query cache

B The evict () method of the session is used to purge the specified persisted object from the cache

C The clear () method of the session is used to flush the cache

D The flush () method of the session is used to purge all persisted objects from the cache

Parse: The clear () method of the session is used to purge all persisted objects from the cache

The flush () method of the session is used to flush the cache

13. Regarding the connection query of HQL, it is wrong to say (D).

A Inner JOIN or join for inner joins

B INNER JOIN fetch or join FETCH for urgent inner joins

C LEFT OUTER join fetch or IEFT join fetch for an urgent right outer join

D The right outer join fetch, or join fetch, is used to urgently use outer joins

Parse: There is no urgent right outer join in HQL statement

14. The right thing to say about Hibernate batch processing data is (CD).

A Batch operation with HQL, Hibernate does not support BULK INSERT

B Using the JDBC API for bulk operations, the data involved in SQL statements is loaded into the session cache, taking up memory space

C Use session for bulk operations, data will be loaded into session cache, attention should be paid to flush and empty cache

D Use session for batch operations, for complex business logic scenarios that require code processing

15. The use of aggregate functions for HQL is correct (ABCD).

A Select COUNT (*) from Dept D for Statistics Department number

B Select SUM (e.salary) from EMP E to summarize employee payroll

C Select Max (e.hiredate) from Emp E is used to find the entry time of the newest employee in the job

D Select min (e.hiredate) from Emp E to find the earliest entry time of the employee

16. In the HQL subquery, it is wrong to say (C).

A Size () or size to get the number of elements in the collection

B Elements () gets all the elements in the collection for the element

C The Any keyword is used for subquery statements to return all records

D The In keyword is the same as "=any"

Parse: Any keyword used to return any record in a subquery statement

17. For native SQL queries and named queries, the right thing to say is (ABC).

A To execute native SQL, use the SQLQuery object

B SQLQuery is an interface that inherits the query interface

C Hibernate supports the definition of query statements in the form of strings in a mapping file, such as a named query statement

D A named query statement can only be a HQL statement, not an SQL statement

Parse: A named query is a native SQL

18. In Hibernate, the method for mapping blobs and CLOB types in Oracle is correct (BCD).

A The CLOB type can only be mapped to java.lang.String

B Blob types can be mapped to Java.sql.Blob

C BLOB type can be mapped to byte[]

D Clob types can be mapped to java.lang.String or Java.sql.Clob

Parsing: Blob data type: byte[] Java.sql.Blob

Clob data type: java.lang.String Java.sql.Clob

19. In hibernate, the argument about the criteria method is wrong (CD).

A The Restrictions.ge () method is equivalent to the HQL operator >=

B Restrictions.like ("EmpName", "s", Matchmode.start) methods are used to find employees whose names begin with S

C The Restrictions.disjunction () method is used to specify multiple logical AND

D The Restrictions.in () method can only be used for arrays

Parsing: C: Logical OR

D: can also be used for collection

20. In hibernate, the annotation is correct (ABD).

A @Id the unique identity used to declare a persisted class, corresponding to the primary key in the data table

B @Cloumn used to map properties to columns

C @Transient used to ignore this property and need to persist to the database

D @GeneratedValue a build strategy for defining primary key values

Parsing: @Transient used to ignore this property, but does not need to persist to the database

21. The following statement about synonyms, the correct option is (C).

A You can only create synonyms for a table, you cannot create a synonym for a view

B Synonyms can only be used to reference tables created by other users

C Public and private synonyms can have the same name as a table

D The table referenced by the synonym is not valid while deleting the synonym using the drop SYNONYM statement

22. Evaluate the Create TABLE statement:

CREATE TABLE Products

(

PRODUCT_ID Number (6) CONSTRAINT prod_id_pk PRIMARY KEY,

Product_Name VARCHAR2 (15)

)

The following about the PROD_ID_PK option is correct (B).

A can be created, but requires a unique index to be created manually

B Can be created and will automatically create a unique index

C Can be created and will automatically create non-unique indexes

D can be created but cannot be used because no index is specified

23. The following SQL statement that creates the sequence:

CREATE SEQUENCE seq1

START with 100

INCREMENT by 10

MINVALUE 1

MAXVALUE 200

CYCLE

NOCACHE;

The generated value of the sequence seq1 has reached the maximum value of 200, and then executes the following statement:

SELECT Seq1.nextval from dual;

The options for the following explicit correct values are (D).

A 1

B 10

C 100

D Error

24. A_oe and A_HR are 2 users in the database, and there is a table orders under A_oe that executes the following statements:

CREATE ROLE R1; --system under

Grnat Select,insert on a_oe.orders to R1; --a_oe mode

GRANT R1 to A_hr; --system mode

GRANT SELECT on a_oe.orders to a_hr; --a_oe mode

REVOKE SELECT on a_oe.orders from A_HR;

The correct result after executing the above statement is (A).

A A_HR can query a_oe.orders table

B A_HR can not query a_oe.orders table

C The REVOKE statement revokes the A_HR SELECT permission and also revokes the SELECT permission from the R1 role

D The REVOKE statement will error because the SELECT permission has been granted by the R1 role

25. For the view, the following statement is correct (CD).

A Views with column aliases cannot be modified

B The use of subqueries in a complex view definition cannot contain aggregation (grouping) functions and joins

C If a view definition contains the DISTINCT keyword, it cannot be deleted through the view

D The or REPLACE option is used in the CREATE VIEW syntax to modify an existing view definition without deleting the view.

Internal Test pen Questions for the use of Hibernate to develop rental systems

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.