Your success in Oracle 1Z0-895 is our sole target and we develop all our 1Z0-895 braindumps in a way that facilitates the attainment of this target. Not only is our 1Z0-895 study material the best you can find, it is also the most detailed and the most updated. 1Z0-895 Practice Exams for Oracle 1Z0-895 are written to the highest standards of technical accuracy.


♥♥ 2021 NEW RECOMMEND ♥♥

Free VCE & PDF File for Oracle 1Z0-895 Real Exam (Full Version!)

★ Pass on Your First TRY ★ 100% Money Back Guarantee ★ Realistic Practice Exam Questions

Free Instant Download NEW 1Z0-895 Exam Dumps (PDF & VCE):
Available on: http://www.surepassexam.com/1Z0-895-exam-dumps.html

Q41. MyMsg is a JMS message-driven bean with container-managed transaction demarcation. FooBean is an EJB 3.x stateless session bean that sends message to the JMS destination with MyMsgBean is associated. 

MyMsgBean’s message listener method has transaction attribute REQUIRED, and is defined as follows: 

10. public class MyMsgBean implements javax.jms.messageListener { 

11. public void onMessage(javax.jms.Message message) { 

12. / / do some work not shown here 

13. thrown new RuntimeException(“unexpected error . . . ”); 

14. } 

Which statement is true about the result of message processing? 

A. FooBean receives javax.ejb.EJBException. 

B. The container discards the MyMsgBean bean instance. 

C. FooBean receives the original RuntimeException thrown from the message listener method. 

D. The container does NOT roll back the transaction, and FooBean can continue the transaction. 

Answer:

Explanation: 

Note: public interface MessageListener 

A MessageListener object is used to receive asynchronously delivered messages. 

Each session must insure that it passes messages serially to the listener. This means that a listener assigned to one or more consumers of the same session can assume that the onMessage method is not called with the next message until the session has completed the last call. 

Reference: Enum TransactionAttributeType 


Q42. Which is a correct way to define a runtime exception as an EJB 3.x application exception? 

A. public class MyAppException extends javax.ejb.EJBException 

B. @ApplicationException public class MyAppException extends javax.ejb.EJBException 

C. public class MyAppException extends javax.lang.EJBException 

D. @ApplicationException public class MyAppException extends javax.lang.EJBException 

Answer:

Explanation: Use the @javax.ejb.ApplicationException annotation to specify that an exception class is an application exception thrown by a business method of the EJB. The EJB container reports the exception directly to the client in the event of the application error. 

Note: java.lang.Object java.lang.Throwable java.lang.Exception 

java.lang.RuntimeException 

javax.ejb.EJBException 

javax.ejb.

public class EJBException 

extends java.lang.RuntimeException 

The EJBException is thrown to report that the invoked business method or callback method could not be completed because of an unexpected error (e.g. the instance failed to open a database connection). 

Example: 

The following.ProcessingException.java.file shows how to use the.@ApplicationException.annotation to specify that an exception class is an application exception thrown by one of the business methods of the EJB: 

package examples; 

import javax.ejb.ApplicationException; 

/** * Application exception class thrown when there was a processing error * with a business method of the EJB. Annotated with the * @ApplicationException annotation. */ @ApplicationException()public class ProcessingException extends Exception { 

Reference: Programming WebLogic Enterprise JavaBeans, Version 3.0 programming Application Exceptions 


Q43. A developer writes an interceptor class containing an AroundInvoke method, and applies it to the local business interface method of a stateless session bean: 

11. @Interceptors(FooInterceptor.class) 

12. public void bar() () 

A client obtains a reference to the bean’s local business interface, and calls the method bar two times from the same thread. Assuming that the container dispatches both cell to the same stateless session bean instance, how many instances of the FooInterceptor class will be used? 

A. 0 

B. 2 

C. 1 

D. Either 1 or 2 

Answer:

Explanation: You can specify one nonbusiness method as the interceptor method for a stateless or stateful session bean. Each time a client invokes a session bean business method, OC4J intercepts the invocation and invokes the interceptor method..

Reference: Configuring an Around Invoke Interceptor Method on an EJB 3.0 Session Bean 


Q44. Assume you would like to receive notification from the container as a stateless session bean transitions to and from the ready state. 

Which of the following life cycle back annotations would you use? (Choose one.) 

A. @PostConstruct, @PostDestroy 

B. @PostConstruct, @PreDestroy 

C. @PreConstruct, @PostDestroy 

D. @PostConstruct, @PostDestroy, @Remove 

E. @PostConstruct, @PreDestroy, @Remove 

Answer:

Explanation: The Lifecycle of a Stateless Session Bean The EJB container typically creates and maintains a pool of stateless session beans, beginning the stateless session bean’s lifecycle. The container performs any dependency injection and then invokes the method annotated @PostConstruct, if it exists. The bean is now ready to have its business methods invoked by a client. 

At the end of the lifecycle, the EJB container calls the method annotated @PreDestroy, if it exists. The bean’s instance is then ready for garbage collection. 

Lifecycle of a Stateless Session Bean: 

Note: An enterprise bean goes through various stages during its lifetime, or lifecycle. Each type of enterprise bean (stateful session, stateless session, singleton session, or message-driven) has a different lifecycle. 

Reference: http://docs.oracle.com/javaee/6/tutorial/doc/giplj.html 


Q45. Which is a valid Postconstruct method in a message-driven bean class? 

A. @PostConstruct public boolean init() { return true; } 

B. @PostConstruct private static void init () {} 

C. @PostConstruct private void init () 

D. @PostConstruct public static void init () {} 

Answer:


Q46. Given the following stateful bean: 

10. @Stateful 

11. @TransactionAttribute(TransactionAttributeType.SUPPORTS) 

12. public class VideoBean implements video { 

13. / / insert code here 

14. public void method () {} 

15. } 

Assuming no other transaction-related metadata, which code can be added at line 13 to guarantee that business method methodA will execute only if invoked with an active transaction? 

A. @TransactionAttribute () 

B. @transactionmanagement(TransactionAttributeType.CONTAINER) 

C. @TransactionAttribute(transactionAttributeType.MANDATORY) 

D. @transactionAttribute(TransactionattributeType.RECQUIRES_NEW) 

Answer:


Q47. Suppose an EJB component is named HelloWorldBean is deployed as a standalone ejb-jar. Assuming the HelloWorldBean is implemented as follows: 

Which types of clients are guaranteed to have access to HelloWorldBean: 

A. Java EE application client container applications 

B. Java EE ejb components within the same ejb-jar 

C. Java EE web-tier component applications deployed in the same container 

D. Java EE ejb component applications deployed in the same container 

Answer:


Q48. An enterprise developer has received ejb-jars from multiple Bean Provides and wants to combine them into a single ejb-jar as well as altering the method permissions on some of the beans without recompiling any of the code contained in the ejb-jar. Which is correct? 

A. Bean Provide is the only role that can perform this task. 

B. Deployed is the most appropriate role to perform this task. 

C. Either a Deployer or System Administrator role many perform this task. 

D. This problem cannot be solved using an EJB 3.x-compliant approach. 

E. Application Assembler is the most appropriate role to perform this task. 

Answer:

Explanation: Application Assembler 

The Application Assembler combines enterprise beans into larger deployable application units. The input to the Application Assembler is one or more ejb-jar files produced by the Bean Provider(s). The Application Assembler outputs one or more ejb-jar files that contain the enterprise beans along with their application assembly instructions. 

Note: 

* EJB Structure 

The EJB Java ARchive (JAR) file is the standard format for assembling enterprise beans. This file contains the bean classes (home, remote, local, and implementation), all the utility classes, and the deployment descriptors (ejb-jar.xml and sun-ejb-jar.xml). 

* The Application Assembler can also combine enterprise beans with other types of application components when composing an application. 

Reference: Match the seven EJB roles with the corresponding description of the role's responsibilities. 


Q49. Which statement is true about both stateful session beans and stateless session beans? 

A. Bean instance are NOT required to survive container crashes. 

B. Any bean instance must be able to handle concurrent invocations from different threads. 

C. A bean with bean-managed transactions must commit or roll back any transaction before returning from a business method. 

D. The container passivates and actives them using methods annotated with @PrePassivate and @PostActivate annotations. 

Answer: AC 

Explanation: 

Note: 

* Session beans can either be stateful or stateless. With stateful beans, the EJB container saves internal bean data during and in between method calls on the client’s behalf. With stateless beans, the clients may call any available instance of an instantiated bean for as long as the EJB container has the ability to pool stateless beans. This enables the number of instantiations of a bean to be reduced, thereby reducing required resources. 

Incorrect: 

B: Stateful session beans maintain state both within and between transactions. Each stateful session bean is therefore associated with a specific client. 

D: @PrePassivate(javax.ejb.PrePassivate) : 

If a stateful session bean instance is idle for too long, the container might passivate it and store its state to a cache. 

The method tagged by this annotation is called before the container passivates the bean instance. 

This annotation is only applicable to stateful session beans. 


Q50. Which statement about message-driven beans is correct? 

A. Each message-driven bean instance will be invoked by only one thread at a time. 

B. When dispatching messages to message beam instances the container must preserve the order in which messages arrive. 

C. If a message-driven bean is associated with a JMS queue, each bean instance in the pool will receive each message sent to the queue. 

D. If a message driven bean is associated with a JMS durable subscription, each bean instance in the pool will receive each message sent to the durable subscription. 

Answer: