Hibernate question Analysis

Source: Internet
Author: User
Tags bulk insert

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 (byte type not possible)

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

Resolution: A. are all disguised int

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

Analytical:

Dirty checks are performed at the time of transaction submission

Flush cache: The thing that refreshes the cache is dirty checking
Two different ways:
Mode one: Transaction commit
Mode two: Session.flush ();

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

Parsing: b.* cannot have

D. Should select D Write an alias

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

Parse:column: The foreign key column of the EMP in the data 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:<many-to-one> tag has no inverse attribute

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

Parsing: Theoptional value of the lazy attribute in the <set> tag has true,false,extra.

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: Theoptional value of the lazy attribute in the <many-to-one> tag is:false,Proxy and no-proxy

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

Parse: attribute with no ID

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

A <sqlMapConfig>

B <configuration>

C <setting>

D <environments>

11. In MyBatis, thevalue 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/executorty  Pe    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

Parsing: The C.d Clear () and flush () methods write back

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: No urgent right outer connection

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

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

Parse: Support Batch

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

Parsing: will not be loaded into the session cache and will not occupy 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 () to get all the elements in the collection

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

D The In keyword is thesame as "=any"

Parse: Any returned by any record

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

Parsing: Can be an SQL statement

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:Clob types can be mapped to java.lang.String or 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

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 Ignore these fields and properties without persisting 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 (A).

A 1

B Ten

C -

D Error

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

CREATE ROLE R1;

Grnat Select,insert on a_oe.orders to R1;

GRANT R1 to A_hr;

GRANT SELECT on a_oe.orders to a_hr;

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.

Hibernate question Analysis

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.