SlideShare ist ein Scribd-Unternehmen logo
1 von 73
PROJECT ON

STUDENT
INFORMATION
SYSTEM
Submitted by:
Prateek Chauhan
A STORY
MVC
• Model- Entity solely concerned with getting the
data, providing the data and being the data itself.
(The role of cook)

• View- Renders the model into a form that is actually
displayable. (The role of decorator)

• Controller- Orchestrates the entire
architecture, passes the necessary details to models
and then calls the right view in order to do the
presentation. (The roll of stickman)
Why MVC
• Controller is separated from Model. (Concept of
multiple cooks)

• View is separated from Model. (Cook doesn’t worry
about the presentation of food)

• View is separated from Controller. (Stickmen
doesn’t worry about the presentation)
MVC Frameworks

• Different MVC frameworks have different
implementations of these concepts.
• They provide prebuilt classes.
• They are extensible.
Popular Java MVC frameworks
•
•
•
•
•
•
•

Struts
Struts 2
Springs MVC
Play
JSF
Wicket
Many More
Pattern vs. Framework
• Pattern is a set of guidelines
on how to architect the
application
• When we implement a
pattern we need to have
some classes and libraries
• Thus, pattern is the way
you can architect your
application.

• Framework helps us to
follow a particular pattern
when we are building a web
application
• These prebuilt classes and
libraries are provided by the
MVC framework.
• Framework provides
foundation classes and
libraries.
Advantages of Frameworks
• Gets us started really quickly- If we are developing a
number of web applications on a similar pattern, then instead
of rewriting the same classes again and again, we have a set
of classes and libraries that make our work easier.

• Leverages industries best practices- If we use MVC
framework, it proves to be really helpful, because the way the
framework has been designed, it consumes a lot of real world
experience.
BUSINESS LOGIC

SERVLETS

JSPs
STRUTS 2 DISPATCHER: web.xml
• Verifies the request URI and determine which action to
invoke.
• Two types of dispatchers are used
– Filter Dispatcher (org.apache.struts2.dispatcher.FilterDispatcher)
STRUTS 2 DISPATCHER: web.xml
– StrutsPrepareAndExecuteFilter (org.apache.struts2.dispatcher.ng.filter
.StrutsPrepareAndExecuteFilter)
STRUTS 2 MODEL and VIEW
STRUTS 2 MODEL and VIEW

admin
STRUTS 2 MODEL and VIEW
STRUTS 2 MODEL and VIEW
STRUTS 2 CONTROLLERS- struts.xml
ABOUT STRUTS 2
• It’s an MVC framework
• Version 2
• Gives us prebuilt classes for MVC that we can
use / extend
HIBERNATE: AN APPROACH OF
ORM
JDBC
• Standard Java API for database-independent connectivity between
the Java programming language and a wide range of databases.
• JDBC provides a flexible architecture to write a database
independent applications that can run on different platforms and
interact with different DBMS without any modification.
• JDBC includes APIs for each of the task commonly associated with
database usage:
–
–
–
–

Making a connection to a database.
Creating SQL statements.
Executing SQL queries in the database.
Viewing & modifying the resulting records.
JDBC
Pros of JDBC
• Clean and simple SQL
processing
• Good performance with
small data
• Very good for small
applications
• Simple syntax so easy to
learn

Cons of JDBC
• Complex if it is used in large
projects
• Large programming
overhead
• No encapsulation
• Hard to implement MVC
concept
• Query is DBMS specific
HIBERNATE
• An ORM tool
• Used in the data layer of application, for
persisting application data into database
• Implements JPA
– This means that it follows a set of standards for
implementing persistence, so that in future if we want to
change from Hibernate, we can easily do it without any
performance issues.
The Problem
The Problem
•
•
•
•

Mapping member variables to columns
Mapping Relationships
Handling data types (esp. Boolean)
Managing changes to object state
The Problem

Relational
Object

Mapping!
ORM
• Converts data between relational databases and
object oriented programming languages
• Advantages over JDBC
–
–
–
–
–
–

Lets business code access objects rather than DB tables
Hides details of SQL queries from OO logic
Based on JDBC ‘under the hood’
No need to deal with database implementation
Transaction Management and automatic key generation
Fast development of applications
JAVA ORM Frameworks
•
•
•
•
•
•
•

Enterprise JavaBeans Entity Beans
Java Data Objects
Castor
TopLink
Springs DAO
Hibernate
Many More
Saving without Hibernate
•
•
•
•
•

JDBC Database Configuration
The Model Object
Service method to create the model object
Database Design
DAO method to save the object using SQL
queries
The Hibernate Way
• JDBC Database Configuration – Hibernate
Configuration
• The Model object – Annotations
• Service method to create the model object –
Use the Hibernate API
• Database Design – Not Needed !
• DAO method to save the objects using SQL
queries – Not Needed !
Supported Databases
•
•
•
•
•
•
•
•

HSQL
DB2
MySQL
PostgreSQL
FrontBase
Oracle
H2
Sybase and many more
Supported Technologies
•
•
•
•

Xdoclet Spring
J2EE
Eclipse plug-ins
Maven
Hibernate Architecture
HIBERNATE CONFIGURATION
• Refers to the hibernate configuration file that is
hibernate.cfg.xml
• This file is read first by the hibernate framework and the data
flow is done accordingly
• Consists of properties and mapping resource
• Mapping resource can consist of a xml file or a POJO class
with annotations
• Consists of properties such as connection url, driver class,
username, password, dialect and hbm2ddl.auto
HIBERNATE show_sql
Hibernate Mapping Resource
Hibernate Table Creation
Features of Hibernate
•
•
•
•

Implementation of JPA
ORM tool
Has data caching abilities
Provides an entire different SQL implementation known as
HQL, which is the basis of NoSQL databases
• Can persist the following relations in database, using
annotations as well as xml files.
–
–
–
–

One to One
One to Many
Many to One
Many to many
PROJECT MODULE:
CONTACT MANAGER
HOME PAGE
Deleting a Record
Deleting a Record
PROJECT SUMMARY

HARDWARE

SPECIFICATION

SOFTWARE

VERSION

MEMORY

10 GB

IDE

MyEclipse 8.0

RAM

128 MB

Server

Apache Tomcat 6.x

PROCESSOR

1.6 GHz

Front End

Struts 2.1.5

OS

WINDOWS 8

Back End

Hibernate 4 +
Oracle 10G XE
Trainee At
• ROAD AHEAD TECHNOLOGIES, JAIPUR
• Mentor: Mr. Abhishek Jain
THANK YOU

Weitere ähnliche Inhalte

Was ist angesagt?

JavaScript: Variables and Functions
JavaScript: Variables and FunctionsJavaScript: Variables and Functions
JavaScript: Variables and Functions
Jussi Pohjolainen
 

Was ist angesagt? (20)

Data and time
Data and timeData and time
Data and time
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
Ajax.ppt
Ajax.pptAjax.ppt
Ajax.ppt
 
Streams in Java 8
Streams in Java 8Streams in Java 8
Streams in Java 8
 
Java Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | EdurekaJava Design Patterns Tutorial | Edureka
Java Design Patterns Tutorial | Edureka
 
Ajax ppt
Ajax pptAjax ppt
Ajax ppt
 
Basics of JavaScript
Basics of JavaScriptBasics of JavaScript
Basics of JavaScript
 
Ajax Ppt
Ajax PptAjax Ppt
Ajax Ppt
 
Core java complete ppt(note)
Core java  complete  ppt(note)Core java  complete  ppt(note)
Core java complete ppt(note)
 
Java Server Pages
Java Server PagesJava Server Pages
Java Server Pages
 
Object Oriented Programming In JavaScript
Object Oriented Programming In JavaScriptObject Oriented Programming In JavaScript
Object Oriented Programming In JavaScript
 
Ajax presentation
Ajax presentationAjax presentation
Ajax presentation
 
Servlets
ServletsServlets
Servlets
 
JavaScript: Variables and Functions
JavaScript: Variables and FunctionsJavaScript: Variables and Functions
JavaScript: Variables and Functions
 
Event In JavaScript
Event In JavaScriptEvent In JavaScript
Event In JavaScript
 
OOP with Java - Continued
OOP with Java - Continued OOP with Java - Continued
OOP with Java - Continued
 
Autoboxing and unboxing
Autoboxing and unboxingAutoboxing and unboxing
Autoboxing and unboxing
 
Jsp ppt
Jsp pptJsp ppt
Jsp ppt
 
Nouveautés de java 8
Nouveautés de java 8Nouveautés de java 8
Nouveautés de java 8
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
 

Andere mochten auch

20130125 日本を創り継ぐプロジェクト
20130125 日本を創り継ぐプロジェクト20130125 日本を創り継ぐプロジェクト
20130125 日本を創り継ぐプロジェクト
Tomoshige Nakamura
 
Obbiettivamente: Il terzo numero del nostro giornalino
Obbiettivamente: Il terzo numero del nostro giornalinoObbiettivamente: Il terzo numero del nostro giornalino
Obbiettivamente: Il terzo numero del nostro giornalino
infocannizzaro
 
September 2013, European Leveraged Loan Market Analysis
September 2013, European Leveraged Loan Market Analysis September 2013, European Leveraged Loan Market Analysis
September 2013, European Leveraged Loan Market Analysis
Steve Richardson
 
TechVenture SMARTiQ
TechVenture SMARTiQ TechVenture SMARTiQ
TechVenture SMARTiQ
Renata George
 
Astek Academy SEO Bootcamp Checklist 2/25/12
Astek Academy SEO Bootcamp Checklist 2/25/12Astek Academy SEO Bootcamp Checklist 2/25/12
Astek Academy SEO Bootcamp Checklist 2/25/12
Astek Consulting
 
Csodás világ(3)+ani (nx powerlite)
Csodás világ(3)+ani (nx powerlite)Csodás világ(3)+ani (nx powerlite)
Csodás világ(3)+ani (nx powerlite)
VarganeAnny
 
мэндбаяр гимнастик5р анги
 мэндбаяр гимнастик5р анги мэндбаяр гимнастик5р анги
мэндбаяр гимнастик5р анги
mendbayr79
 

Andere mochten auch (20)

ORM is an Offensive Anti-Pattern
ORM is an Offensive Anti-PatternORM is an Offensive Anti-Pattern
ORM is an Offensive Anti-Pattern
 
ORM is a perfect anti-pattern
ORM is a perfect anti-patternORM is a perfect anti-pattern
ORM is a perfect anti-pattern
 
Open Days 2014 Odoo Architecture and readiness for web integration
Open Days 2014 Odoo Architecture and readiness for web integrationOpen Days 2014 Odoo Architecture and readiness for web integration
Open Days 2014 Odoo Architecture and readiness for web integration
 
Odoo Online platform: architecture and challenges
Odoo Online platform: architecture and challengesOdoo Online platform: architecture and challenges
Odoo Online platform: architecture and challenges
 
Software Architecture: Styles
Software Architecture: StylesSoftware Architecture: Styles
Software Architecture: Styles
 
Improving the performance of Odoo deployments
Improving the performance of Odoo deploymentsImproving the performance of Odoo deployments
Improving the performance of Odoo deployments
 
Better Email Marketing Strategy and Tips - An Astek Think-n-Drink Presentation
Better Email Marketing Strategy and Tips - An Astek Think-n-Drink PresentationBetter Email Marketing Strategy and Tips - An Astek Think-n-Drink Presentation
Better Email Marketing Strategy and Tips - An Astek Think-n-Drink Presentation
 
20130125 日本を創り継ぐプロジェクト
20130125 日本を創り継ぐプロジェクト20130125 日本を創り継ぐプロジェクト
20130125 日本を創り継ぐプロジェクト
 
For Publishers: Case Studies and Market Research for Mobile B2B Digital Marke...
For Publishers: Case Studies and Market Research for Mobile B2B Digital Marke...For Publishers: Case Studies and Market Research for Mobile B2B Digital Marke...
For Publishers: Case Studies and Market Research for Mobile B2B Digital Marke...
 
Obbiettivamente: Il terzo numero del nostro giornalino
Obbiettivamente: Il terzo numero del nostro giornalinoObbiettivamente: Il terzo numero del nostro giornalino
Obbiettivamente: Il terzo numero del nostro giornalino
 
September 2013, European Leveraged Loan Market Analysis
September 2013, European Leveraged Loan Market Analysis September 2013, European Leveraged Loan Market Analysis
September 2013, European Leveraged Loan Market Analysis
 
LKM2 Statistika Pend Edy Wihardjo
LKM2 Statistika Pend   Edy WihardjoLKM2 Statistika Pend   Edy Wihardjo
LKM2 Statistika Pend Edy Wihardjo
 
De wereld is mijn werkplek Ictivity IT Culinair 2012
De wereld is mijn werkplek   Ictivity IT Culinair 2012De wereld is mijn werkplek   Ictivity IT Culinair 2012
De wereld is mijn werkplek Ictivity IT Culinair 2012
 
TechVenture SMARTiQ
TechVenture SMARTiQ TechVenture SMARTiQ
TechVenture SMARTiQ
 
Prizes
PrizesPrizes
Prizes
 
Accepting the unfinished: your ever-evolving intranet
Accepting the unfinished: your ever-evolving intranetAccepting the unfinished: your ever-evolving intranet
Accepting the unfinished: your ever-evolving intranet
 
Astek Academy SEO Bootcamp Checklist 2/25/12
Astek Academy SEO Bootcamp Checklist 2/25/12Astek Academy SEO Bootcamp Checklist 2/25/12
Astek Academy SEO Bootcamp Checklist 2/25/12
 
Csodás világ(3)+ani (nx powerlite)
Csodás világ(3)+ani (nx powerlite)Csodás világ(3)+ani (nx powerlite)
Csodás világ(3)+ani (nx powerlite)
 
Ictericia neonatal
Ictericia neonatalIctericia neonatal
Ictericia neonatal
 
мэндбаяр гимнастик5р анги
 мэндбаяр гимнастик5р анги мэндбаяр гимнастик5р анги
мэндбаяр гимнастик5р анги
 

Ähnlich wie MVC + ORM (with project implementation)

Knockout implementing mvvm in java script with knockout
Knockout implementing mvvm in java script with knockoutKnockout implementing mvvm in java script with knockout
Knockout implementing mvvm in java script with knockout
Andoni Arroyo
 

Ähnlich wie MVC + ORM (with project implementation) (20)

Introduction to j2 ee frameworks
Introduction to j2 ee frameworksIntroduction to j2 ee frameworks
Introduction to j2 ee frameworks
 
JAVA EE training from 3rd-oct-2015
JAVA EE training from 3rd-oct-2015JAVA EE training from 3rd-oct-2015
JAVA EE training from 3rd-oct-2015
 
MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017MVC architecture by Mohd.Awais on 18th Aug, 2017
MVC architecture by Mohd.Awais on 18th Aug, 2017
 
Frameworks Galore: A Pragmatic Review
Frameworks Galore: A Pragmatic ReviewFrameworks Galore: A Pragmatic Review
Frameworks Galore: A Pragmatic Review
 
Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts Build Java Web Application Using Apache Struts
Build Java Web Application Using Apache Struts
 
Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC  Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC
 
Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013Getting started with MVC 5 and Visual Studio 2013
Getting started with MVC 5 and Visual Studio 2013
 
01 introduction to struts2
01 introduction to struts201 introduction to struts2
01 introduction to struts2
 
E-Commerce Applications Development
E-Commerce Applications Development E-Commerce Applications Development
E-Commerce Applications Development
 
Access Data from XPages with the Relational Controls
Access Data from XPages with the Relational ControlsAccess Data from XPages with the Relational Controls
Access Data from XPages with the Relational Controls
 
Laravel session 1
Laravel  session 1Laravel  session 1
Laravel session 1
 
Mastering asp.net mvc - Dot Net Tricks
Mastering asp.net mvc - Dot Net TricksMastering asp.net mvc - Dot Net Tricks
Mastering asp.net mvc - Dot Net Tricks
 
CTS2 Development Framework
CTS2 Development FrameworkCTS2 Development Framework
CTS2 Development Framework
 
70487.pdf
70487.pdf70487.pdf
70487.pdf
 
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
MSc Enterprise Systems Development Guest Lecture at UniS (2/12/09)
 
Architectural peripherals of react by Vadym Zhiltsov
Architectural peripherals of react by Vadym ZhiltsovArchitectural peripherals of react by Vadym Zhiltsov
Architectural peripherals of react by Vadym Zhiltsov
 
Knockout implementing mvvm in java script with knockout
Knockout implementing mvvm in java script with knockoutKnockout implementing mvvm in java script with knockout
Knockout implementing mvvm in java script with knockout
 
Asp.net mvc basic introduction
Asp.net mvc basic introductionAsp.net mvc basic introduction
Asp.net mvc basic introduction
 
ASP.NET Core Demos Part 2
ASP.NET Core Demos Part 2ASP.NET Core Demos Part 2
ASP.NET Core Demos Part 2
 
Struts2-Spring=Hibernate
Struts2-Spring=HibernateStruts2-Spring=Hibernate
Struts2-Spring=Hibernate
 

Kürzlich hochgeladen

Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 

Kürzlich hochgeladen (20)

Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 

MVC + ORM (with project implementation)

  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28. MVC • Model- Entity solely concerned with getting the data, providing the data and being the data itself. (The role of cook) • View- Renders the model into a form that is actually displayable. (The role of decorator) • Controller- Orchestrates the entire architecture, passes the necessary details to models and then calls the right view in order to do the presentation. (The roll of stickman)
  • 29. Why MVC • Controller is separated from Model. (Concept of multiple cooks) • View is separated from Model. (Cook doesn’t worry about the presentation of food) • View is separated from Controller. (Stickmen doesn’t worry about the presentation)
  • 30. MVC Frameworks • Different MVC frameworks have different implementations of these concepts. • They provide prebuilt classes. • They are extensible.
  • 31. Popular Java MVC frameworks • • • • • • • Struts Struts 2 Springs MVC Play JSF Wicket Many More
  • 32.
  • 33. Pattern vs. Framework • Pattern is a set of guidelines on how to architect the application • When we implement a pattern we need to have some classes and libraries • Thus, pattern is the way you can architect your application. • Framework helps us to follow a particular pattern when we are building a web application • These prebuilt classes and libraries are provided by the MVC framework. • Framework provides foundation classes and libraries.
  • 34. Advantages of Frameworks • Gets us started really quickly- If we are developing a number of web applications on a similar pattern, then instead of rewriting the same classes again and again, we have a set of classes and libraries that make our work easier. • Leverages industries best practices- If we use MVC framework, it proves to be really helpful, because the way the framework has been designed, it consumes a lot of real world experience.
  • 36.
  • 37.
  • 38.
  • 39. STRUTS 2 DISPATCHER: web.xml • Verifies the request URI and determine which action to invoke. • Two types of dispatchers are used – Filter Dispatcher (org.apache.struts2.dispatcher.FilterDispatcher)
  • 40. STRUTS 2 DISPATCHER: web.xml – StrutsPrepareAndExecuteFilter (org.apache.struts2.dispatcher.ng.filter .StrutsPrepareAndExecuteFilter)
  • 41. STRUTS 2 MODEL and VIEW
  • 42. STRUTS 2 MODEL and VIEW admin
  • 43. STRUTS 2 MODEL and VIEW
  • 44. STRUTS 2 MODEL and VIEW
  • 45. STRUTS 2 CONTROLLERS- struts.xml
  • 46. ABOUT STRUTS 2 • It’s an MVC framework • Version 2 • Gives us prebuilt classes for MVC that we can use / extend
  • 48. JDBC • Standard Java API for database-independent connectivity between the Java programming language and a wide range of databases. • JDBC provides a flexible architecture to write a database independent applications that can run on different platforms and interact with different DBMS without any modification. • JDBC includes APIs for each of the task commonly associated with database usage: – – – – Making a connection to a database. Creating SQL statements. Executing SQL queries in the database. Viewing & modifying the resulting records.
  • 49. JDBC Pros of JDBC • Clean and simple SQL processing • Good performance with small data • Very good for small applications • Simple syntax so easy to learn Cons of JDBC • Complex if it is used in large projects • Large programming overhead • No encapsulation • Hard to implement MVC concept • Query is DBMS specific
  • 50. HIBERNATE • An ORM tool • Used in the data layer of application, for persisting application data into database • Implements JPA – This means that it follows a set of standards for implementing persistence, so that in future if we want to change from Hibernate, we can easily do it without any performance issues.
  • 52. The Problem • • • • Mapping member variables to columns Mapping Relationships Handling data types (esp. Boolean) Managing changes to object state
  • 54. ORM • Converts data between relational databases and object oriented programming languages • Advantages over JDBC – – – – – – Lets business code access objects rather than DB tables Hides details of SQL queries from OO logic Based on JDBC ‘under the hood’ No need to deal with database implementation Transaction Management and automatic key generation Fast development of applications
  • 55. JAVA ORM Frameworks • • • • • • • Enterprise JavaBeans Entity Beans Java Data Objects Castor TopLink Springs DAO Hibernate Many More
  • 56. Saving without Hibernate • • • • • JDBC Database Configuration The Model Object Service method to create the model object Database Design DAO method to save the object using SQL queries
  • 57. The Hibernate Way • JDBC Database Configuration – Hibernate Configuration • The Model object – Annotations • Service method to create the model object – Use the Hibernate API • Database Design – Not Needed ! • DAO method to save the objects using SQL queries – Not Needed !
  • 61. HIBERNATE CONFIGURATION • Refers to the hibernate configuration file that is hibernate.cfg.xml • This file is read first by the hibernate framework and the data flow is done accordingly • Consists of properties and mapping resource • Mapping resource can consist of a xml file or a POJO class with annotations • Consists of properties such as connection url, driver class, username, password, dialect and hbm2ddl.auto
  • 62.
  • 66. Features of Hibernate • • • • Implementation of JPA ORM tool Has data caching abilities Provides an entire different SQL implementation known as HQL, which is the basis of NoSQL databases • Can persist the following relations in database, using annotations as well as xml files. – – – – One to One One to Many Many to One Many to many
  • 71. PROJECT SUMMARY HARDWARE SPECIFICATION SOFTWARE VERSION MEMORY 10 GB IDE MyEclipse 8.0 RAM 128 MB Server Apache Tomcat 6.x PROCESSOR 1.6 GHz Front End Struts 2.1.5 OS WINDOWS 8 Back End Hibernate 4 + Oracle 10G XE
  • 72. Trainee At • ROAD AHEAD TECHNOLOGIES, JAIPUR • Mentor: Mr. Abhishek Jain