Bookmark Topic Watch Topic
 
friki data migration
Ranch Hand
Posts: 772
1
  • Mark post as helpful
  • send pies
  • Report post to moderator
These are some of the hints that I pulled out from EJB 3 in Action, Pro EJB 3.0, EJB 3 from O'Reilly. I've put them here to serve as an easy reference and tips for those appearing for the SCBCD 5.0 exam. The list will keep growing, so keep watching...

1. Annotations for Entity Mapping - Must Remember, @Id, @Table, @Enumerated, @Basic, @Column, @Lob, @Temporal, @GeneratedValue, @TableGenerator, @SequenceGenerator


2. In a relationship between two Entities, the entity side that has the reference to the other entity is said to be the owning side of the relationship. This is usually represented as the @JoinColumn Annotation.


3. Use the @PersistenceContext annotation to get hold of the Container-Managed-Entity Manager.


4. Container Managed Entity Manager comes in two flavours, Transaction Scoped and Extended Scope.


5. All container managed entity managers depend on JTA transactions.


6. JPQL specifies two types of parameter binding, namely Positional Parameter Binding and Named Parameter Binding.


7. Session Beans-Some rules that governs them

  • A session bean must have at least one business interface
  • The session bean class must be concrete. You cannot mark a session bean class as final or abstract as the container needs to manipulate it.
  • A session bean class can subclass another session bean
  • Annotation inheritance is supported with some limitations. For example, the bean type annotation @Stateless and @Stateful specified in a superclass bean will be ignored by a subclass bean when we deploy the subclass bean. However, any annotations used in the superclass to define life cycle callback methods and resource injections will be inherited by the bean class.
  • Business method names should not start with "ejb"
  • The arguments and the return type for remote methods must implement JavaDoc:java.io.Serializable interface.



  • 8. Bean life cycle callbacks can be implemented in the bean class itself or be defined in a separate interceptor class.


    9. Bean life cycle callbacks should all have a void return type, and callbacks cannot throw any checked exceptions (any exception that doesn't have JavaDoc:java.lang.RuntimeException as a parent).


    10. Some rules governing Message Driven Beans (MDB)

  • The MDB class must either directly (by using the implements keyword in the class declaration) or indirectly (through annotations or descriptors) implement a message listener interface.
  • The MDB class must be concrete. It cannot be abstract or final.
  • The MDB must be a POJO class and not a subclass of another MDB.
  • The MDB class must be declared public.
  • The MDB class must have a public no argument constructor.
  • You cannot define a finalize method in the MDB class. If any cleanup code is necessary, it should be done in the PreDestroy callback.
  • You must implement the methods defined in the message listener interface. These methods must be public and cannot be static or final.
  • You must not throw a JavaDoc:java.rmi.RemoteException or any runtime exceptions. If a RuntimeException is thrown, the MDB instance is terminated.



  • 11. Six properties of the @activationConfig parameter of the @MessageDriven Annotation,

  • destinationType
  • connectionFactoryJndiName
  • destinationName
  • acknowledgeMode
  • subscriptionDurability
  • messageSelector



  • 12. The objects that you can assign to the non-transient fields of a Stateful session bean instance are,

  • A serializable object
  • A null
  • A reference to the enterprise beans business interface, remote interface, local interface, remote home, local home, SessionContext, UserTransaction, EntityManager, EntityManagerFactory, Timer



  • 13. Out of the 6 transaction attributes, Supports, RequiresNew, Mandatory and Never are the ones that have a client initiated transaction context and these do not apply to MDB.


    14. Transaction isolation is defined in terms of isolation conditions called dirty reads, repeatable reads, phantom reads.


    15. The minimum annotations required for an Entity Bean in EJB 3.0 are @Id and @Entity.


    16. Entity Bean are not required to be Serializable; it is needed only when sending the bean in response to a remote call.


    17. The primary key for an Entity bean can be a class or a primitive.


    18. The persist(), find(), getReference(), merge() and remove() methods all throw an JavaDoc:java.lang.IllegalArgumentException if the parameter passed to them is not an entity type.


    19. MessageDrivenContext extends from the EJBContext and only the transactional methods are available to the MDB's, while invoking the other methods with a MessageDrivenContext results in a RuntimeException.


    20. Considerations for an ORM framework often circles around the following issues:

  • Impedence mismatch - The difference in the representations of the data between the domain model and the object model
  • Inheritance - How to represent the domain inheritence in the data model
  • Relationships - How to represent the relationships in the data / domain model



  • 21. The difference between using @Transient annotation and transient keyword is that, using the annotation makes the value to be retained when the object containing this annotated field is serialized across JVM's.


    22. The difference between getReference() and find() of an Entity operation is that the getReference() always returns a reference to the proxy object rather than the original target entity. The hetReference() is mostly useful in cases where there are relationships being built when persisting such entities.


    23. Cascade settings for entity persistence are uni directional, which means that the setting must be explicitly specified on both sides of the entity relationship.


    24. The three Date types in the java.sql package is mapped to the Date datatype in the database. The other two Date types in the java.util package (namely the java.util.Date and java.util.Calendar) are also mapped to the Date type in the database provided that they require the use of @Temporal (TemporalType.DATE/TIME/TIMESTAMP) mappings to the attribute in the entity.


    CategoryCertification OCEEJBD Links
     
      Bookmark Topic Watch Topic
    • New Topic