Oracle 1Z0-898 Online Practice
Questions and Exam Preparation
1Z0-898 Exam Details
Exam Code
:1Z0-898
Exam Name
:Java EE 6 Java Persistence API Developer Certified Expert
Certification
:Oracle Certifications
Vendor
:Oracle
Total Questions
:63 Q&As
Last Updated
:Dec 12, 2021
Oracle 1Z0-898 Online Questions &
Answers
Question 31:
A developer is creating an entity which is mapped to a table that has a primary key constraint defined on two character columns and would like to use mapping defaults as much as possible to simplify the code.
Which two mapping options can be chosen? (Choose two.)
A. Use an @id property that constructs a private field as a concatenation of two columns. B. Use a separate class to map those two columns and use an @idclass annotation to denote I primary key field or property in the entity. C. Use a separate @Embeddable class to map those two columns and use an @EmbeddedId annotation to denote a single primary key field or property in the entity. D. Use a separate @Embeddable class to map those two column and add two fields or properties the entity, each marked as @id, that correspond to the fields or properties in the embeddable class. E. Use a separate class to map those two columns. Specify that class using @Idclass annotation on the entity class. Add two fields or properties to the entity, each marked as @Id, that correspond to the fields or properties in that separate class.
B. Use a separate class to map those two columns and use an @idclass annotation to denote I primary key field or property in the entity. C. Use a separate @Embeddable class to map those two columns and use an @EmbeddedId annotation to denote a single primary key field or property in the entity.
Question 32:
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
A. SELECT u FROM User U WHERE SIZE (u.books) = 2 C. SELECT u FROM User u (WHERE COUNT (b) FROM u.books b) = 2
Question 33:
An application has two entities, Department and Employee, and there is a one-to-many relationship between them. The application has the following query: SELECT d FROM Department d LEFT JOIN FETCH d. employees WHERE d.name = : name After receiving the results of the query, the application accesses the returned department's Employee entities stored in the Department.employees collection-valued attribute.
Which statement is true?
A. The database will be accessed once during the query execution phase, and once for each Employee entity in Department - employees. B. The database will be accessed once during the query execution phase ONLY. C. The database will be accessed once during the query execution phase, and once when the department.employees collection-valued attribute is used. D. The database will be accessed once during the query execution phase, once when the Department. Employees collection-valued attribute is used, and once for each employee entity in the Department.employees.
C. The database will be accessed once during the query execution phase, and once when the department.employees collection-valued attribute is used.
Question 34:
An application that uses pessimistic locking calls an updateData method that results in a LockTimeoutException being thrown. What three statements are correct? (Choose three)
A. The current transaction continues. B. The current statement continues. C. The current transaction is rolled back. D. The current statement is rolled back. E. The LockTimeoutException can NOT be caught. F. The LockTimeoutException can be caught, and the updateData method retried.
A. The current transaction continues. D. The current statement is rolled back. F. The LockTimeoutException can be caught, and the updateData method retried.
Question 35:
Persistence application locks entity x with a LockModeType. PESSIMISTIC_READ lock type, which statement is true?
A. This operation will force serialization among transactions attempting to read the entity data. B. This operation will result in a TransactionRolledbackException if the lock cannot be obtained. C. If the application later updates the entity, and the changes are flushed to the database, the lock will be converted to an exclusive lock. D. LockModeType. PESSIMISTIC_READ is the synonym of the LockModeType.READ.
B. This operation will result in a TransactionRolledbackException if the lock cannot be obtained.
Question 36:
An application uses optimistic locking by defining version attributes in its entity classes. The application performs a bulk update of the entities using a JPQL query. Which of the following is correct?
A. The persistence provider will ensure that the version value in each table is updated. B. The persistence provider will create a new transaction for the bulk update. C. An OptimisticLockException will be thrown by the persistence provider. D. The value of the Version attributes of the updated entitles should be also be explicitly updated by the query.
A. The persistence provider will ensure that the version value in each table is updated.
Reference:http://en.wikibooks.org/wiki/Java_Persistence/Locking(topic: optimistic locking, second paragraph)
Question 37:
Refer to the Exhibit.
A developer wants to have bookingdata stored in the table BOOKING, flightnumber in table FLIGHTBOOKING, and hotel name in HOTELBOOKING. Which code, inserted at line 11 of class Booking, is appropriate for his strategy?
A. @Joined B. @SingleTable C. @TablePerClass D. @Inheritance (strategy = JOINED) E. @Inheritance (strategy = SINGLE_TABLE) F. @Inheritance (strategy = TABLE_PER_CLASS)
D. @Inheritance (strategy = JOINED)
Question 38:
A stateless session bean's business method invokes EJBContext.setRollBackOnly and receives an IllegalStateException.
Under which of these conditions could this be possible?
A. The business method is marked with the MANDATORY transaction attribute. B. The business method is marked with the NONSUPPORTED transaction attribute. C. This Is NOT possible; a stateless session bean cannot invoke EJBContext.SetRollBackOnly. D. The bean has no metadata (in annotations 01 deployment descriptor) which specifies the transaction attribute for the method.
B. The business method is marked with the NONSUPPORTED transaction attribute.
Question 39:
The developer wants to write a portable criteria query that will order the orders made by customer James Brown according to increasing quantity. Which one of the below queries correctly accomplishes that task?
The developer wants to define a unidirectional relationship from the customer entity to the order entity and map this relationship using a foreign key mapping strategy.
Which one of the pairs of classes below correctly achieves this task?
A. @Entity public class Customer { @Id int customerId; @OneToMany @JoinColumn (name = "CUST_ID") Set orders; . . . } @Entity public class order { @Id int orderId; . . . } B. @Entity public class Customer { @Id int customerId; @OneToMany Set orders; . . . } @Entity @JoinColumn (names = "CUST-ID", referencedColumnName = "customerId") public class order { @Id int order Id; . . . } C. @Entity public class Customer { @Id int customerId; @OneToMany (JoinColumn = @joinColumn (name = "CUST_ID") Set orders; . . . } @Entity public class order { @Id int orderId; . . . } D. @ Entity public class Customer { @Id int customerId; @OneToMany (JoinColumn = @JoinColumn (name = "CUST_ID"), table = ""ORDER) Set orders; . . . } @Entity public class order { @Id int orderId; . . . }
A. @Entity public class Customer { @Id int customerId; @OneToMany @JoinColumn (name = "CUST_ID") Set orders; . . . } @Entity public class order { @Id int orderId; . . . }
Nowadays, the certification exams become more and more important and required by more and more
enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare
for the exam in a short time with less efforts? How to get a ideal result and how to find the
most reliable resources? Here on Vcedump.com, you will find all the answers.
Vcedump.com provide not only Oracle exam questions,
answers and explanations but also complete assistance on your exam preparation and certification
application. If you are confused on your 1Z0-898 exam preparations
and Oracle certification application, do not hesitate to visit our
Vcedump.com to find your solutions here.