1Z0-898 | Update 1Z0-898 Exam Study Guides With New Update Exam Questions


Q31. A developer who is designing entity classes to map a legacy database encounters a table called STUDENT_RECORD. 

This table has two columns, STUDENT_ID and STUDENT_INFO_ID. The primary key of this table consists of both columns, and there is a unique constraint on each info column. 

The STUDENT_ID column is foreign key to the STUDENT table and STUDENT_INFO_ID column is a foreign key to the STUDENT_DAT table. 

What entity classes and relationships can the developer use to model these tables and relationship?(Choose two) 

A. Model the student table as a student entity and STUDENT_DATA table StudentData entity. Model the STUDENT_RECORDS table as bidirectional many-to-many relationship between the student entity on the student data entity. 

B. Model the STUDENT table as a Student entity and the STUDENT-DATA table as a StudentData entity. Model the STUDENT_RECORD table as a bidirectional one-to-one relationship between the student entity and the StudentData entity. 

C. Model the STUDENT table as a Student entity and the STUDENT-DATA table as a StudentData entity. Model the Student-Records table as a student record entity. Create a many-to-one one relationship from the StudentRecord entity to the student entity and many-to-one relationship from the StudentRecord entity entity to the Student entity and many-to-one relationship from the student entity to the StudentData entity and one-to-many relationship from the StudentData entity to the StudentRecord entity. 

D. Model the STUDENT table as a Student entity and the STUDENT-DATA table as a StudentData entity. Model the STUDENT-RECORD table as a StudentRecord entity. Create a bidirectional one-to-one relationship between the StudentRecord entity and bidirectional one-to-one relationship between the Student Record entity and the Student Data entity. 

Answer: AC 

Q32. A session bean business method invokes UserTransaction.setRollbackonly and receives an IllegalStateException. 

Under which circumstance can this happen? 

A. The bean is using bean-managed transactions regardless of whether there is an active transaction. 

B. There is no circustance that would cause setRollbackOnly to throw an IllegalStateException. 

C. The bean is using bean managed transaction demarcation, and uaerTransaccion.begin has been invoked. 

D. The setRollbackOnly method is invoked within a bean-managed transaction, and userTransaction.commit has NOT been invoked. 

Answer:

Q33. A developer wants to model the grades for a student as a Map<course, integer>. Assume that Student and Course are entitles, and that grades are modeled by integers. 

Which of the following two statements are correct? (Choose two) A. The developer can model the grades as an element collection in the Student entity. 

B. The developer can model the grades as a oneToMany relationship in the Student entity. 

C. The mapping for the key of the map can be specified by the @MapKeycolumn annotation. 

D. The mapping for the value of the map can be specified by the @Column annotation. 

Answer: AC 

Q34. A user entity is retrieved in a query and stored in an instance variable user. The user entity has a single valued name property that uses the mapping defaults, and a photo property, which is lazily loaded. The application then calls the following method: 

PersistenceUtil.isLoaded (user); 

Which two of the following statements are correct? 

A. The name property was loaded from the database. 

B. The name property was NOTbeloaded from the database. 

C. The name property may or may not have been loaded from the database. 

D. The photo property was loaded from the database. 

E. The photo property was NOT loaded from the database. 

F. The photo property may or may not have been loaded from the database. 

Answer: AD 

Q35. The department entity has a unidirectional OneToMany relationship to the employee entity. The developer wants to model this relationship as a java.util.map such that the key of map is true employee name. The primary key of the Employees entity is empId, an integer. 

Which of the following is correct? 

A. @OneToMany (targetEntity = Employee.class) 

@MapKeyClass (string.class) 

map employees; 

B. @OneToMany @mapKey (name, “name”) map < integer, Employee> Employees; 

C. @OneToMany @MapKeyJoinColumn (name = “name”) map <String, Employee> employees; 

D. @OneToMany @mapsId (name = “name”) map <String, Employee> employees; 

Answer:

Q36. The developer has modeled student interests as a set <String>: 

@Entity public class Student { 

@Id int student Id; 

string name; 

@ElementaryCollection 

Set <String> Interests; 

. . . 

The developer wants the values of this set to be stored using a column named student_intersets. 

Select the item below that accomplishes this task: 

A. @ElementaryCollection @Column(name = “student_interests”) Set <string> interests; 

B. @ElementaryCollection (column = “student_intersets”) Set<String> interests; 

C. @ElementaryCollection @CollectionTable (column = “student_intersets”) Set<String> interests; 

D. @ElementaryCollection @CollectionTable (column = @column(name = “student_interests”)) Set <String> interests; 

Answer:

Q37. A user entity is in a one-to-many relationship with a Book entity. In other words, a developer reach the collection of books that a user instance myUser has by using the path expression-“myuser -books". 

A developer wants to write a Java Persistence query that returns all users that have only two books. 

Which two are valid queries that return this information? (Choose two.) 

A. SELECT u FROM User U WHERE SIZE (u.books) = 2 

B. SELECT u FROM User WHERE COUNT (u.books) = 2 

C. SELECT u FROM User u (WHERE COUNT (b) FROM u.books b) = 2 

D. SELECT u FROM user u WHERE (SELECT SIZE (b) FROM u.books b) = 2 

Answer: AC