SlideShare a Scribd company logo
QUESTION BANK
UNIT –VI
Q.1 Explainthe Hibernate Framework
Ans:
 Hibernateis an Object-relationalmapping (ORM)tool.Object-relationalmappingorORMis a
programming method formapping theobjectsto the relational modelwhereentities/classesare mapped
to tables,instancesaremapped to rowsand attributesof instancesaremapped to columnsof table.
 A “virtual objectdatabase”iscreated thatcan be used fromwithin the programming language.
 Hibernateis a persistenceframeworkwhich isused to persist data fromJava environmentto database.
Persistenceis a processof storing the data to some permanentmediumand retrieving it backat any
pointof time even afterthe application thathad created thedata ended.
 The abovediagramshowsa comprehensivearchitectureof Hibernate.In orderto persistdatato a
database,Hibernatecreatean instanceof entity class(Java classmapped with databasetable). This
objectis called Transient objectasthey arenot yet associated with thesession or notyet persisted to a
database.
 To persist theobjectto database,theinstanceof SessionFactory interfaceiscreated.SessionFactory isa
singleton instancewhich implements Factory design pattern.SessionFactory loadshibernate.cfg.xml
file(Hibernateconfiguration file.Moredetails in following section) and with the help of
TransactionFactory and ConnectionProviderimplementsallthe configuration settingson a database.
 Each databaseconnection in Hibernateis created by creating an instanceof Session interface.Session
representsa single connection with database.Session objectsarecreated fromSessionFactory object.
 Hibernatealso providesbuilt-in Transaction APIswhich abstractsaway the application fromunderlying
JDBC or JTA transaction.Each transaction representsa singleatomic unitof work.OneSession can span
through multipletransactions.
SessionFactory(org.hibernate.SessionFactory)
A thread-safe,immutablecacheof compiled mappingsfora single database. A factory fororg.hibernate.Session
instances.A client of org.hibernate.connection.ConnectionProvider.Optionally maintainsa second levelcache of
datathatis reusable between transactions ata processor cluster level.
Session(org.hibernate.Session)
A single-threaded,short-lived objectrepresenting a conversationbetween the application and thepersistent
store.Wrapsa JDBC java.sql.Connection. Factory fororg.hibernate.Transaction.Maintainsa firstlevel cacheof
persistentthe application’spersistentobjectsand collections;thiscache is used when navigating theobject
graph orlooking up objectsby identifier.
Persistent objectsand collections
Short-lived,singlethreaded objects containing persistentstateand businessfunction.Thesecan beordinary
JavaBeans/POJOs.They areassociated with exactly oneorg.hibernate.Session.Oncetheorg.hibernate.Session is
closed, they will bedetached and free to use in any application layer (forexample, directly as datatransfer
objectsto and frompresentation).
Transient anddetached objects andcollections
Instancesof persistentclassesthatare notcurrently associated with a org.hibernate.Session.They may have
been instantiated by the application and notyet persisted,orthey may havebeen instantiated by a closed
org.hibernate.Session.
Transaction(org.hibernate.Transaction)
(Optional) A single-threaded,short-lived objectused by theapplication to specify atomicunits of work.It
abstractstheapplication fromthe underlying JDBC,JTA or CORBA transaction.A org.hibernate. Session might
span severalorg.hibernate.Transactionsin somecases.However,transaction demarcation,eitherusing the
underlying APIororg.hibernate.Transaction,is
neveroptional.
ConnectionProvider(org.hibernate.connection.ConnectionProvider)
(Optional) A factory for,and poolof,JDBCconnections.Itabstractsthe application fromunderlying
javax.sql.DataSourceorjava.sql.DriverManager. Itisnotexposed to application,butit can be extended and/or
implemented by the developer.
TransactionFactory(org.hibernate.TransactionFactory)
(Optional) A factory fororg.hibernate.Transaction instances.Itisnot exposed to theapplication, butit can be
extended and/orimplemented by the developer.
Q.2 Explainthe Struts Framework
Ans: The StrutsFrameworkisa standard fordeveloping well-architected Web applications.Ithasthe following
features:
 Open source
 Based on the Model-View-Controller(MVC) design paradigm,distinctly separating allthreelevels:
o Model: application state
o View: presentation of data (JSP,HTML)
o Controller:routing of theapplication flow
 ImplementstheJSPModel 2 Architecture
 Storesapplication routing information and requestmappingin a single core file, struts-config.xml
The StrutsFramework,itself,only fills in theView and Controllerlayers. The Modellayer is left to the developer.
All incoming requestsareintercepted by the Strutsservlet controller.The StrutsConfiguration filestruts-
config.xmlisused by the controllerto determine therouting of the flow.This flowsconsistsof an alternation
between two transitions:
From Viewto Action:
A userclicks on a link orsubmitsa formon an HTML or JSPpage.The controller receives the request, looksup the
mapping forthisrequest,and forwardsitto an action.The action in turn calls a Modellayer
From Actionto View:
(Businesslayer) service or function.Afterthecall to an underlying function orservicereturnsto the action class,
the action forwardsto a resource in the View layer and a pageis displayed in a web browser.
The diagrambelowdescribes the flowin more detail:
1. User clicks on a link in an HTML page.
2. Servlet controller receives therequest,looksup mapping information in struts-config.xml,and
routesto an action.
3. Action makesa call to a Modellayer service.
4. Service makesa call to the Datalayer (database)and therequested data isreturned.
5. Service returnsto theaction.
6. Action forwardsto a View resource(JSPpage)
7. Servlet looksup the mapping fortherequested resourceand forwards to theappropriateJSP
page.
8. JSP file is invoked and sentto the browserasHTML.
9. User is presented witha newHTML pagein a web browser.
Q.3 Explainweb.xml and struts.xml files
Ans: The interactions in MVCmodel between Model,View and Controllerflow are taken care by the struts
configuration files.Thesefiles are web.xml,struts.xml,struts-config.xmland struts.properties.
web.xml:
 The web.xmlconfiguration fileis a J2EE configuration filethatdetermines how elementsof the HTTP
requestare processed by the servlet container.
 The web.xml web application descriptor file represents the core of the Java web application, so it is
appropriatethatit is also partof the core of the Strutsframework.
 In the web.xml file, Struts defines its FilterDispatcher, the Servlet Filter class that initializes the Struts
frameworkand handlesallrequests.
 This filter can contain initialization parameters that affect what, if any, additional configuration files are
loaded and howtheframeworkshould behave.
 The web.xmlfile needsto be created underthefolderWebContent/WEB-INF.
 Configuring web.xmlfortheframeworkisa matterof adding a filter and filter-mapping.
struts.xml
 The struts.xml file contains the configuration information that you will be modifying as actions are
developed.
 This file can be used to override default settings for an application, for example struts.devMode =
falseand other settingswhich are defined in property file.
 This file can be created underthe folder WEB-INF/classes.
Example:
<struts>
<constantname="struts.devMode"value="true"/>
<packagename="helloworld"extends="struts-default">
<action name="hello"class="HelloWorldAction" method="execute">
<result name="success">/HelloWorld.jsp</result>
</action>
</package>
</struts>
Q.4 What is objectrelational mapping(ORM)?what are its advantages?
Ans: 1. FacilitatesimplementingtheDomainModel pattern: This onereason supersedesall others.In short
using this pattern meansthatyou modelentities based on real businessconceptsratherthan based on
yourdatabasestructure.ORMtoolsprovidethisfunctionality through mapping between thelogical
businessmodeland the physicalstoragemodel.
2. Huge reduction incode: ORM toolsprovidea hostof services thereby allowing developersto focuson the
businesslogic of the application rather than repetitive CRUD(CreateRead UpdateDelete) logic.
3. Changesto the object model are made in one place:One you updateyourobjectdefinitions,theORM
will automatically usethe updated structurefor retrievalsand updates.Thereare no SQL Update,Delete
and Insertstatementsstrewn throughoutdifferentlayersof theapplication thatneed modification.
4. Rich query capability:ORMtoolsprovidean objectoriented query language.Thisallowsapplication
developersto focuson the objectmodel and notto haveto be concerned with thedatabasestructureor
SQL semantics.TheORM tool itself will translatethequery languageinto the appropriatesyntax forthe
database.
5. Navigation:You can navigateobjectrelationshipstransparently.Related objectsareautomatically
loaded asneeded.For exampleif you load a POand you wantto accessit's Customer,you can simply
access PO. Customerand theORMwill take care of loading thedata for you without any efforton your
part.
6. Data loadsare completelyconfigurableallowingyoutoloadthe data appropriatefor each scenario.
For examplein onescenario you mightwantto load a list of POswithoutany of its child / related objects,
while in other scenariosyou can specify to load a PO,with all its child Line Items,etc.
7. Concurrencysupport: Supportformultipleusers updating thesamedata simultaneously.
8. Cache management:Entities are cached in memory thereby reducing load on the database.
9. Transactionmanagementand Isolation:Allobjectchangesoccurscoped to a transaction.Theentire
transaction can either be committed orrolled back. Multipletransactionscan be activein memory in the
sametime, and each transactionschangesareisolated formon another.
10. Key Management: Identifiersand surrogatekeysareautomatically propogated and managed.
Q.5 What is the importance of hibernate mapping file?Explainwith suitable example
Ans:  Mapping fileis the heartof hibernateapplication.
 Every ORMtool needsthis mapping,mappingisthe mechanismof placing an objectpropertiesinto
column’sof a table.
 Mapping can begiven to an ORMtool either in the formof an XMLor in theformof theannotations.
 The mapping file contains mapping froma pojo classnameto a table nameand pojo classvariable
namesto table column names.
 While writing an hibernateapplication,wecan construct oneor more mapping files,mean a hibernate
application can contain any numberof mapping files.
 generally an objectcontains 3 properties like
Identity (ObjectName)
State(Objectvalues)
Behavior(ObjectMethods)
Example:
<hibernate-mapping>
<class name="Employee"table="EMPLOYEE">
<meta attribute="class-description">Thisclass
containstheemployeedetail.
</meta>
<id name="id"type="int"column="id">
<generatorclass="native"/>
</id>
<propertyname="firstName"column="first_name"
type="string"/>
<propertyname="lastName"column="last_name"
type="string"/>
<propertyname="salary"column="salary"type="int"/>
</class>
</hibernate-mapping>
Q.6 Explainthe working of Hibernate
Ans: Hibernateis the ORMtool given to transferthedata between a java (object) application and a database
(Relational) in theformof the objects. Hibernate is the open sourcelight weighttool given by GavinKing
Hibernateprovidesa solution to map databasetablesto a class. It copiesone row of the databasedatato a
class.In the otherdirection it supportsto saveobjectsto thedatabase.In thisprocess the objectis transformed
to oneor more tables.
Q.7. Write a sample hibernate configurationfile?Explainthe elementsofthe file
Ans: Configuration isthefile loaded into an hibernateapplication when working with hibernate,thisconfiguration file
contains 3 typesof information.
 Connection Properties
 HibernateProperties
 Mapping filename(s)
 <hibernate-configuration>:This is nextand parenttag for thehibernateconfiguration.Itis thebasetag,
containg all the hibernateconfiguration setting in its sub tags.
 <session-factory>: This is sub tag of <hibernate-configuration>thathold all the required propertiesto
communicatewiththe database,likedatabaseconnection setting url,usernate,password and etc.
 <property name = “---“>---</property>:This is the sub tag of <session-factory>,which describeall the
required propertiesin orderto communicatewith thedatabaselike connection propertiesfordatabase.
Q.8 ExplainFilterDispatcher and any two action componentsused by struts
Ans:  A Filter Dispatcheris used as the Controllerin Struts.
 Its namein packaged Structureisorg.apache.struts2.dispatcher.FilterDispatcher.
 Prior to using it in the application,it hasto be registered in theweb.xmlasbelow.
 At first theFilterDispatcher verifies therequest URIand determinesthe rightaction forit.
 The mappingsof URI’sand theaction classes are presentin the struts.xmlfilefound in theWEB-
INF/classesdirectory.
FilterDispatcherdoes the followingforeact actioninvocation.
1)Determineswhich action to invokefora requested URIby consulting theConfiguration manager
2) Interceptorsregistered forthe action areinvoked oneafter theother.
3) Then the action method is executed.
4) Then the Filter Dispatcherexecutesthe Result.
Optionally you can extend the ActionSupportclasswhich implementssix interfaces including Actioninterface.The
Action interface is as follows:
public interface Action {
public static final String SUCCESS = "success";
public static final String NONE = "none";
public static final String ERROR = "error";
public static final String INPUT = "input";
public static final String LOGIN = "login";
public String execute() throws Exception;
}
Q.9 Explainin briefMVC architecture with the helpof suitable diagram
Ans: Model-View-Controllerarchitectureis used for interactiveweb-applications.Thismodelminimizes
the coupling between businesslogicand data presentation to web user.This model dividesthe web based
application into three layers:
 Model:Model domain containsthebusinesslogicsand functionsthatmanipulatethe
businessdata.Itprovidesupdated information to view domain and also gives
responseto query.And thecontroller can accessthe functionality which is
encapsulated in themodel.
 View: Viewis responsibleforpresentation aspectof application according to themodel
dataand also responsibleto forward query responseto thecontroller.
 Controller:Controlleraccepts and interceptsuser requestsand controlsthebusiness
Objectsto fulfill these requests.An application hasonecontrollerfor related
functionality.Controllercan also be dependson thetype of clients.
Q.10 Write a short note on Interceptors instruts
Interceptorsallowforcrosscutting functionality to beimplemented separately fromthe action aswell as the
framework.You can achievethe following using interceptors:
 Providing preprocessing logicbeforetheaction is called.
 Providing postprocessinglogicafterthe action is called.
 Catching exceptionsso thatalternateprocessing can be performed.
 Many of the featuresprovided in the Struts2frameworkareimplemented using interceptors;examples
include exception handling,fileuploading,lifecyclecallbacksand validation etc.
Q.11 Explainthe differentrolesof Action in struts framework
 Actionsare the core of the Struts2framework,asthey arefor any MVC(ModelView Controller)
framework.Each URLis mapped to a specific action,which providesthe processing logicnecessary to
service the requestfromthe user.
 But the action also serves in two otherimportantcapacities.First, the action playsan importantrole in
the transferof datafromtherequestthrough to the view,whetherits a JSP orother typeof result.
Second,theaction must assistthe frameworkin determining which result should rendertheview that
will be returned in the responseto the request.
Q.12 What is value-stack?Whatare the differenttype of objectit can holdoff? Explaintheir accessing
strategies?WhatisOGNL ?
The valuestack is a set of several objects which keepsthe following objectsin the provided order:
SN Objects & Description
1
Temporary Objects
There are varioustemporary objectswhich arecreated during execution of a
page.Forexamplethe currentiteration valuefor a collection being looped
overin a JSPtag.
2
The Model Object
If you are using model objectsin yourstrutsapplication,thecurrentmodel
objectis placed beforetheaction on the valuestack
3
The ActionObject
This will be the currentaction objectwhich is being executed.
4
NamedObjects
These objectsinclude#application,#session,#request,#attr and #parameters
and refer to thecorresponding servletscopes
OGNL:
The Object-Graph Navigation Language (OGNL) is a powerful expression language that is used to reference and
manipulatedataon theValueStack.OGNLalso helps in data transferand typeconversion.
The OGNL is very similar to the JSP Expression Language. OGNL is based on the idea of having a root or default
object within the context. The properties of the default or root object can be referenced using the markup
notation,which is thepound symbol.
As mentioned earlier, OGNL is based on a context and Struts builds an ActionContext map for use with OGNL. The
ActionContextmap consistsof thefollowing:
 application - application scoped variables
 session- session scoped variables
 root / valuestack - all youraction variablesare stored here
 request - requestscoped variables
 parameters - requestparameters
 atributes- the attributesstored in page,request,session and application scope
It is important to understand that the Action object is always available in the value stack. So, therefore if your
Action objecthaspropertiesx and y there are readily availablefor you to use.
Ad

More Related Content

What's hot (20)

Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSF
SoftServe
 
Jsf
JsfJsf
Jsf
Shaharyar khan
 
Exploring Maven SVN GIT
Exploring Maven SVN GITExploring Maven SVN GIT
Exploring Maven SVN GIT
People Strategists
 
Lecture 10 - Java Server Faces (JSF)
Lecture 10 - Java Server Faces (JSF)Lecture 10 - Java Server Faces (JSF)
Lecture 10 - Java Server Faces (JSF)
Fahad Golra
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
Tuna Tore
 
Spring Web MVC
Spring Web MVCSpring Web MVC
Spring Web MVC
zeeshanhanif
 
Java Web Programming [7/9] : Struts2 Basics
Java Web Programming [7/9] : Struts2 BasicsJava Web Programming [7/9] : Struts2 Basics
Java Web Programming [7/9] : Struts2 Basics
IMC Institute
 
Overview of JEE Technology
Overview of JEE TechnologyOverview of JEE Technology
Overview of JEE Technology
People Strategists
 
Spring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topicsSpring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topics
Guy Nir
 
Java Web Programming [6/9] : MVC
Java Web Programming [6/9] : MVCJava Web Programming [6/9] : MVC
Java Web Programming [6/9] : MVC
IMC Institute
 
Jsf intro
Jsf introJsf intro
Jsf intro
vantinhkhuc
 
Building a Web-bridge for JADE agents
Building a Web-bridge for JADE agentsBuilding a Web-bridge for JADE agents
Building a Web-bridge for JADE agents
infopapers
 
Introduction to struts
Introduction to strutsIntroduction to struts
Introduction to struts
Mindfire Solutions
 
Spring MVC
Spring MVCSpring MVC
Spring MVC
Aaron Schram
 
Struts ppt 1
Struts ppt 1Struts ppt 1
Struts ppt 1
pavanteja86
 
Struts 1
Struts 1Struts 1
Struts 1
Lalit Garg
 
Java Web Programming [4/9] : JSP Basic
Java Web Programming [4/9] : JSP BasicJava Web Programming [4/9] : JSP Basic
Java Web Programming [4/9] : JSP Basic
IMC Institute
 
springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892
Tuna Tore
 
Introduction to EJB
Introduction to EJBIntroduction to EJB
Introduction to EJB
Return on Intelligence
 
Bea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guideBea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guide
Pankaj Singh
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSF
SoftServe
 
Lecture 10 - Java Server Faces (JSF)
Lecture 10 - Java Server Faces (JSF)Lecture 10 - Java Server Faces (JSF)
Lecture 10 - Java Server Faces (JSF)
Fahad Golra
 
Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5Java Spring MVC Framework with AngularJS by Google and HTML5
Java Spring MVC Framework with AngularJS by Google and HTML5
Tuna Tore
 
Java Web Programming [7/9] : Struts2 Basics
Java Web Programming [7/9] : Struts2 BasicsJava Web Programming [7/9] : Struts2 Basics
Java Web Programming [7/9] : Struts2 Basics
IMC Institute
 
Spring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topicsSpring 3.x - Spring MVC - Advanced topics
Spring 3.x - Spring MVC - Advanced topics
Guy Nir
 
Java Web Programming [6/9] : MVC
Java Web Programming [6/9] : MVCJava Web Programming [6/9] : MVC
Java Web Programming [6/9] : MVC
IMC Institute
 
Building a Web-bridge for JADE agents
Building a Web-bridge for JADE agentsBuilding a Web-bridge for JADE agents
Building a Web-bridge for JADE agents
infopapers
 
Java Web Programming [4/9] : JSP Basic
Java Web Programming [4/9] : JSP BasicJava Web Programming [4/9] : JSP Basic
Java Web Programming [4/9] : JSP Basic
IMC Institute
 
springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892springmvc-150923124312-lva1-app6892
springmvc-150923124312-lva1-app6892
Tuna Tore
 
Bea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guideBea weblogic job_interview_preparation_guide
Bea weblogic job_interview_preparation_guide
Pankaj Singh
 

Viewers also liked (14)

Computer institute website(TYIT project)
Computer institute website(TYIT project)Computer institute website(TYIT project)
Computer institute website(TYIT project)
Lokesh Singrol
 
HP Software Testing project (Advanced)
HP Software Testing project (Advanced)HP Software Testing project (Advanced)
HP Software Testing project (Advanced)
Lokesh Singrol
 
Testing project (basic)
Testing project (basic)Testing project (basic)
Testing project (basic)
Lokesh Singrol
 
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
SlideShare
 
What Makes Great Infographics
What Makes Great InfographicsWhat Makes Great Infographics
What Makes Great Infographics
SlideShare
 
Masters of SlideShare
Masters of SlideShareMasters of SlideShare
Masters of SlideShare
Kapost
 
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to SlideshareSTOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
Empowered Presentations
 
You Suck At PowerPoint!
You Suck At PowerPoint!You Suck At PowerPoint!
You Suck At PowerPoint!
Jesse Desjardins - @jessedee
 
10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization
Oneupweb
 
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingHow To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
Content Marketing Institute
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare
SlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShare
SlideShare
 
How to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksHow to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & Tricks
SlideShare
 
Getting Started With SlideShare
Getting Started With SlideShareGetting Started With SlideShare
Getting Started With SlideShare
SlideShare
 
Computer institute website(TYIT project)
Computer institute website(TYIT project)Computer institute website(TYIT project)
Computer institute website(TYIT project)
Lokesh Singrol
 
HP Software Testing project (Advanced)
HP Software Testing project (Advanced)HP Software Testing project (Advanced)
HP Software Testing project (Advanced)
Lokesh Singrol
 
Testing project (basic)
Testing project (basic)Testing project (basic)
Testing project (basic)
Lokesh Singrol
 
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
SlideShare
 
What Makes Great Infographics
What Makes Great InfographicsWhat Makes Great Infographics
What Makes Great Infographics
SlideShare
 
Masters of SlideShare
Masters of SlideShareMasters of SlideShare
Masters of SlideShare
Kapost
 
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to SlideshareSTOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
Empowered Presentations
 
10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization
Oneupweb
 
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingHow To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
Content Marketing Institute
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare
SlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShare
SlideShare
 
How to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksHow to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & Tricks
SlideShare
 
Getting Started With SlideShare
Getting Started With SlideShareGetting Started With SlideShare
Getting Started With SlideShare
SlideShare
 
Ad

Similar to TY.BSc.IT Java QB U6 (20)

Hibernate3 q&a
Hibernate3 q&aHibernate3 q&a
Hibernate3 q&a
Faruk Molla
 
141060753008 3715301
141060753008 3715301141060753008 3715301
141060753008 3715301
ITM Universe - Vadodara
 
Java J2EE Interview Question Part 2
Java J2EE Interview Question Part 2Java J2EE Interview Question Part 2
Java J2EE Interview Question Part 2
Mindsmapped Consulting
 
Java J2EE Interview Questions Part 2
Java J2EE Interview Questions Part 2Java J2EE Interview Questions Part 2
Java J2EE Interview Questions Part 2
javatrainingonline
 
MVC
MVCMVC
MVC
akshin
 
Java hibernate orm implementation tool
Java hibernate   orm implementation toolJava hibernate   orm implementation tool
Java hibernate orm implementation tool
javaease
 
Hibernate Interview Questions and Answers
Hibernate Interview Questions and AnswersHibernate Interview Questions and Answers
Hibernate Interview Questions and Answers
AnuragMourya8
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts framework
s4al_com
 
Hibernate tutorial for beginners
Hibernate tutorial for beginnersHibernate tutorial for beginners
Hibernate tutorial for beginners
Rahul Jain
 
Free Hibernate Tutorial | VirtualNuggets
Free Hibernate Tutorial  | VirtualNuggetsFree Hibernate Tutorial  | VirtualNuggets
Free Hibernate Tutorial | VirtualNuggets
Virtual Nuggets
 
P20CSP105-AdvJavaProg.pptx
P20CSP105-AdvJavaProg.pptxP20CSP105-AdvJavaProg.pptx
P20CSP105-AdvJavaProg.pptx
DrTCVijayaraghavan
 
Hibernate Developer Reference
Hibernate Developer ReferenceHibernate Developer Reference
Hibernate Developer Reference
Muthuselvam RS
 
Spatial approximate string search Doc
Spatial approximate string search DocSpatial approximate string search Doc
Spatial approximate string search Doc
Sudha Hari Tech Solution Pvt ltd
 
Hibernate.pdf
Hibernate.pdfHibernate.pdf
Hibernate.pdf
SaadAnsari73
 
Spring 2
Spring 2Spring 2
Spring 2
Aruvi Thottlan
 
Introduction to Hibernate
Introduction to HibernateIntroduction to Hibernate
Introduction to Hibernate
Krishnakanth Goud
 
Hibernate interview questions
Hibernate interview questionsHibernate interview questions
Hibernate interview questions
venkata52
 
Hibernate in Action
Hibernate in ActionHibernate in Action
Hibernate in Action
Akshay Ballarpure
 
Hibernate
HibernateHibernate
Hibernate
Murali Pachiyappan
 
Struts N E W
Struts N E WStruts N E W
Struts N E W
patinijava
 
Java J2EE Interview Questions Part 2
Java J2EE Interview Questions Part 2Java J2EE Interview Questions Part 2
Java J2EE Interview Questions Part 2
javatrainingonline
 
Java hibernate orm implementation tool
Java hibernate   orm implementation toolJava hibernate   orm implementation tool
Java hibernate orm implementation tool
javaease
 
Hibernate Interview Questions and Answers
Hibernate Interview Questions and AnswersHibernate Interview Questions and Answers
Hibernate Interview Questions and Answers
AnuragMourya8
 
Introduction to ejb and struts framework
Introduction to ejb and struts frameworkIntroduction to ejb and struts framework
Introduction to ejb and struts framework
s4al_com
 
Hibernate tutorial for beginners
Hibernate tutorial for beginnersHibernate tutorial for beginners
Hibernate tutorial for beginners
Rahul Jain
 
Free Hibernate Tutorial | VirtualNuggets
Free Hibernate Tutorial  | VirtualNuggetsFree Hibernate Tutorial  | VirtualNuggets
Free Hibernate Tutorial | VirtualNuggets
Virtual Nuggets
 
Hibernate Developer Reference
Hibernate Developer ReferenceHibernate Developer Reference
Hibernate Developer Reference
Muthuselvam RS
 
Hibernate interview questions
Hibernate interview questionsHibernate interview questions
Hibernate interview questions
venkata52
 
Ad

More from Lokesh Singrol (13)

MCLS 45 Lab Manual
MCLS 45 Lab ManualMCLS 45 Lab Manual
MCLS 45 Lab Manual
Lokesh Singrol
 
MCSL 036 (Jan 2018)
MCSL 036 (Jan 2018)MCSL 036 (Jan 2018)
MCSL 036 (Jan 2018)
Lokesh Singrol
 
TY.BSc.IT Java QB U1
TY.BSc.IT Java QB U1TY.BSc.IT Java QB U1
TY.BSc.IT Java QB U1
Lokesh Singrol
 
TY.BSc.IT Java QB U2
TY.BSc.IT Java QB U2TY.BSc.IT Java QB U2
TY.BSc.IT Java QB U2
Lokesh Singrol
 
Project black book TYIT
Project black book TYITProject black book TYIT
Project black book TYIT
Lokesh Singrol
 
Internet of Things
Internet of ThingsInternet of Things
Internet of Things
Lokesh Singrol
 
Top Technology product failure
Top Technology product failureTop Technology product failure
Top Technology product failure
Lokesh Singrol
 
Computer institute Website(TYIT project)
Computer institute Website(TYIT project)Computer institute Website(TYIT project)
Computer institute Website(TYIT project)
Lokesh Singrol
 
Trees and graphs
Trees and graphsTrees and graphs
Trees and graphs
Lokesh Singrol
 
behavioral model (DFD & state diagram)
behavioral model (DFD & state diagram)behavioral model (DFD & state diagram)
behavioral model (DFD & state diagram)
Lokesh Singrol
 
Desktop system,clustered system,Handheld system
Desktop system,clustered system,Handheld systemDesktop system,clustered system,Handheld system
Desktop system,clustered system,Handheld system
Lokesh Singrol
 
Raster Scan display
Raster Scan displayRaster Scan display
Raster Scan display
Lokesh Singrol
 
Flash memory
Flash memoryFlash memory
Flash memory
Lokesh Singrol
 
Project black book TYIT
Project black book TYITProject black book TYIT
Project black book TYIT
Lokesh Singrol
 
Top Technology product failure
Top Technology product failureTop Technology product failure
Top Technology product failure
Lokesh Singrol
 
Computer institute Website(TYIT project)
Computer institute Website(TYIT project)Computer institute Website(TYIT project)
Computer institute Website(TYIT project)
Lokesh Singrol
 
behavioral model (DFD & state diagram)
behavioral model (DFD & state diagram)behavioral model (DFD & state diagram)
behavioral model (DFD & state diagram)
Lokesh Singrol
 
Desktop system,clustered system,Handheld system
Desktop system,clustered system,Handheld systemDesktop system,clustered system,Handheld system
Desktop system,clustered system,Handheld system
Lokesh Singrol
 

Recently uploaded (20)

Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-26-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-26-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-26-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-26-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
Unit 5: Dividend Decisions and its theories
Unit 5: Dividend Decisions and its theoriesUnit 5: Dividend Decisions and its theories
Unit 5: Dividend Decisions and its theories
bharath321164
 
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
 
Fundamentals of PR: Wk 4 - Strategic Communications
Fundamentals of PR: Wk 4 - Strategic CommunicationsFundamentals of PR: Wk 4 - Strategic Communications
Fundamentals of PR: Wk 4 - Strategic Communications
Jordan Williams
 
Envenomation---Clinical Toxicology. pptx
Envenomation---Clinical Toxicology. pptxEnvenomation---Clinical Toxicology. pptx
Envenomation---Clinical Toxicology. pptx
rekhapositivity
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
Unit 5: Dividend Decisions and its theories
Unit 5: Dividend Decisions and its theoriesUnit 5: Dividend Decisions and its theories
Unit 5: Dividend Decisions and its theories
bharath321164
 
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
 
Fundamentals of PR: Wk 4 - Strategic Communications
Fundamentals of PR: Wk 4 - Strategic CommunicationsFundamentals of PR: Wk 4 - Strategic Communications
Fundamentals of PR: Wk 4 - Strategic Communications
Jordan Williams
 
Envenomation---Clinical Toxicology. pptx
Envenomation---Clinical Toxicology. pptxEnvenomation---Clinical Toxicology. pptx
Envenomation---Clinical Toxicology. pptx
rekhapositivity
 

TY.BSc.IT Java QB U6

  • 1. QUESTION BANK UNIT –VI Q.1 Explainthe Hibernate Framework Ans:  Hibernateis an Object-relationalmapping (ORM)tool.Object-relationalmappingorORMis a programming method formapping theobjectsto the relational modelwhereentities/classesare mapped to tables,instancesaremapped to rowsand attributesof instancesaremapped to columnsof table.  A “virtual objectdatabase”iscreated thatcan be used fromwithin the programming language.  Hibernateis a persistenceframeworkwhich isused to persist data fromJava environmentto database. Persistenceis a processof storing the data to some permanentmediumand retrieving it backat any pointof time even afterthe application thathad created thedata ended.  The abovediagramshowsa comprehensivearchitectureof Hibernate.In orderto persistdatato a database,Hibernatecreatean instanceof entity class(Java classmapped with databasetable). This objectis called Transient objectasthey arenot yet associated with thesession or notyet persisted to a database.  To persist theobjectto database,theinstanceof SessionFactory interfaceiscreated.SessionFactory isa singleton instancewhich implements Factory design pattern.SessionFactory loadshibernate.cfg.xml file(Hibernateconfiguration file.Moredetails in following section) and with the help of TransactionFactory and ConnectionProviderimplementsallthe configuration settingson a database.  Each databaseconnection in Hibernateis created by creating an instanceof Session interface.Session representsa single connection with database.Session objectsarecreated fromSessionFactory object.  Hibernatealso providesbuilt-in Transaction APIswhich abstractsaway the application fromunderlying JDBC or JTA transaction.Each transaction representsa singleatomic unitof work.OneSession can span through multipletransactions. SessionFactory(org.hibernate.SessionFactory) A thread-safe,immutablecacheof compiled mappingsfora single database. A factory fororg.hibernate.Session instances.A client of org.hibernate.connection.ConnectionProvider.Optionally maintainsa second levelcache of datathatis reusable between transactions ata processor cluster level. Session(org.hibernate.Session) A single-threaded,short-lived objectrepresenting a conversationbetween the application and thepersistent store.Wrapsa JDBC java.sql.Connection. Factory fororg.hibernate.Transaction.Maintainsa firstlevel cacheof persistentthe application’spersistentobjectsand collections;thiscache is used when navigating theobject graph orlooking up objectsby identifier.
  • 2. Persistent objectsand collections Short-lived,singlethreaded objects containing persistentstateand businessfunction.Thesecan beordinary JavaBeans/POJOs.They areassociated with exactly oneorg.hibernate.Session.Oncetheorg.hibernate.Session is closed, they will bedetached and free to use in any application layer (forexample, directly as datatransfer objectsto and frompresentation). Transient anddetached objects andcollections Instancesof persistentclassesthatare notcurrently associated with a org.hibernate.Session.They may have been instantiated by the application and notyet persisted,orthey may havebeen instantiated by a closed org.hibernate.Session. Transaction(org.hibernate.Transaction) (Optional) A single-threaded,short-lived objectused by theapplication to specify atomicunits of work.It abstractstheapplication fromthe underlying JDBC,JTA or CORBA transaction.A org.hibernate. Session might span severalorg.hibernate.Transactionsin somecases.However,transaction demarcation,eitherusing the underlying APIororg.hibernate.Transaction,is neveroptional. ConnectionProvider(org.hibernate.connection.ConnectionProvider) (Optional) A factory for,and poolof,JDBCconnections.Itabstractsthe application fromunderlying javax.sql.DataSourceorjava.sql.DriverManager. Itisnotexposed to application,butit can be extended and/or implemented by the developer. TransactionFactory(org.hibernate.TransactionFactory) (Optional) A factory fororg.hibernate.Transaction instances.Itisnot exposed to theapplication, butit can be extended and/orimplemented by the developer. Q.2 Explainthe Struts Framework Ans: The StrutsFrameworkisa standard fordeveloping well-architected Web applications.Ithasthe following features:  Open source  Based on the Model-View-Controller(MVC) design paradigm,distinctly separating allthreelevels: o Model: application state o View: presentation of data (JSP,HTML) o Controller:routing of theapplication flow  ImplementstheJSPModel 2 Architecture  Storesapplication routing information and requestmappingin a single core file, struts-config.xml The StrutsFramework,itself,only fills in theView and Controllerlayers. The Modellayer is left to the developer. All incoming requestsareintercepted by the Strutsservlet controller.The StrutsConfiguration filestruts-
  • 3. config.xmlisused by the controllerto determine therouting of the flow.This flowsconsistsof an alternation between two transitions: From Viewto Action: A userclicks on a link orsubmitsa formon an HTML or JSPpage.The controller receives the request, looksup the mapping forthisrequest,and forwardsitto an action.The action in turn calls a Modellayer From Actionto View: (Businesslayer) service or function.Afterthecall to an underlying function orservicereturnsto the action class, the action forwardsto a resource in the View layer and a pageis displayed in a web browser. The diagrambelowdescribes the flowin more detail: 1. User clicks on a link in an HTML page. 2. Servlet controller receives therequest,looksup mapping information in struts-config.xml,and routesto an action. 3. Action makesa call to a Modellayer service. 4. Service makesa call to the Datalayer (database)and therequested data isreturned. 5. Service returnsto theaction. 6. Action forwardsto a View resource(JSPpage) 7. Servlet looksup the mapping fortherequested resourceand forwards to theappropriateJSP page. 8. JSP file is invoked and sentto the browserasHTML. 9. User is presented witha newHTML pagein a web browser. Q.3 Explainweb.xml and struts.xml files Ans: The interactions in MVCmodel between Model,View and Controllerflow are taken care by the struts configuration files.Thesefiles are web.xml,struts.xml,struts-config.xmland struts.properties. web.xml:  The web.xmlconfiguration fileis a J2EE configuration filethatdetermines how elementsof the HTTP requestare processed by the servlet container.  The web.xml web application descriptor file represents the core of the Java web application, so it is appropriatethatit is also partof the core of the Strutsframework.  In the web.xml file, Struts defines its FilterDispatcher, the Servlet Filter class that initializes the Struts frameworkand handlesallrequests.  This filter can contain initialization parameters that affect what, if any, additional configuration files are loaded and howtheframeworkshould behave.  The web.xmlfile needsto be created underthefolderWebContent/WEB-INF.  Configuring web.xmlfortheframeworkisa matterof adding a filter and filter-mapping.
  • 4. struts.xml  The struts.xml file contains the configuration information that you will be modifying as actions are developed.  This file can be used to override default settings for an application, for example struts.devMode = falseand other settingswhich are defined in property file.  This file can be created underthe folder WEB-INF/classes. Example: <struts> <constantname="struts.devMode"value="true"/> <packagename="helloworld"extends="struts-default"> <action name="hello"class="HelloWorldAction" method="execute"> <result name="success">/HelloWorld.jsp</result> </action> </package> </struts> Q.4 What is objectrelational mapping(ORM)?what are its advantages? Ans: 1. FacilitatesimplementingtheDomainModel pattern: This onereason supersedesall others.In short using this pattern meansthatyou modelentities based on real businessconceptsratherthan based on yourdatabasestructure.ORMtoolsprovidethisfunctionality through mapping between thelogical businessmodeland the physicalstoragemodel. 2. Huge reduction incode: ORM toolsprovidea hostof services thereby allowing developersto focuson the businesslogic of the application rather than repetitive CRUD(CreateRead UpdateDelete) logic. 3. Changesto the object model are made in one place:One you updateyourobjectdefinitions,theORM will automatically usethe updated structurefor retrievalsand updates.Thereare no SQL Update,Delete and Insertstatementsstrewn throughoutdifferentlayersof theapplication thatneed modification. 4. Rich query capability:ORMtoolsprovidean objectoriented query language.Thisallowsapplication developersto focuson the objectmodel and notto haveto be concerned with thedatabasestructureor SQL semantics.TheORM tool itself will translatethequery languageinto the appropriatesyntax forthe database. 5. Navigation:You can navigateobjectrelationshipstransparently.Related objectsareautomatically loaded asneeded.For exampleif you load a POand you wantto accessit's Customer,you can simply access PO. Customerand theORMwill take care of loading thedata for you without any efforton your part. 6. Data loadsare completelyconfigurableallowingyoutoloadthe data appropriatefor each scenario. For examplein onescenario you mightwantto load a list of POswithoutany of its child / related objects, while in other scenariosyou can specify to load a PO,with all its child Line Items,etc. 7. Concurrencysupport: Supportformultipleusers updating thesamedata simultaneously. 8. Cache management:Entities are cached in memory thereby reducing load on the database. 9. Transactionmanagementand Isolation:Allobjectchangesoccurscoped to a transaction.Theentire transaction can either be committed orrolled back. Multipletransactionscan be activein memory in the sametime, and each transactionschangesareisolated formon another. 10. Key Management: Identifiersand surrogatekeysareautomatically propogated and managed. Q.5 What is the importance of hibernate mapping file?Explainwith suitable example Ans:  Mapping fileis the heartof hibernateapplication.  Every ORMtool needsthis mapping,mappingisthe mechanismof placing an objectpropertiesinto column’sof a table.  Mapping can begiven to an ORMtool either in the formof an XMLor in theformof theannotations.  The mapping file contains mapping froma pojo classnameto a table nameand pojo classvariable namesto table column names.  While writing an hibernateapplication,wecan construct oneor more mapping files,mean a hibernate application can contain any numberof mapping files.
  • 5.  generally an objectcontains 3 properties like Identity (ObjectName) State(Objectvalues) Behavior(ObjectMethods) Example: <hibernate-mapping> <class name="Employee"table="EMPLOYEE"> <meta attribute="class-description">Thisclass containstheemployeedetail. </meta> <id name="id"type="int"column="id"> <generatorclass="native"/> </id> <propertyname="firstName"column="first_name" type="string"/> <propertyname="lastName"column="last_name" type="string"/> <propertyname="salary"column="salary"type="int"/> </class> </hibernate-mapping> Q.6 Explainthe working of Hibernate Ans: Hibernateis the ORMtool given to transferthedata between a java (object) application and a database (Relational) in theformof the objects. Hibernate is the open sourcelight weighttool given by GavinKing Hibernateprovidesa solution to map databasetablesto a class. It copiesone row of the databasedatato a class.In the otherdirection it supportsto saveobjectsto thedatabase.In thisprocess the objectis transformed to oneor more tables. Q.7. Write a sample hibernate configurationfile?Explainthe elementsofthe file
  • 6. Ans: Configuration isthefile loaded into an hibernateapplication when working with hibernate,thisconfiguration file contains 3 typesof information.  Connection Properties  HibernateProperties  Mapping filename(s)  <hibernate-configuration>:This is nextand parenttag for thehibernateconfiguration.Itis thebasetag, containg all the hibernateconfiguration setting in its sub tags.  <session-factory>: This is sub tag of <hibernate-configuration>thathold all the required propertiesto communicatewiththe database,likedatabaseconnection setting url,usernate,password and etc.  <property name = “---“>---</property>:This is the sub tag of <session-factory>,which describeall the required propertiesin orderto communicatewith thedatabaselike connection propertiesfordatabase. Q.8 ExplainFilterDispatcher and any two action componentsused by struts Ans:  A Filter Dispatcheris used as the Controllerin Struts.  Its namein packaged Structureisorg.apache.struts2.dispatcher.FilterDispatcher.  Prior to using it in the application,it hasto be registered in theweb.xmlasbelow.  At first theFilterDispatcher verifies therequest URIand determinesthe rightaction forit.  The mappingsof URI’sand theaction classes are presentin the struts.xmlfilefound in theWEB- INF/classesdirectory. FilterDispatcherdoes the followingforeact actioninvocation. 1)Determineswhich action to invokefora requested URIby consulting theConfiguration manager 2) Interceptorsregistered forthe action areinvoked oneafter theother. 3) Then the action method is executed. 4) Then the Filter Dispatcherexecutesthe Result. Optionally you can extend the ActionSupportclasswhich implementssix interfaces including Actioninterface.The Action interface is as follows: public interface Action {
  • 7. public static final String SUCCESS = "success"; public static final String NONE = "none"; public static final String ERROR = "error"; public static final String INPUT = "input"; public static final String LOGIN = "login"; public String execute() throws Exception; } Q.9 Explainin briefMVC architecture with the helpof suitable diagram Ans: Model-View-Controllerarchitectureis used for interactiveweb-applications.Thismodelminimizes the coupling between businesslogicand data presentation to web user.This model dividesthe web based application into three layers:  Model:Model domain containsthebusinesslogicsand functionsthatmanipulatethe businessdata.Itprovidesupdated information to view domain and also gives responseto query.And thecontroller can accessthe functionality which is encapsulated in themodel.  View: Viewis responsibleforpresentation aspectof application according to themodel dataand also responsibleto forward query responseto thecontroller.  Controller:Controlleraccepts and interceptsuser requestsand controlsthebusiness Objectsto fulfill these requests.An application hasonecontrollerfor related functionality.Controllercan also be dependson thetype of clients. Q.10 Write a short note on Interceptors instruts Interceptorsallowforcrosscutting functionality to beimplemented separately fromthe action aswell as the framework.You can achievethe following using interceptors:  Providing preprocessing logicbeforetheaction is called.  Providing postprocessinglogicafterthe action is called.  Catching exceptionsso thatalternateprocessing can be performed.  Many of the featuresprovided in the Struts2frameworkareimplemented using interceptors;examples
  • 8. include exception handling,fileuploading,lifecyclecallbacksand validation etc. Q.11 Explainthe differentrolesof Action in struts framework  Actionsare the core of the Struts2framework,asthey arefor any MVC(ModelView Controller) framework.Each URLis mapped to a specific action,which providesthe processing logicnecessary to service the requestfromthe user.  But the action also serves in two otherimportantcapacities.First, the action playsan importantrole in the transferof datafromtherequestthrough to the view,whetherits a JSP orother typeof result. Second,theaction must assistthe frameworkin determining which result should rendertheview that will be returned in the responseto the request. Q.12 What is value-stack?Whatare the differenttype of objectit can holdoff? Explaintheir accessing strategies?WhatisOGNL ? The valuestack is a set of several objects which keepsthe following objectsin the provided order: SN Objects & Description 1 Temporary Objects There are varioustemporary objectswhich arecreated during execution of a page.Forexamplethe currentiteration valuefor a collection being looped overin a JSPtag. 2 The Model Object If you are using model objectsin yourstrutsapplication,thecurrentmodel objectis placed beforetheaction on the valuestack 3 The ActionObject This will be the currentaction objectwhich is being executed. 4 NamedObjects These objectsinclude#application,#session,#request,#attr and #parameters and refer to thecorresponding servletscopes OGNL: The Object-Graph Navigation Language (OGNL) is a powerful expression language that is used to reference and manipulatedataon theValueStack.OGNLalso helps in data transferand typeconversion. The OGNL is very similar to the JSP Expression Language. OGNL is based on the idea of having a root or default object within the context. The properties of the default or root object can be referenced using the markup notation,which is thepound symbol. As mentioned earlier, OGNL is based on a context and Struts builds an ActionContext map for use with OGNL. The ActionContextmap consistsof thefollowing:  application - application scoped variables  session- session scoped variables  root / valuestack - all youraction variablesare stored here  request - requestscoped variables  parameters - requestparameters  atributes- the attributesstored in page,request,session and application scope It is important to understand that the Action object is always available in the value stack. So, therefore if your
  • 9. Action objecthaspropertiesx and y there are readily availablefor you to use.