Giter VIP home page Giter VIP logo

spring-hibernate-20120924's Introduction

spring-hibernate-20120924

Course Outline

Day 1

  • class design: Contact, Address ContactRepository (init, findAll, find, create, update, delete), AddressRepository (...) Setup (servlet context listener)

  • servlets / jsps: view all contact names, add a contact contact: edit name, address, delete contact

  • JDBC / JNDI / DataSource initialize tables in repositories, use raw sql

Day 2

  • finish servlets

  • intro hibernate/jpa META-INF/persistence.xml, persistence-unit-ref in web.xml javax.persistence.{ Persistence, EntityManager } @Entity, @Column, @OneToOne Rewrite ContactRepository and AddressRepository (findAll, find, create, update, delete) and refactor

Day 3

  • intro spring container-managed objects, dependency injection Spring MVC: controllers, @RequestMapping Spring JPA: JpaRepository, bytecode generation

  • refactor controller methods model, view, injecting request parameters, redirects

  • new class design: Contact, Person, Company, Office, Address how to represent polymorphism in jpa? @OneToMany, @ManyToOne, @ManyToMany

  • controllers: person: edit name, address, delete person company: edit name, view all offices, add an office, delete company

Day 4

  • office front-end introduce UrlEntity helper

  • horrible bugs! why doesn't delete work? ... orphan removal lazy loaded associations, open session in view filter

  • discussion: Spring high level

  • discussion: Transactions and AOP

  • discussion: Entity versioning, optimistic locking

  • data constraints nullable, length Validation (ex: @NotBlank, all employees of a manager must work for the same company)

Day 5

  • REST services more Spring MVC annotations Jackson

JDBC Pain Points / ORM Requirements

Code maintenance/evolution issues:

  • entity and sql can get out of sync as code evolves => objects must determine DB schema!
  • one must know sql => should be able to just get objects from somewhere / persist objects
  • no explicit relationship between entities (one-to-one???) => system must know relationships and constraints

Flexibility/reuse issues:

  • code is tied to a specific SQL implementation (dialect)

General ugliness/boilerplate:

  • very repetitive code, lots of try-finally => forget JDBC
  • checked SQLExceptions everywhere => forget JDBC
  • marshalling and unmarshalling is very clumsy

Performance/correctness issues:

  • no joins
  • no transactions
  • no good way to "create table if not exists"

Reference Material

Videos

spring-hibernate-20120924's People

Watchers

James Cloos avatar shaw avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.