Thursday, 21 February 2013

Hibernate and JPA Training Course - new release

At last, after six months of hard work, our Hibernate and JPA Training Course is now available.

It took so long because I wanted to cover all of the major areas of Hibernate and JPA. We can't cover every single bit of the API (I do encourage you to use the reference manual through the course), but I wanted to make sure that all of the problems that I've encountered with Hibernate is there on the course.

The best parts of the course are the three chapters towards the end where we look at how Hibernate integrates with real architectures. We look at basic web applications, Spring Applications and EJB Applications and it is surprising how easy it is to run into problems!

As always, code is provided and we're here to support you if you run into problems on the course!

The outline is:

  1. Introduction
  2. Getting Started
  3. Persisting Objects
  4. Configuring Hibernate
  5. Manipulating Objects (Dirty Checking)
  6. More on Mapping
  7. Handling Crashes and Logging
  8. Relationships
  9. Collections
  10. Bi Directional Relations
  11. Many to Many (really a long worked practical)
  12. Equals and HashCode
  13. XML Mappings
  14. Java Persistence API
  15. Cascades
  16. Embedding Objects
  17. Queries - Part 1
  18. Queries - Part 2
  19. Queries - Part 3
  20. Criteria API - Part 1
  21. Criteria API - Part 2
  22. Inheritance
  23. Detaching and Merging
  24. Optimistic Locking and Versioning
  25. Pessimistic Locking
  26. Performance and Lazy Initialisation
  27. Tuning Perfomance
  28. First Level Cache
  29. Second Level Cache
  30. Web Applications
  31. Spring Applications
  32. EJB/Java EE Applications
  33. Course Review

3 comments:

  1. Richard I'm working with JPA (Eclipselink) with Netbeans and they create a controller that looks like this:
    public class CustomerJpaController implements Serializable {
    public CustomerJpaController(UserTransaction utx, EntityManagerFactory emf) {this.utx = utx;this.emf = emf; }
    private UserTransaction utx = null; private EntityManagerFactory emf = null;
    public EntityManager getEntityManager() { return emf.createEntityManager(); }
    public void create(Customer customer) throws RollbackFailureException, Exception {EntityManager em = null;
    try {utx.begin();em = getEntityManager();em.persist(customer);utx.commit();} catch (Exception ex) {try {utx.rollback();
    } catch (Exception re) {throw new RollbackFailureException("An error occurred attempting to roll back the transaction.", re); }
    throw ex;} finally {if (em != null) { em.close();}}}
    public void edit(Customer customer) throws NonexistentEntityException, RollbackFailureException, Exception {EntityManager em = null;
    try {utx.begin();em = getEntityManager();customer = em.merge(customer);utx.commit();} catch (Exception ex) {try {
    utx.rollback();} catch (Exception re) {throw new RollbackFailureException("An error occurred attempting to roll back the transaction.", re); }
    String msg = ex.getLocalizedMessage(); if (msg == null || msg.length() == 0) {Long id = customer.getId(); if (findCustomer(id) == null) {
    throw new NonexistentEntityException("The customer with id " + id + " no longer exists.");}}throw ex;} finally {
    if (em != null) {em.close();}}}
    public void destroy(Long id) throws NonexistentEntityException, RollbackFailureException, Exception {EntityManager em = null;
    try {utx.begin();em = getEntityManager();Customer customer;try {customer = em.getReference(Customer.class, id);customer.getId(); } catch (EntityNotFoundException enfe) {
    throw new NonexistentEntityException("The customer with id " + id + " no longer exists.", enfe);}em.remove(customer);utx.commit();} catch (Exception ex) {
    try {utx.rollback(); } catch (Exception re) {throw new RollbackFailureException("An error occurred attempting to roll back the transaction.", re);
    }throw ex;} finally {if (em != null) {em.close(); }}}
    public List findCustomerEntities() {return findCustomerEntities(true, -1, -1);}
    public List findCustomerEntities(int maxResults, int firstResult) {return findCustomerEntities(false, maxResults, firstResult);
    }private List findCustomerEntities(boolean all, int maxResults, int firstResult) {EntityManager em = getEntityManager();
    try {CriteriaQuery cq = em.getCriteriaBuilder().createQuery();cq.select(cq.from(Customer.class));Query q = em.createQuery(cq);
    if (!all) {q.setMaxResults(maxResults); q.setFirstResult(firstResult);} return q.getResultList(); } finally {
    em.close();}}
    public Customer findCustomer(Long id) {EntityManager em = getEntityManager();try {return em.find(Customer.class, id);
    } finally {em.close();}} public int getCustomerCount() {EntityManager em = getEntityManager();
    try {CriteriaQuery cq = em.getCriteriaBuilder().createQuery();Root rt = cq.from(Customer.class);
    cq.select(em.getCriteriaBuilder().count(rt));Query q = em.createQuery(cq);return ((Long) q.getSingleResult()).intValue();
    } finally {em.close();}}}
    My question is how do I invoke these methods? Please help me out email: ty@radleaf.com

    ReplyDelete
  2. Hi Sorry Ty I missed your original post. As you can see the text has got mangled by our blogger software. If you're on the training course, could you send a message into the support system and we'll get a proper response back to you.

    ReplyDelete
  3. Hi Ultrasolution, please contact us via the contact us link at http://www.virtualpairprogrammers.com and we can deal with your enquiry there. Many thanks!

    ReplyDelete