JSF Spring Hibernate Introduction

Embed Size (px)

Citation preview

  • 8/21/2019 JSF Spring Hibernate Introduction

    1/28

    I am sick and cannot

    go to university. Today is

    the last date of registering

    for a course. How can Iregister for the course?

     

  • 8/21/2019 JSF Spring Hibernate Introduction

    2/28

    Idea!

    I can use the website of

    the university to register

    for the course.

  • 8/21/2019 JSF Spring Hibernate Introduction

    3/28

  • 8/21/2019 JSF Spring Hibernate Introduction

    4/28

    Wow!

    The university website

    is very interactive. In addition,

    it is lightweight as its

    Web pages are downloaded

    rapidly.

    How can you develop such a Web application?

  • 8/21/2019 JSF Spring Hibernate Introduction

    5/28

    To develop such a Web application, you need to

    reate a "ser Interface #"I$.

    Implement business logic.

    %tore data in the database.

  • 8/21/2019 JSF Spring Hibernate Introduction

    6/28

    To create a "I, you need to

    &lace "I components on a Web page.

  • 8/21/2019 JSF Spring Hibernate Introduction

    7/28

    &erform conversions and validations of data entered by the

    users in the "I components.

    conversion

    validation

  • 8/21/2019 JSF Spring Hibernate Introduction

    8/28

    'ormat the appearance of "I components.

    The font of button

    caption is different

    from the labels.

  • 8/21/2019 JSF Spring Hibernate Introduction

    9/28

    %et the layout of Web pages.

    (very Web page

    has the same

    layout.

  • 8/21/2019 JSF Spring Hibernate Introduction

    10/28

    ustomi)e the "I components.

     * set of "I

    components are

    grouped into a

    composite

    component.

  • 8/21/2019 JSF Spring Hibernate Introduction

    11/28

    +efreshes a part of the Web page asynchronously.

    alidation is

    performed and an

    error message is

    displayed instantly

    without refreshing

    the whole Webpage.

  • 8/21/2019 JSF Spring Hibernate Introduction

    12/28

    %o, which technology

    should I use to

    develop such a Web

    application?

  • 8/21/2019 JSF Spring Hibernate Introduction

    13/28

    -ou can use ava%erver 'aces #%'$ to develop an

    interactive and lightweight Web application.

    %' provides

    Inbuilt tags to create interactive user interfaces.

    onverters and validators for performing conversions and

    validations of user inputs.

    %tyles to format the appearance of "I components.

    Templates to set the layout of Web pages.

     *synchronous ava%cript and /01 #**/$ to refresh a part of

    the Web page asynchronously.

  • 8/21/2019 JSF Spring Hibernate Introduction

    14/28

    Once you have created the UI and converted and

    validated user inputs,

    what next?

  • 8/21/2019 JSF Spring Hibernate Introduction

    15/28

    The ne2t step is to implement the business logic that

    processes the application data.

    How can you implement the business logic?

    BusinessLogic

  • 8/21/2019 JSF Spring Hibernate Introduction

    16/28

    I can implement the

    business logic by creating

    different application

    components using theava classes.

  • 8/21/2019 JSF Spring Hibernate Introduction

    17/28

    The application components developed using the ava

    classes are tightly coupled.

    onse3uently, change in one component re3uires changing

    all the dependent components of the application.

    Let us consider an example.

  • 8/21/2019 JSF Spring Hibernate Introduction

    18/28

    onsider the following code snippetpublic class Order{

    ...........

    private Product prod;

    private Customer cust;

    public Order(){  //Order class is creating its dependent objects

      cust = new Customer();

    prod = new Product();

    }

    .............

    }

    Order

    Custom

    er

    Product

    Dependenton

    Dependenton

  • 8/21/2019 JSF Spring Hibernate Introduction

    19/28

    If any change is made in the Customer class or the

    Product class, the corresponding change needs to be

    reflected in the Order class as well.

    This re3uires you to recompile the whole code to reflect the

    change in the application.

    Order

    Customer

    Product

    Dependenton

    Dependenton

    hanges in

    Customer class

    or Product class

    +esult in changes

    being made to the

    Order class

  • 8/21/2019 JSF Spring Hibernate Introduction

    20/28

    How can I create

    loosely4coupled application

    components?

  • 8/21/2019 JSF Spring Hibernate Introduction

    21/28

    -ou can create loosely4coupled application components by

    using the 5ependency In6ection #5I$ feature of the %pring

    framework.

    Order

    Customer

    Product

    Injectedinto

    Injectedinto

  • 8/21/2019 JSF Spring Hibernate Introduction

    22/28

    ow that you have developed the UI and created

    loosely!coupled application components,

    what next?

    BusinessLogic

  • 8/21/2019 JSF Spring Hibernate Introduction

    23/28

    The ne2t step is to implement the logic to store and retrieveapplication data from a database.

    How can you implement the logic to

    communicate with a database?

    BusinessLogic

    Database

  • 8/21/2019 JSF Spring Hibernate Introduction

    24/28

    The logic to communicate

    with a database can be

    implemented by using

    a data access technology,such as 57.

  • 8/21/2019 JSF Spring Hibernate Introduction

    25/28

    The database communication logic implemented by using adata access technology is database dependent and

    re3uires comple2 logic implementation in the business tier.

    In addition, if the underlying database changes, the entire

    code to communicate with the database needs to be

    changed.

    CommunicationCode for SQL

    RDBMS 1

    RDBMS 2

    Communicatesit!

    Ma" not communicateit!

     #DBC

  • 8/21/2019 JSF Spring Hibernate Introduction

    26/28

    How can I implement the

    database communication logic

    that is simple and

    database independent?

  • 8/21/2019 JSF Spring Hibernate Introduction

    27/28

    -ou can implement the database communication logic thatis simple and database independent by using the Hibernate

    framework.

    CommunicationCode

    RDBMS 1

    RDBMS 2

    Communicatesit!

    Communicates it!

    $ibernate

  • 8/21/2019 JSF Spring Hibernate Introduction

    28/28

    Therefore, while developing a Web application, you canuse

    %' for the presentation tier.

    %pring for creating loosely4coupled components in the

    business tier.

    Hibernate for communicating with the database tier.

    Presentation%ier

    Business %ier Database %ier