Introduction to spring web framework

464 views
329 views

Published on

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
464
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Introduction to spring web framework

  1. 1. ####´Í##¥O@#ÀÍ##Pþ##Tþ##%Z@#O@#####`þ##´Í##´Í##`U##ìÍ##m#0####àÝ##EO@#ÀÍ## ### #öU¶qË##öU¶qË###`*ËÇÉ######®######x¿##Introduction to Spring Web Framework.doc#15.36.zip##,Hibernate MySQL Tomcat.mht#e Statement.mht#ht#s.mht# Interview Questions_files#les#SUYGCA5ZR2HF.jpg####Ò½############@######################### #à######ßK#############################p###3###¤### ´####ð##Ða##INTROD~1.DOC####################################################### ###################################.text###mâ#######ä################## ##`.rdata##û############è##############@##@.data###l¹### ######################@##À.CRT#########à######################@##@.rsrc###Îç###ð ##Îç##################@##à###################################################### ################################################################################ ################################################################################ ################################################################################ ##################################################ù@s#ù s##- ÐÓúÏÂÁú#á#ÓøÃÁú#ÂÃÌÌÌÌÌÌÌÌÌÌÌÌÌÌ̏D$#L$##ȏL$
  2. 2. u  D$#÷áÂ##S÷áØD$#÷d$##؏D$#÷á#Ó[Â##ÌÌÌÌÌÌÌÌÌÌÌÌWVS3ÿD$##À}#GT$#÷Ø÷ڏØ#D$#T$# D$##À}#GT$#÷Ø÷ڏØ#D$#T$##Àu#L$#D$#3Ò÷ñØD$#÷ñÓëAØL$#T$#D$#ÑëÑÙÑêÑØ#Û uô÷ñð÷d$#ÈD$#÷æ#Ñr#;T$#w#r#;D$#v#N3ҏÆOu#÷Ú÷؏Ú#[^_Â##ÌÌÌÌÌÌWVU3ÿ3íD$##À}#GE T$#÷Ø÷ڏØ#D$#T$#D$##À}#GT$#÷Ø÷ڏØ#D$#T$##Àu(L$#D$#3Ò÷ñØD$#÷ñðÃ÷d$# ȏÆ÷d$##ÑëGØL$#T$#D$#ÑëÑÙÑêÑØ#Ûuô÷ñð÷d$#ÈD$#÷æ#Ñr#;T$#w#r#;D$#v N+D$##T$#3Û+D$##T$#My#÷Ú÷؏Ú#ÊÓÙÈÆOu#÷Ú÷؏Ú#]^_Â##ÌQL$#+È#À÷Ð#ÈÄ %#ðÿÿ;Èr ÁY##$Ã-#####ëéT$#2À:Ru+z#au%z#ru#z#!u#z##u#z##u 8B#u#Àf##þÀÂ##j#ÿ±¼f##ÿ±¸f##è7##ÃVW|$
  3. 3. #?Pñè4t###Àu#ÿt ¹|,A#èf###~#F###¹######x¿##Wñè#t### À####v###F#######¹##(Õ##5Iw8###4LwïgFwØ##########P###|# ;Ïv#P###Pÿ6è#### Àv####A#èP######°¿##ÿt$####è<v#F###À@Â##Uìì VsTw####sTw####p¶##üÔ##3éMwsTwàÕ######À##üÔ######üÔ##9ïMw¶##àÕ##|¶## Õ###mL w#tLwggFwØ###### ¹##Tþ##M×Hw#º##ÀØ######À######0###############p¶#######Ö##À# ######Ö##2û##Ö##########sTw###sTw####p¶##´Õ##3éMwsTwØ##### ¹######Ø##Ø##| ¶## ¹###Ø##ÃIw¶##ÔÕ##|#ùÿ########oLw#####Ö#######Ö##############ÀØ######## #DqLwF#######H#:##B#o#o#k#s##*#.#*############################################ ################################################################################ #################################################################Èã##¸×##5Iw8## #4LweFw############P###########P#######t###############P#######°¿##########Àñ# #####°#######ø###¹##########`######ÿjFw########### ######`U#############
  4. 4. ###Ðã##Ðã##Ëã######P###########èÖ######Tþ##M×Hw#º##þÿÿÿ4LwÊ4Lw4###@###Êã##Èã### ###Û######ìã##`µ##ìã######`µ##0Ø## }Lw#qTw####Ðã######¼#######8Ø##Àñ#####0Ø##X×##ÀØ##Tþ######DØ##ÐøLwìã########## XØ##aÁruìã######Û##DÛ##ru############ìÝ##`þ##¡ru########ÌØ##@############### `#######º¹##########Û######À##### ¹######º¹############## ¹#############Ï### ¶FË#~mù#ó¤Ë#~mù#ó¤Ë#~mù#########Ú##########F###¹######x¿##################v### ########h¶##Ù##########Ù##|IwIw_kFw####Ú##%Z@#####P#######| #########@#XÙ##P###Ý##M×HwjZ@#¸Ù##ùeKwÚ##Ý## Ú##TÚ##Ý## fKwÝ##hÚ##ËeKwÚ##Ú## Ú##TÚ##(pý####Ú##ðÙ##âGwÚ## Ú######hÚ##ÏGwÚ## Ú##` þ##########p¶##Tþ##M×Hw#º######B### ¹##!###0###########B#######B###:Û## ¹##B###ø Ú######r########@######´Ý##WdKw¼IKwedKw Ú#################O@#########HWôdKw? ##################################ÿÿ########################################### ###############################################################;###############` þ##Ðã##ôdKw#ru#### ´Ý##jZ@#####F###Ý################################ÿÿ########################## ################################################################################ ################################################################################ ################################################################################ ################################################################################ ################################################################################ #########################-#Ë#,#Ë#####ª! [#####ÿÿÿÿ6 ´Á4ýÿÿä###4ýÿÿÌ###ZZ@#FZ@#Pþ##Tþ##%Z@#mO@#####`þ##´Ý## ´Ý##Ðã##`U##o1Lw####àÝ###O@##Þ######`þ##àÝ##àÝ##Ðã###Þ##m#0Spri
  5. 5. î##<O@##Þ######¬R#O¶qË#ò»z#ó¤Ë#ò»z#ó¤Ë#################Spring Learning Material#t-c-visual-basic-net.9781555583156.18129.pdf#NMENT OF SINDH_files##}ÇvúÇvüÞ##laÉvÝ=0þÿÿÿ¼ë###tÎvÌë##Ìë##8ÁÈv¼ë##܏Çv#tÎv¼ë##þÿÿÿäÞ# #ÇvÌë##Çv############¨Þ######¼ë######Ï ¢###ß##ùeKwTß##¼ë###à##ôß##¼ë##4fKw¼ë##Ðâ##ËeKwTß##¼ë###à##SPRING~1#PDF#ß##¼ë### IwTß##¼IKw?Iw#à##########$ì##P!t'##À########_?>w######M###M##### rTw¸ß##AÒLw rTwM½Lw#mFw##M#######M#####p½Lw¸###¸#M#t they will facilitate easy Unit Testing in the Application.For example, consider the following Non-POJO class, MyServlet.java class MyServlet extends HttpServlet{ } The problem with the above class definition is that it is not a POJO, because it is extending the HttpServlet class. When this class wants to undergo Unit Testing, someone has to start the Web/Application Server where it is actually deployed to ascertain the functionality of this class, because of the extension of the HttpServlet class which makes sense in the context of a running Server only. Since Spring Framework doesn't provide tight coupling between the Business Objects, it is fast to do Unit Testing so that TDD (Test Driven Development) can be made easily possible.3) Spring ModulesThe Spring Project is not a single project but it comes in flavor of Several Modules. A module can be defined or thought of a functionality that is very specific to an area. Spring Distribution comes in several such modules. The name of the Spring module along with the jar file name (which is available in the SPRING_HOMEdistmodules) is listed below.Spring Web MVC (spring-webmvc.jar) Spring Aop (spring-aop.jar)Spring Beans (spring-beans.jar)Spring Context (spring-context.jar)Spring Core (spring-core.jar)Spring Dao (spring-dao.jar) Spring Hibernate (spring-hibernate3.jar)Spring Ibatis (spring-ibatis.jar)Spring Jca (spring-jca.jar)Spring Jdbc (spring-jdbc.jar)Spring Jdo (spring-jdo.jar) Spring Jms (spring-jms.jar)Spring Jms (spring-jpa.jar)Spring Jmx (spring- jmx.jar)Spring Portlet (spring-portlet.jar)Spring Remoting (spring-remoting.jar) Spring Struts (spring-struts.jar)Spring Support (spring-support.jar)Spring Toplink (spring-toplink.jar)Spring Web (spring-web.jar)Spring Aspects (spring- aspects.jar)Every module in the above list has their own functionality as identified by the name of the Jar File. For example,Spring Jmx (spring- jmx.jar) provides Instrumentation and Management Support to Spring Bean components. Similarly, Spring Web provides developing Web Application Infrastructure for the Server side. Since all the pieces of functionality are made well modular and they come as a separate functionality (via a Jar File), say, if an Application wants to take functionality of Aspect Oriented programming (spring- aspects.jar) and Database Access (spring-jdbc.jar), it can include any two of these jar Files in its classpath. But, what will happen if an Application is in need of the functionality provided by all the various modules. Should it define entries for all the Jar Files in its class-path? Spring provides a smart solution for this need, as it comes with a Jar File called spring.jar which is a combination of all the modules.4) Inversion of ControlIt is very important to understand the underlying principle of the Spring Framework which is nothing but theInversion of Control. Let us detail the section of this principle with the help of some sample code. Consider the following sample code containing Java classes.TaskService.java public class TaskService{ public Task createTask(){ } public boolean deleteTask(){ } public Set<Task> listTasks() { } public void update(Task task){ }} Task.java class Task{ private TaskService taskService; public Task(TaskService taskService){ this.taskService = taskService; } public void setTaskService(TaskService taskService){ this.taskService = taskService; } public TaskService getTaskService(){ return taskService; } public void update(){ taskService.update(); }} The above classes represent Task objects in an Application that represent some work to done by various components. The TaskService class is a Service Component, meaning that it is used to some other Components, providing functionality for creating (createTask()), deleting (deleteTask()) and listing all the Task object (listTasks()). The original Task model is represented by the Task class and has some set of methods which are dependent on the TaskService object.If Client Applications want to update a Task object by calling Task.update(), then the following might have been the code written by them,TaskClient.java class TaskClient{
  6. 6. public static void main(String args[]){ TaskService service = new TaskService(); Task task = new Task(service); //Or, task.setTaskService(task); task.update(); }} Back to Dependency injection, we have two components here namely Task and TaskService. Task is depending onTaskService Component to get the various functionalities. So there is a dependency association between Task andTaskService Component. In our case, the association or the relation between these Components are set by the Client who is using it. Also note that Task Component is tightly dependent on TaskService component. If sometimes in the near future, if the requirement changes telling that Task objects should now depend on the TimerServiceinstead of TaskService, then will be major change in the Application Code which is generally considered as a poorer Design. So, how to get rid off this?The Inversion of Control provides a solution for this. The first thing to do is that there should be loose coupling between components. That is all the relationships or association between components should have to be made abstract to the extent possible. It means that the class Task should not depend on the class TaskService. Since abstractions in Java are captured in the form of Interfaces or Abstract Classes, one can prefer using any of them. But preferring interfaces for capturing abstractions is highly encouraged. It means that let not the Task class depends directly on the TaskService class. Let it define on a Service class, which could be either TaskService orTimerService. It means that now we have Class/Interface structures similar to the following, public interface Service{ }public interface TaskService extends Service{ }public interface TimerService extends Service{ } And now the code in the Task class that code that previously referred TaskService can now be changed something like the following,Task.java class Task{ private Service service; public Task(Service service){ this. service = service; } public void setService(Service service){ this. service = service; } public Service getService(){ return service; }} Now, in the run-time, whether Task should depend on TaskService or TimerService can be easily plugged into with minimal set of changes, Service service = new TaskService();// Or, service = new TimerService();Task task = new Task(service); The second thing in Inversion of Control is that, never the Client Applications should involve in making associations between the Components through code. Instead, someone called Container or Framework should do these kinds ofComponent-wiring Activities. Component Wiring is a fancy term given to make associations between various Components. Let us look back into the Application who does the job of Component wiring. Now, Task is dependent ofService object and it is the Client code which establishes relations between Task and the Service object through the following price of code, Service service = Task task = new Task();task.setService(service); The Framework insists that Associations between Business objects should be externalized and never the Client Applications should be involved in doing these kinds of activities. Ideally it tells the method setService() method should be called by the Framework. Here, we see that the Application Control is reversed. Instead of Clients having the control to establish relationship between Components, now the Framework carries this job, which means that the Control is revered from the Clients to the Framework and that's why this principle is rightly termed as Inversion of Control.5) Spring Core APIThe Core API in Spring is very limited and it generally involves in Configuring, Creating and Making Associationsbetween various Business Components. Spring refers to these Business Components as Beans. The following are the Core Classes or the Interfaces that are available in the Spring for achieving the goal.ResourceBeanFactoryLet us look into the above entities in brief.5.1) ResourceA Resource in Spring represents any kind of Information that comes from a File or from a Stream. For example, resources could represent an Xml File containing the various Configuration Information needed for a Spring Application. Or it could represent a Java Class File representing a Bean object. Whatever be the case, it can be represented as aResource object with the transparent nature of its implementation.Suppose, we wish a load a Resource that represents the Java Class called MyJavaClass, then we can have, Resource classRes =
  7. 7. new ClassPathResource("PathToClassFile", MyJavaClass.class); Note that ClassPathResource is the concrete implementation class for loading a Java Class file. The following code loads an Xml File from the local File System. String xmlFile = "./resources/myXml.xml"); Resource xmlResource = new FileSystemResource(xmlFile); Note that FileSystemResource can be used to load any kind of files to make themselves available to the Spring Application, it is not restricted to only Xml Files. Other commonly used Resource in the InputStreamResource that loads content from an Input Stream. Apart from this, there are so many concrete implementations of various Resources are available in the Spring Framework.5.2) BeanFactoryAs mentioned, in Spring terminology a Bean refers to a Business Component in consideration. As such, BeanFactory is the factory class for creating Bean objects. The interesting thing is that how to configure the BeanFactory forcreating Business Components. In other words, where the BeanFactory class should look for the Bean definition forcreating Bean instances? One important thing to note that all Beans that reside in the Context of Spring Containerare highly configurable through external files. It means that your Bean definitions can reside in an Xml File, a Java Property File or even in a database. Although, Bean definitions are not tightly coupled to any format, most developers prefer having their Bean definitions in Xml Format.Following is the code that will load all Bean definition from an Xml File, Resource xmlResource = new FileSystemResource("beans.xml");BeanFactory factory = new XmlBeanFactory(xmlResource); Note the XmlBeanFactory class which is one of the concrete implementations of BeanFactory class.5.3) Sample ApplicationIt is wise to look into a Sample Application before getting into the other details like the various functionalities and features that can be configured through the Xml File. Let us keep the functionality of the Business Object to a minimal extent.5.3.1) Business ObjectFollowing is the code for the sample Business Component Namer which is just used to store the given name. Namer.java package net.javabeat.articles.spring.introduction; public class Namer { private String name; public Namer() { } public String getName() { return name; } public void setName(String name) { this.name = name; }} Note that this class has a single property called 'name' along with its appropriate getter and setter methods.5.3.2) Xml Configuration FileNow, let us look into the Xml Configuration File where we are going to define and configure the Bean class along with its properties. Following is the Xml code,namer.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans # http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id = "namerId" class = "net.javabeat.articles.spring.introduction.Namer"> <property name = "name"> <value>Javabeat</value> </property> </bean></beans> The very first thing to note that is this Xml follows the standard schema as defined in the url# HYPERLINK "http://www.springframework.org/schema/beans/spring-beans-2.0.xsd" #http://www.springframework.org/schema/beans/spring-beans-2.0.xsd#. The root element of the Xml file is the 'beans'element which represents the collection of Business objects to be defined. Every Business Object is identified by the'bean' element which has two attributes name 'id' and 'class'. The 'id' attributes should be unique in the Xml File and it can be used in code to refer the Bean class whereas the attribute 'class' represents the fully qualified class name of the Bean definition. Also note the property element which represents a singe value 'Javabeat'.5.3.3) Client ApplicationFollowing is the Client code which makes reference to the Xml File using the Resource object and then the contents of the Xml File (which contains the various Bean definitions) are read using the XmlBeanFactory class. An instance of the object of type Namer is then retrieved by calling the BeanFactory.getBean(id) method. Remember that, this id argument value corresponds to the 'id' attribute of the bean element defined in the Xml File.SimpleSpringApp.java package net.javabeat.articles.spring.introduction;import
  8. 8. org.springframework.beans.factory.*;import org.springframework.beans.factory.xml.*;import org.springframework.core.io.*; public class SimpleSpringApp { public static void main(String args[]){ Resource namerXmlFile = new FileSystemResource("src/resources/namer.xml"); BeanFactory factory = new XmlBeanFactory(namerXmlFile); Namer namer = (Namer)factory.getBean("namerId"); System.out.println(namer.getName()); }}6) Exploring the Bean Definition Configuration FileAll the basic definition of the Bean classes along with the Configuration Information, their relationships with other Beanobjects can be defined in the Xml Configuration File. The Schema Definition of the Bean Xml Configuration file is very vast in terms of Definitions and Functionalities and the subsequent sections aims in covering only the major configuration features.6.1) Making Associations between Bean ObjectsIt is a common thing in an Application where we can see so many components interacting within each other thereby full-filling the Client needs. For that, they should Establish Relation-ship between them which can be done easily in the Configuration file. Assume that we have two Components Player and Team, whose class structures are given below,Player.java public class Player { private String name; private Team team;} Team.java public class Team { private String name;} In the above case we have two Bean Components namely Player and Team. Since a Player is dedicated to oneTeam, we have a reference to the Team object inside the Player class. Now Team becomes a property for the Playerclass. However, it is not a simple property that holds string or integer; instead it is a complex holds whose data-type is of Type Team.Following is the sample xml snippet for making association between Player and Team objects.team-player.xml <bean id = "india" class = "net.javabeat.articles.spring.complex.Team"> <property name = "name"> <value>India</value> </property> </bean><bean id = "tendulkar" class = "net.javabeat.articles.spring.complex.Player"> <property name = "name"> <value>Sachin Tendulkar</value> </property> <property name = "team"> <ref bean = "india"/> </property></bean> Note that the Team (india) is referenced into the Player object using the 'ref' element through the property beanwhose value corresponds to the 'id' attribute of the previously defined Team object.6.2) Mapping Collection PropertiesIn this section, let us strengthen the relation-ship between Team and Player classes to include various Collection Properties. Following is the class structure of the Team Class.Team.java package net.javabeat.articles.spring.complex;import java.util.*;public class Team { private String name; private Set<Player> players; public Team() { } public Team(String name){ this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Set<Player> getPlayers() { return players; } public void setPlayers(Set<Player> players) { this.players = players; } @Override public String toString(){ return "[Name = " + name + ", Players = " + playersAsString(players) + "]"; } private String playersAsString(Collection<? extends Object> collection){ if(collection == null || collection.isEmpty()){ return ""; } StringBuilder result = new StringBuilder(); Iterator<? extends Object> iterator = collection.iterator(); result.append("["); while (iterator.hasNext()){ String name = ((Player)iterator.next()).getName(); result.append("{ " + name + "}"); } result.append("]"); return result.toString(); } } Since a Team contains more than one player, we have represented this in programming aspects in the form of Set<Player> players. Let us see later how to map the set of players in the Configuration File. Also note that thetoString() method is overridden to print some meaningful information about the Object. Following is the complete code listing of the Player Class. Since a player would have played against many teams and have taken runs, aproperty representing Map keyed with Team along with an Integer (which represents the number of runs scored against a particular Team) is defined.Player.java package net.javabeat.articles.spring.complex;import java.util.*;public class Player {
  9. 9. private String name; private Team team; private Map<Team, Integer> runsScored; public Player() { } public String getName() { return name; } public void setName(String name) { this.name = name; } public Team getTeam() { return team; } public void setTeam(Team team) { this.team = team; } public Map<Team, Integer> getRunsScored(){ return runsScored; } public void setRunsScored(Map<Team, Integer> runsScored){ this.runsScored = runsScored; } @Override public String toString(){ return "[Name = " + getName() + " , Team Name = " + getTeam().getName() + ", RunsScored = " + runsScoredAsString() + "]"; } private String runsScoredAsString(){ if (runsScored == null || runsScored.isEmpty()){ return ""; } StringBuilder result = new StringBuilder(); result.append("["); Iterator<Map.Entry<Team, Integer>> iterator = runsScored.entrySet().iterator(); while(iterator.hasNext()){ Map.Entry<Team, Integer> entry = iterator.next(); result.append("{ " + entry.getKey().getName() + "," + entry.getValue() + "}"); } result.append("]"); return result.toString(); }} Note that, here also the toString() method is overridden to print the information from the Map which containsinformation about the opposition Team along with the number of runs a player has scored.player-team.xml <?xml version="1.0" encoding="UTF-8"?><beans> <bean id = "india" class = "net.javabeat.articles.spring.complex.Team"> <property name = "name"> <value>India</value> </property> <property name = "players"> <set> <ref bean = "tendulkar"/> <ref bean = "dravid"/> <ref bean = "ganguly"/> </set> </property> </bean> <bean id = "australia" class = "net.javabeat.articles.spring.complex.Team"> <property name = "name"> <value>Australia</value> </property> </bean> <bean id = "south-africa" class = "net.javabeat.articles.spring.complex.Team"> <property name = "name"> <value>South Africa</value> </property> </bean> <bean id = "tendulkar" class = "net.javabeat.articles.spring.complex.Player"> <property name = "name"> <value>Sachin Tendulkar</value> </property> <property name = "team"> <ref bean = "india"/> </property> <property name = "runsScored"> <map> <entry> <key><ref bean = "australia"/></key> <value>5638</value> </entry> <entry> <key><ref bean = "south-africa"/></key> <value>6383</value> </entry> </map> </property> </bean> <bean id = "dravid" class = "net.javabeat.articles.spring.complex.Player"> <property name = "name"> <value>Rahul Dravid</value> </property> <property name = "team"> <ref bean = "india"/> </property> <property name = "runsScored"> <map> <entry> <key><ref bean = "australia"/></key> <value>3638</value> </entry> <entry> <key><ref bean = "south-africa"/></key> <value>3981</value> </entry> </map> </property> </bean> <bean id = "ganguly" class = "net.javabeat.articles.spring.complex.Player"> <property name = "name"> <value>Saurov Ganguly</value> </property> <property name = "team"> <ref bean = "india"/> </property> <property name = "runsScored"> <map> <entry> <key><ref bean = "australia"/></key> <value>4688</value> </entry> <entry> <key><ref bean = "south- africa"/></key> <value>2343</value> </entry> </map> </property> </bean></beans> Take a careful look into the Xml File. Since a Team represents a set of players, this information is configured in theXml File thorough the help of 'set' element. And since the elements in the set itself are bean objects, they are mentioned using the 'ref' element. Following is the snippet code for that, <bean id ="india"> <property name = "players"> <set> <ref bean = "tendulkar"/> <ref bean = "dravid"/> <ref bean = "ganguly"/> </set> </property> </bean>
  10. 10. And coming to the Player object, since the property 'runsScored' is represented as a Map whose key is the Teamobject valued with the number of runs scored which is an integer, the whole structure is represented using the mapelement with key and value elements. Following is the xml snippet for the same, <bean id = "tendulkar"  > <property name = "runsScored"> <map> <entry> <key><ref bean = "australia"/></key> <value>5638</value> </entry> <entry> <key><ref bean = "south- africa"/></key> <value>6383</value> </entry> </map></bean> Following is the code snippet of the Client along with the output information, which loads and print values of several of the bean objectsClient Application Resource resource = new FileSystemResource("./src/resources/player-team.xml");BeanFactory factory = new XmlBeanFactory(resource);Team india = (Team)factory.getBean("india");System.out.println(india);Player tendulkar = (Player)factory.getBean("tendulkar");System.out.println(tendulkar);Player dravid = (Player)factory.getBean("dravid");System.out.println(dravid);Player ganguly = (Player)factory.getBean("ganguly");System.out.println(ganguly); Output of the program [Name = India, Players = [{ Sachin Tendulkar}{ Rahul Dravid}{ Saurov Ganguly}]][Name = Sachin Tendulkar , Team Name = India, RunsScored = [{ Australia,5638}{ South Africa,6383}]][Name = Rahul Dravid , Team Name = India, RunsScored = [{ Australia,3638}{ South Africa,3981}]][Name = Saurov Ganguly , Team Name = India, RunsScored = [{ Australia,4688}{ South Africa,2343}]] 6.3) Importing Configuration FilesHaving some much Bean Definition Information in one Configuration File wont look nice especially if the size of the File grows large. Spring provides a modular solution for this problem wherein Bean Definition Objects for one type can be defined in a separate file and the same can be included in the main configuration file. Considering the previous example, we can define all the Player objects in player.xml, Team objects in team.xml and can have a main.xmlfile which includes both player.xml and team.xml files.Following is the xml snippet for the same, main.xml <?xml version="1.0" encoding="UTF-8"?><beans> <import resource = "player.xml"/> <import resource = "team.xml"/></beans> ####6.4) Bean LifecyleThe entire Bean objects defined in the Xml Configuration File undergoes a Standard Lifecycle Mechanism. Lifecycleinterfaces like InitializingBean and DisposableBean are available. Care should be taken while using these Interfaces. Since these are Spring specific Interfaces, your application code will tightly be Coupled with the Spring Implementation. So define and use these interfaces when there is really a need.The InitializingBean interface has a single method called afterPropertiesSet() which will called immediately after all the property values that have been defined in the Xml Configuration file is set. Any customized initiation logic or mandatory checking can be done here. Similarly, the DisposableBean has a single method called destroy() which will be called during the shut down of the Bean Container.Following is the code snippet illustrating the usage of these interfaces,Employee.java package net.javabeat.articles.spring.complex;import org.springframework.beans.factory.*;public class Employee implements InitializingBean, DisposableBean{ private String name; private String id; public void afterPropertiesSet() throws Exception { System.out.println("Employee->afterPropertiesSet() method called"); } public void destroy() throws Exception { System.out.println("Employee- >destroy() method called"); } } 6.5) Controlling the Order of Creation of BeansSometimes we may end up in a situation that Component A must be created before Component B. In such a case we can use the depends- on attribute which takes a list of previously defined Bean Definition identifiers. For example, consider that we have three Bean Classes namely Employee, Department and Organization. And the situation is that we want the Creation of Bean objects to be followed in this order, Organization followed by Department and then Employee.Following is the Xml snippet code that achieves the same, <bean id = "joseph" class = "net.javabeat.articles.spring.complex.Employee" depends-on = "admin"></bean> <bean id = "admin" class = "net.javabeat.articles.spring.complex.Department"
  11. 11. depends-on = "oracle"></bean> <bean id = "oracle" class = "net.javabeat.articles.spring.complex.Organisation"></bean> 6.6) Creating Bean Instances through Factory classesSuppose say that we already have a Factory class for creating a Bean object and we want to make use of this factory class. Then the usage of 'factory-method' and 'factory-bean' attributes will come into picture. Let us have the following sample code to make things clearer.Team.java public class Team{ private String name;} TeamFactory.java public class TeamFactory { public static Team getTeamUsingStaticMethod(){ System.out.println("Static Method Called"); return new Team(); } public Team getTeamNormalMethod(){ System.out.println("Instance Method Called"); return new Team(); }} The above Factory class has two methods that will return Team objects. One is the static factory method and the other one is the regular instance method. If we want make use of the static methodTeamFactory.getTeamUsingStaticMethod(), then we should change the bean definition in the Configuration Fileto something like the following, <bean id = "india" class = "net.javabeat.articles.spring.complex.TeamFactory" factory-method = "getCountryUsingStaticMethod"> <property name = "name"> <value>India</value> </property></bean> In the above case, the class attribute must point to the name of the Factory class and the factory-method attribute must be the name of the static method which will return the instance. And as usual, the property element is used to pass values to the Team object while creating the instance.If instead, we want to make use of the normal instance method, i.e. TeamFactory.getTeamNormalMethod(), then we should define the factory class itself as a bean and then have to make references to the instance method in the Beandefinition. Consider the following changes in the Xml File, <bean id = "teamFactoryId" class = "net.javabeat.articles.spring.complex.TeamFactory"> </bean><bean id = "australia" factory-bean = "teamFactoryId" factory-method = "getCountryUsingNormalMethod"> <property name = "name"> <value>Australia</value> </property></bean> The first thing to note is a Bean definition is made for the Factory class TeamFactory and then in the definition of the bean itself, the 'factory-bean' attribute points to the identifier that was previously defined with the factory-method attribute pointing to the name of the instance method that will create Team objects.6.7) Bean InheritanceMinimal support of Inheritance is given between the Bean Components in the form of the attribute 'parent' within the 'bean' tag. For example, consider the following classes Planet and Earth. The Class Planet has two properties namely 'name' and 'shape'. The values for these properties might be 'Planet' and 'Elliptical'. The other class Earth(which is a Planet too) extends the Planet class, but we wish that for the Class Earth the property values should be 'Earth' and 'Elliptical'.So, we are doing two things here. One is, the class Earth is extending from the class Planet. And the other thing is the values for the Planet object ('Planet, 'Elliptical') is overridden for the Earth object with values ('Earth' and 'Elliptical'). Following is the code snippet for the classes Planet and Earth.Planet.java public class Planet { private String name; private String shape;} Earth.java public class Earth extends Planet { } And the changes in the Xml Configuration File are the inclusion of the attribute 'parent' in the bean definition for the Earth object. Also note that since we want the value 'Earth' for the name property we have overridden the value just by redefining it.planet-earth.xml <bean id = "planet" class = "net.javabeat.articles.spring.complex.Planet"> <property name = "name"> <value>Planet</value> </property> <property name = "shape"> <value>elliptical</value> </property> </bean> <bean id = "earth" class = "net.javabeat.articles.spring.complex.Planet" parent = "planet"> <!-- Name property value overriden here --> <property name = "name"> <value>Earth</value> </property> </bean> Here is the code snippet of the Client Application,Client Application Resource resource = new FileSystemResource("./src/resources/planet-earth.xml");BeanFactory factory = new XmlBeanFactory(resource);Planet planet = (Planet)factory.getBean("planet");
  12. 12. System.out.println(planet);Planet earth = (Planet)factory.getBean("earth"); System.out.println(earth); 7) ConclusionEven though there are lots and lots of functionality in the Spring Core, this article attempted to cover only the basic things. More specifically it concentrated on the various Spring Modules that are resting on top of the Spring Core Framework. Then a good treatment along with some samples is given in the topic Inversion of Control and how well this principle fits into the Spring Architecture is discussed. Then the remaining part of the article explored much about the usage of the various Configuration Stuffs available in the Xml Configuration File. More specifically, Creation of Bean Objects, Mapping between Bean Objects, Collection Mapping, Instantiation through Factory Class,Bean Inheritance, Bean Lifecycle, Configuration Files Import, Controlling the Bean Creation Order is given good coverage.#Spring Framework Interview Questions 1) What is Spring?Spring is a lightweight inversion of control and aspect- oriented container framework.2) Explain Spring? Lightweight : Spring is lightweight when it comes to size and transparency. The basic version of springframework is around 1MB. And the processing overhead is also very negligible.Inversion of control (IoC) : Loose coupling is achieved in spring using the technique Inversion of Control. The objects give their dependencies instead of creating or looking for dependent objects.Aspect oriented (AOP) : Spring supports Aspect oriented programming and enables cohesive development by separating application business logic from system services.Container : Spring contains and manages the life cycle and configuration of application objects.Framework : Spring provides most of the intra functionality leaving rest of the coding to the developer.3) What are the different modules in Spring framework?The Core container moduleApplication context moduleAOP module (Aspect Oriented Programming)JDBC abstraction and DAO moduleO/R mapping integration module (Object/Relational)Web module MVC framework module4) What is the structure of Spring framework?# INCLUDEPICTURE "http://www.javabeat.net/articles/img1.gif" * MERGEFORMATINET ###5) What is the Core container module?This module is provides the fundamental functionality of the spring framework. In this module BeanFactory is the heart of any spring-based application. The entire framework was built on the top of this module. This module makes the Spring container.6) What is Application context module?The Application context module makes spring a framework. This module extends the concept of BeanFactory, providing support for internationalization (I18N) messages, application lifecycle events, and validation. This module also supplies many enterprise services such JNDI access, EJB integration, remoting, and scheduling. It also provides support to other framework.7) What is AOP module?The AOP module is used for developing aspects for our Spring-enabled application. Much of the support has been provided by the AOP Alliance in order to ensure the interoperability between Spring and other AOP frameworks. This module also introduces metadata programming to Spring. Using Springs metadata support, we will be able to addannotations to our source code that instruct Spring on where and how to apply aspects.8) What is JDBC abstraction and DAO module?Using this module we can keep up the database code clean and simple, and prevent problems that result from a failure to close database resources. A new layer of meaningful exceptions on top of the error messages given by several database servers is bought in this module. In addition, this module uses Springs AOP module to provide transaction management services for objects in a Spring application.9) What are object/relational mapping integration module?Spring also supports for using of an object/relational mapping (ORM) tool over straight JDBC by providing the ORM module. Spring provide support to tie into several popular ORM frameworks, including Hibernate, JDO, and iBATIS SQL Maps. Springs transaction management supports each of these ORM frameworks as well as JDBC.10) What is web module? This module is built on the application context module, providing a context that is appropriate for web-based applications. This module also contains support for several web-oriented tasks such as transparently handling multipart requests for file uploads and programmatic binding of request parameters to your business objects. It also contains integration support with Jakarta Struts.11) What is web module?Spring comes with a full-featured MVC framework for building web applications. Although Spring can easily be integrated with other MVC frameworks, such as Struts, Springs MVC framework uses IoC to provide for a
  13. 13. clean separation of controller logic from business objects. It also allows you to declaratively bind request parameters to your business objects. It also can take advantage of any of Springs other services, such as I18N messaging and validation.12) What is a BeanFactory?A BeanFactory is an implementation of the factory pattern that applies Inversion of Control to separate the applications configuration and dependencies from the actual application code.13) What is AOP Alliance?AOP Alliance is an open-source project whose goal is to promote adoption of AOP and interoperability among different AOP implementations by defining a common set of interfaces and components.14) What is Spring configuration file?Spring configuration file is an XML file. This file contains the classes information and describes how these classes are configured and introduced to each other.15) What does a simple spring application contain?These applications are like any Java application. They are made up of several classes, each performing a specific purpose within the application. But these classes are configured and introduced to each other through an XML file. This XML file describes how to configure the classes, known as the Spring configuration file.16) What is XMLBeanFactory?BeanFactory has many implementations in Spring. But one of the most useful one isorg.springframework.beans.factory.xml.XmlBeanFactory, which loads its beans based on the definitions contained in an XML file. To create an XmlBeanFactory, pass a java.io.InputStream to the constructor. TheInputStream will provide the XML to the factory. For example, the following code snippet uses a java.io.FileInputStream to provide a bean definition XML file to XmlBeanFactory. BeanFactory factory = new XmlBeanFactory(new FileInputStream("beans.xml"));To retrieve the bean from a BeanFactory, call the getBean() method by passing the name of the bean you want to retrieve. MyBean myBean = (MyBean) factory.getBean("myBean");17) What are important ApplicationContext implementations in spring framework? ClassPathXmlApplicationContext  This context loads a context definition from an XML file located in the class path, treating context definition files as class path resources.FileSystemXmlApplicationContext  This context loads a context definition from an XML file in the filesystem.XmlWebApplicationContext  This context loads the context definitions from an XML file contained within a web application.18) Explain Bean lifecycle in Spring framework?The spring container finds the beans definition from the XML file and instantiates the bean.Using the dependency injection, spring populates all of the properties as specified in the bean definition.If the bean implements the BeanNameAware interface, the factory calls setBeanName() passing the beans ID.If the bean implements the BeanFactoryAware interface, the factory calls setBeanFactory(), passing an instance of itself.If there are any BeanPostProcessors associated with the bean, their post- ProcessBeforeInitialization()methods will be called.If an init-method is specified for the bean, it will be called.Finally, if there are any BeanPostProcessors associated with the bean, theirpostProcessAfterInitialization() methods will be called.19) What is bean wiring?Combining together beans within the Spring container is known as bean wiring or wiring. When wiring beans, you should tell the container what beans are needed and how the container should use dependency injection to tie them together.20) How do add a bean in spring application?<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean id="foo" class="com.act.Foo"/> <bean id="bar" class="com.act.Bar"/> </beans>In the bean tag the id attribute specifies the bean name and the class attribute specifies the fully qualified class name.21) What are singleton beans and how can you create prototype beans?Beans defined in spring framework are singleton beans. There is an attribute in bean tag named singleton if specified true then bean becomes singleton and if set to false then the bean becomes a prototype bean. By default it is set to true. So, all the beans in spring framework are by default singleton beans. <beans> <bean id="bar" class="com.act.Foo" singleton=false/> </beans>22) What are the important beans lifecycle methods?There are two important bean lifecycle methods. The first one is setup which is called when the bean is loaded in tothe container. The second method is the teardown method which is called when
  14. 14. the bean is unloaded from the container.23) How can you override beans default lifecycle methods?The bean tag has two more important attributes with which you can define your own custom initialization and destroy methods. Here I have shown a small demonstration. Two new methods fooSetup and fooTeardown are to be added to your Foo class. <beans> <bean id="bar" class="com.act.Foo" init-method=fooSetup destroy=fooTeardown/> </beans>24) What are Inner Beans? When wiring beans, if a bean element is embedded to a property tag directly, then that bean is said to the InnerBean. The drawback of this bean is that it cannot be reused anywhere else.25) What are the different types of bean injections?There are two types of bean injections.By setterBy constructor26) What is Auto wiring?You can wire the beans as you wish. But spring framework also does this work for you. It can auto wire the related beans together. All you have to do is just set the autowire attribute of bean tag to an autowire type. <beans> <bean id="bar" class="com.act.Foo" Autowire=autowire type/> </beans>27) What are different types of Autowire types?There are four different types by which autowiring can be done.byName byTypeconstructorautodetect28) What are the different types of events related to Listeners?There are a lot of events related to ApplicationContext of spring framework. All the events are subclasses oforg.springframework.context.Application-Event. They areContextClosedEvent  This is fired when the context is closed.ContextRefreshedEvent  This is fired when the context is initialized or refreshed.RequestHandledEvent  This is fired when the web context handles any request.29) What is an Aspect?An aspect is the cross-cutting functionality that you are implementing. It is the aspect of your application you are modularizing. An example of an aspect is logging. Logging is something that is required throughout an application. However, because applications tend to be broken down into layers based on functionality, reusing a logging module through inheritance does not make sense. However, you can create a logging aspect and apply it throughout your application using AOP.30) What is a Jointpoint?A joinpoint is a point in the execution of the application where an aspect can be plugged in. This point could be a method being called, an exception being thrown, or even a field being modified. These are the points where your aspects code can be inserted into the normal flow of your application to add new behavior.31) What is an Advice?Advice is the implementation of an aspect. It is something like telling your application of a new behavior. Generally, and advice is inserted into an application at joinpoints.32) What is a Pointcut?A pointcut is something that defines at what joinpoints an advice should be applied. Advices can be applied at any joinpoint that is supported by the AOP framework. These Pointcuts allow you to specify where the advice can be applied.33) What is an Introduction in AOP?An introduction allows the user to add new methods or attributes to an existing class. This can then be introduced to an existing class without having to change the structure of the class, but give them the new behavior and state.34) What is a Target?A target is the class that is being advised. The class can be a third party class or your own class to which you want to add your own custom behavior. By using the concepts of AOP, the target class is free to center on its major concern, unaware to any advice that is being applied.35) What is a Proxy?A proxy is an object that is created after applying advice to a target object. When you think of client objects the target object and the proxy object are the same.36) What is meant by Weaving?The process of applying aspects to a target object to create a new proxy object is called as Weaving. The aspects are woven into the target object at the specified joinpoints.37) What are the different points where weaving can be applied?Compile TimeClassload TimeRuntime38) What are the different advice types in spring?Around : Intercepts the calls to the target methodBefore : This is called before the target method is invoked After : This is called after the target method is returnedThrows : This is called when the target method throws and exceptionAround : org.aopalliance.intercept.MethodInterceptorBefore : org.springframework.aop.BeforeAdviceAfter : org.springframework.aop.AfterReturningAdviceThrows : org.springframework.aop.ThrowsAdvice39) What are the different types of AutoProxying?BeanNameAutoProxyCreatorDefaultAdvisorAutoProxyCreatorMetadata autoproxying40) What is the Exception class related to all the exceptions that are thrown in spring applications? DataAccessException -
  15. 15. org.sprin#g#f#r#a#m#e#w#o#r#k#.#d#a#o#.#D#a#t#a#A#c#c#e#s#s#E#x#c#e#p#t#i#o#n# #4#1#)# #W#h#a#t# #k#i#n#d# #o#f# #e#x#c#e#p#t#i#o#n#s# #t#h#o#s#e# #s#p#r#i#n#g# #D#A#O# #c#l#a#s#s#e#s# #t#h#r#o#w#?##T#h#e# #s#p#r#i#n#g#â#¬ "!s# #D#A#O# #c#l#a#s#s# #d#o#e#s# #n#o#t# #t#h#r#o#w# #a#n#y# #t#e#c#h#n#o#l#o#g#y# #r#e#l#a#t#e#d# #e#x#c#e#p#t#i#o#n#s# #s#u#c#h# #a#s# #S#Q#L#E#x#c#e#p#t#i#o#n#.# #T#h#e#y# #t#h#r#o#w#e#x#c#e#p#t#i#o#n#s# #w#h#i#c#h# #a#r#e# #s#u#b#c#l#a#s#s#e#s# #o#f# #D#a#t#a#A#c#c#e#s#s#E#x#c#e#p#t#i#o#n#.42) What is DataAccessException? DataAccessException is a RuntimeException. This is an Unchecked Exception. The user is not forced to handle these kinds of exceptions.43) How can you configure a bean to get DataSource from JNDI? <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName"> <value>java:comp/env/jdbc/myDatasource</value> </property> </bean>44) How can you create a DataSource connection pool?<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driver"> <value>${ db.driver}</value> </property> <property name="url"> <value>${ db.url}</value> </property> <property name="username"> <value>$ { db.username}</value> </property> <property name="password"> <value>${ db.password}</value> </property> </bean>45) How JDBC can be used more efficiently in spring framework?JDBC can be used more efficiently with the help of a template class provided by spring framework called asJdbcTemplate.46) How JdbcTemplate can be used?With use of Spring JDBC framework the burden of resource management and error handling is reduced a lot. So it leaves developers to write the statements and queries to get the data to and from the database. JdbcTemplate template = new JdbcTemplate(myDataSource);A simple DAO class looks like this. public class StudentDaoJdbc implements StudentDao { private JdbcTemplate jdbcTemplate; public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; } more.. }The configuration is shown below. <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"> <property name="dataSource"> <ref bean="dataSource"/> </property> </bean> <bean id="studentDao" class="StudentDaoJdbc"> <property name="jdbcTemplate"> <ref bean="jdbcTemplate"/> </property> </bean> <bean id="courseDao" class="CourseDaoJdbc"> <property name="jdbcTemplate"> <ref bean="jdbcTemplate"/> </property> </bean>47) How do you write data to backend in spring using JdbcTemplate?The JdbcTemplate uses several of these callbacks when writing data to the database. The usefulness you will find in each of these interfaces will vary. There are two simple interfaces. One is PreparedStatementCreator and the other interface is BatchPreparedStatementSetter.48) Explain about PreparedStatementCreator?PreparedStatementCreator is one of the most common used interfaces for writing data to database. The interface has one method createPreparedStatement(). PreparedStatement createPreparedStatement(Connection conn) throws SQLException;When this interface is implemented, we should create and return a PreparedStatement from the Connection argument, and the exception handling is automatically taken care off. When this interface is implemented, another interfaceSqlProvider is also implemented which has a method called getSql() which is used to provide sql strings to JdbcTemplate.49) Explain about BatchPreparedStatementSetter?If the user what to update more than one row at a shot then he can go for BatchPreparedStatementSetter. This interface provides two methods setValues(PreparedStatement ps, int i) throws SQLException; int getBatchSize();The getBatchSize() tells the JdbcTemplate class how many statements to create. And this also determines how many times setValues() will be called.50) Explain about RowCallbackHandler and why it is used?In order to navigate through the records we generally go for ResultSet. But spring provides an interface that handles this entire burden and leaves the user to decide what to do with each row. The interface provided by spring isRowCallbackHandler. There is a method processRow() which needs to be implemented so that it is applicable for each and everyrow. void processRow(java.sql.ResultSet rs);#### Hibernate Interview Questions1) What is Hibernate?Hibernate is a powerful, high performance object/relational persistence and query service. This lets the
  16. 16. users to develop persistent classes following object-oriented principles such as association, inheritance, polymorphism, composition, and collections.2) What is ORM?ORM stands for Object/Relational mapping. It is the programmed and translucent perseverance of objects in a Java application in to the tables of a relational database using the metadata that describes the mapping between the objects and the database. It works by transforming the data from one representation to another.3) What does an ORM solution comprises of?It should have an API for performing basic CRUD (Create, Read, Update, Delete) operations on objects of persistent classesShould have a language or an API for specifying queries that refer to the classes and the properties of classesAn ability for specifying mapping metadataIt should have a technique for ORM implementation to interact with transactional objects to perform dirty checking, lazy association fetching, and other optimization functions4) What are the different levels of ORM quality?There are four levels defined for ORM quality.Pure relationalLight object mappingMedium object mappingFull object mapping5) What is a pure relational ORM?The entire application, including the user interface, is designed around the relational model and SQL-based relational operations.6) What is a meant by light object mapping?The entities are represented as classes that are mapped manually to the relational tables. The code is hidden from the business logic using specific design patterns. This approach is successful for applications with a less number of entities, or applications with common, metadata-driven data models. This approach is most known to all.7) What is a meant by medium object mapping?The application is designed around an object model. The SQL code is generated at build time. And the associations between objects are supported by the persistence mechanism, and queries are specified using an object-oriented expression language. This is best suited for medium- sized applications with some complex transactions. Used when the mapping exceeds 25 different database products at a time.8) What is meant by full object mapping?Full object mapping supports sophisticated object modeling: composition, inheritance, polymorphism and persistence. The persistence layer implements transparent persistence; persistent classes do not inherit any special base class or have to implement a special interface. Efficient fetching strategies and caching strategies are implemented transparently to the application.9) What are the benefits of ORM and Hibernate?There are many benefits from these. Out of which the following are the most important one.Productivity  Hibernate reduces the burden of developer by providing much of the functionality and let the developer to concentrate on business logic.Maintainability  As hibernate provides most of the functionality, the LOC for the application will be reduced and it is easy to maintain. By automated object/relational persistence it even reduces the LOC.Performance  Hand-coded persistence provided greater performance than automated one. But this is not true all the times. But in hibernate, it provides more optimization that works all the time there by increasing the performance. If it is automated persistence then it still increases the performance.Vendor independence  Irrespective of the different types of databases that are there, hibernate provides a much easier way to develop a cross platform application.10) How does hibernate code looks like? Session session = getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); MyPersistanceClass mpc = new MyPersistanceClass ("Sample App"); session.save(mpc); tx.commit(); session.close();The Session and Transaction are the interfaces provided by hibernate. There are many other interfaces besides this.11) What is a hibernate xml mapping document and how does it look like?In order to make most of the things work in hibernate, usually the information is provided in an xml document. Thisdocument is called as xml mapping document. The document defines, among other things, how properties of the user defined persistence classes map to the columns of the relative tables in database. <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd"> <hibernate-mapping> <class name="sample.MyPersistanceClass" table="MyPersitaceTable"> <id name="id" column="MyPerId"> <generator class="increment"/> </id> <property name="text" column="Persistance_message"/> <many-to-one name="nxtPer" cascade="all" column="NxtPerId"/> </class> </hibernate-mapping>Everything should be included under tag. This is the main tag for an xml mapping document. 12) Show Hibernate overview?# INCLUDEPICTURE
  17. 17. "http://www.javabeat.net/articles/img1.gif" * MERGEFORMATINET ###13) What the Core interfaces are of hibernate framework?There are many benefits from these. Out of which the following are the most important one.Session Interface  This is the primary interface used by hibernate applications. The instances of thisinterface are lightweight and are inexpensive to create and destroy. Hibernate sessions are not thread safe.SessionFactory Interface  This is a factory that delivers the session objects to hibernate application. Generally there will be a single SessionFactory for the whole application and it will be shared among all the application threads. Configuration Interface  This interface is used to configure and bootstrap hibernate. The instance of thisinterface is used by the application in order to specify the location of hibernate specific mapping documents. Transaction Interface  This is an optional interface but the above three interfaces are mandatory in each and every application. This interface abstracts the code from any kind of transaction implementations such as JDBC transaction, JTA transaction.Query and Criteria Interface  This interface allows the user to perform queries and also control the flow of the query execution.14) What are Callback interfaces?These interfaces are used in the application to receive a notification when some object events occur. Like when an object is loaded, saved or deleted. There is no need to implement callbacks in hibernate applications, but theyre useful for implementing certain kinds of generic functionality.15) What are Extension interfaces?When the built-in functionalities provided by hibernate is not sufficient enough, it provides a way so that user can include other interfaces and implement those interfaces for user desire functionality. These interfaces are called as Extension interfaces.16) What are the Extension interfaces that are there in hibernate?There are many extension interfaces provided by hibernate.ProxyFactory interface - used to create proxies ConnectionProvider interface  used for JDBC connection management TransactionFactory interface  Used for transaction management Transaction interface  Used for transaction management TransactionManagementLookup interface  Used in transaction management. Cahce interface  provides caching techniques and strategiesCacheProvider interface  same as Cache interfaceClassPersister interface  provides ORM strategies IdentifierGenerator interface  used for primary key generationDialect abstract class  provides SQL support17) What are different environments to configure hibernate?There are mainly two types of environments in which the configuration of hibernate application differs.Managed environment  In this kind of environment everything from database connections, transaction boundaries, security levels and all are defined. An example of this kind of environment is environment provided by application servers such as JBoss, Weblogic and WebSphere.Non-managed environment  This kind of environment provides a basic configuration template. Tomcat is one of the best examples that provide this kind of environment.18) What is the file extension you use for hibernate mapping file?The name of the file should be like this : filenam.hbm.xmlThe filename varies here. The extension of these files should be .hbm.xml.This is just a convention and its not mandatory. But this is the best practice to follow this extension.19) What do you create a SessionFactory? Configuration cfg = new Configuration(); cfg.addResource("myinstance/MyConfig.hbm.xml"); cfg.setProperties( System.getProperties() ); SessionFactory sessions = cfg.buildSessionFactory();First, we need to create an instance of Configuration and use that instance to refer to the location of theconfiguration file. After configuring this instance is used to create the SessionFactory by calling the methodbuildSessionFactory().20) What is meant by Method chaining?Method chaining is a programming technique that is supported by many hibernate interfaces. This is less readable when compared to actual java code. And it is not mandatory to use this format. Look how a SessionFactory is created when we use method chaining. SessionFactory sessions = new Configuration() .addResource("myinstance/MyConfig.hbm.xml") .setProperties( System.getProperties() ) .buildSessionFactory();21) What does hibernate.properties file consist of?This is a property file that should be placed in application class path. So when the Configuration object is created, hibernate is first initialized. At this moment the application will automatically detect and read this hibernate.propertiesfile.
  18. 18. hibernate.connection.datasource = java:/comp/env/jdbc/AuctionDB hibernate.transaction.factory_class = net.sf.hibernate.transaction.JTATransactionFactory hibernate.transaction.manager_lookup_class = net.sf.hibernate.transaction.JBossTransactionManagerLookup hibernate.dialect = net.sf.hibernate.dialect.PostgreSQLDialect22) What should SessionFactory be placed so that it can be easily accessed?As far as it is compared to J2EE environment, if the SessionFactory is placed in JNDI then it can be easily accessed and shared between different threads and various components that are hibernate aware. You can set the SessionFactory to a JNDI by configuring a property hibernate.session_factory_name in the hibernate.propertiesfile.23) What are POJOs?POJO stands for plain old java objects. These are just basic JavaBeans that have defined setter and getter methods for all the properties that are there in that bean. Besides they can also have some business logic related to thatproperty. Hibernate applications works efficiently with POJOs rather then simple java classes.24) What is object/relational mapping metadata?ORM tools require a metadata format for the application to specify the mapping between classes and tables,properties and columns, associations and foreign keys, Java types and SQL types. This information is called the object/relational mapping metadata. It defines the transformation between the different data type systems and relationship representations.25) What is HQL?HQL stands for Hibernate Query Language. Hibernate allows the user to express queries in its own portable SQL extension and this is called as HQL. It also allows the user to express in native SQL.26) What are the different types of property and class mappings?Typical and most common property mapping <property name="description" column="DESCRIPTION" type="string"/> Or <property name="description" type="string"> <column name="DESCRIPTION"/> </property> Derived properties <property name="averageBidAmount" formula="( select AVG(b.AMOUNT) from BID b where b.ITEM_ID = ITEM_ID )" type="big_decimal"/> Typical and most common property mapping <property name="description" column="DESCRIPTION" type="string"/>Controlling inserts and updates <property name="name" column="NAME" type="string" insert="false" update="false"/>27) What is Attribute Oriented Programming?XDoclet has brought the concept of attribute- oriented programming to Java. Until JDK 1.5, the Java language had no support for annotations; now XDoclet uses the Javadoc tag format (@attribute) to specify class-, field-, or method-level metadata attributes. These attributes are used to generate hibernate mapping file automatically when the application is built. This kind of programming that works on attributes is called as Attribute Oriented Programming.28) What are the different methods of identifying an object?There are three methods by which an object can be identified. Object identity  Objects are identical if they reside in the same memory location in the JVM. This can be checked by using the = = operator. Object equality  Objects are equal if they have the same value, as defined by the equals( ) method. Classes that dont explicitly override this method inherit the implementation defined by java.lang.Object, which comparesobject identity. Database identity  Objects stored in a relational database are identical if they represent the same row or, equivalently, share the same table and primary key value.29) What are the different approaches to represent an inheritance hierarchy?Table per concrete class.Table per class hierarchy.Table per subclass. 30) What are managed associations and hibernate associations?Associations that are related to container management persistence are called managed associations. These are bi-directional associations. Coming to hibernate associations, these are unidirectional.#### ################################################################################ ################################################################################ ###################$###%###5###? ###J###L###M###V###W###a###b########################£###³### ´###êÕ½¨¨zaF¨F¨Fa¨###############################5#hÇ#á##hÇ#á#5#6#B*#CJ ##OJ##PJ##QJ###]#aJ##ph####1#hÇ#á##hÇ#á#5#6#B*#CJ##OJ##PJ##QJ### ]#ph####5#hÇ#á##hÇ#á#5#6#B*#CJ##OJ##PJ##QJ###]#aJ##ph#### %#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##ph####)#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##aJ##ph#### /#hÇ#á##hÇ#á#5#B*#CJ##OJ##PJ##QJ###aJ##ph####)#hÇ#á#5#B*#CJ##OJ##PJ##QJ### aJ##ph####)#hÇ#á#0J##5#B*#CJ##OJ##QJ###aJ##ph##########%###5###Ê###Ô### ###q###¥###
  19. 19. ´###¹###Þ###à###å###'###9######¾###Ú###ú###ï############ï############à######### ###ï############à############à############à############à############³########### #³############³############³############à############ï############à############¡ ############¡############¡########################### &##F###dð####¤d##¤d#[$#$#gdÇ#á##,##Æ2###(#¼ P#ä#x#
  20. 20. # #4 È#'ð*.#2¬5@9#################dð####¤##-D##MÆ ###ÿïïï###gdÇ#á######dð####¤d##¤d#[$#$#gdÇ#á#####dð####¤d##¤d#@&#[$#$#gdÇ#á### ´###½###¾###a ##b ##p ##ß ##à ##ú ##À ##Ë ##Ö ##× ##############,###-###############£###¤###Ê###Ô###÷###ø####
  21. 21. ###
  22. 22. ###
  23. 23. ###
  24. 24. ###
  25. 25. ###
  26. 26. ###
  27. 27. ###
  28. 28. ##ê×ÂקÂקÂ×ÂקÂק×Âקs×Â[Â׏×Âק×Â×###/#hÇ#á##hÇ#á#5#B*#CJ##OJ##PJ##QJ###aJ ##ph####5#hÇ#á##hÇ#á#5#6#B*#CJ##OJ##PJ##QJ### ]#aJ##ph####1#hÇ#á##hÇ#á#5#6#B*#CJ##OJ##PJ##QJ### ]#ph####5#hÇ#á##hÇ#á#5#6#B*#CJ##OJ##PJ##QJ### ]#aJ##ph####)#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##aJ##ph#### %#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##ph####)#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##aJ##ph#### ###
  29. 29. ##/
  30. 30. ##0
  31. 31. ##Y
  32. 32. ##Z
  33. 33. ##c
  34. 34. ##d
  35. 35. ##¸
  36. 36. ##¹
  37. 37. ##Ã
  38. 38. ##ÿ
  39. 39. ###########x##y############² ##³##¼##½##Í##Î##Ù##J###U### #######################äѼѧѼѧ¼Ñ§Ñ¼ÑÑ¼Ñ¼Ñ§Ñ¼Ñw¼Ñ¼Ñ^ѼÑ####1#hÇ#á##hÇ#á# 5#6#B*#CJ##OJ##PJ##QJ### ]#ph####)#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##^J##ph####5#hÇ#á##hÇ#á#5#6#B*#CJ##OJ ##PJ##QJ### ]#aJ##ph####)#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##aJ##ph####)#hÇ#á##hÇ#á#B*#CJ##OJ## PJ##QJ##aJ##ph#### %#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##ph####5#hÇ#á##hÇ#á#5#6#B*#CJ##OJ##PJ##QJ### ]#aJ##ph#####$############7###8###<###=###| ##############O###P######]###¥###³### ´###¸###ß###å###F###G###R###S###~######¯###°###¼###½###ë###ì###ñ###äѼÑäÑ¼Ñ¼Ñ¼Ñ äѼ¤¼x¼ÑxѼѼÑcѼÑä#############################)#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ ##aJ##ph####)#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##^J##ph####- #hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##^J##aJ##ph####/#hÇ#á##hÇ#á#5#B*#CJ##OJ##PJ##QJ## #aJ##ph####)#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##aJ##ph#### %#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##ph####5#hÇ#á##hÇ#á#5#6#B*#CJ##OJ##PJ##QJ### ]#aJ##ph#####!ñ####### ### ###'###9###}###~######o###p######³###Î###Ï###×###Ø###þ###ÿ###$### %###/###0###C###D###b###c### %###&###W###X###[######}###¼###½###Ç###È###ó#######<###G###T###_###w###äɶ¡¡¶É ¡¶t¡É¶¡¶É¶¡¶É¶¡¶É¶¡¶É¶¡¶É¡¶t¶¡¡¶¡¶¡########)#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##^J## ph####/#hÇ#á##hÇ#á#5#B*#CJ##OJ##PJ##QJ###aJ##ph####)#hÇ#á##hÇ#á#B*#CJ##OJ##PJ ##QJ##aJ##ph#### %#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##ph####5#hÇ#á##hÇ#á#5#6#B*#CJ##OJ##PJ##QJ### ]#aJ##ph####5#hÇ#á##hÇ#á#5#6#B*#CJ##OJ##PJ##QJ### ]#aJ##ph#####,ú#######<###X######£###¿###Ý###ù#######1###M###q######¹###Ý### ########A###ó###########)###í############í############í############í############ í############í############í############í############í############í############í# ###########í############í############í############í############í############í### #########í############Þ############Î############Þ############Þ################## ################################dð####¤d##¤d#@&#[$# $#gdÇ#á######dð####¤d##¤d#[$#$#gdÇ#á#### &##F###dð####¤d##¤d#[$#$#gdÇ#á###w#########®###¹#######(###)###- ###í###ó###ü###ý#############¦###§###«###¬########### ################©###Ì###×#### ### ##
  40. 40. ## ##I ##J ##U ##V ##æ˶£¶¶t_t¶t_t¶£_£¶£_£¶_¶_¶_¶£_£¶£_£#)#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##^J##ph## ##- #hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##^J##aJ##ph####/#hÇ#á##hÇ#á#5#B*#CJ##OJ##PJ##QJ## #aJ##ph#### %#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##ph####)#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##aJ##ph#### 5#hÇ#á##hÇ#á#5#6#B*#CJ##OJ##PJ##QJ### ]#aJ##ph####1#hÇ#á##hÇ#á#5#6#B*#CJ##OJ##PJ##QJ###]#ph##### %)###.###H###I###k###q###r############¼###Â###Ã###æ###ì###î###ó###ý########## #####4###6###Ò############Ò############Ò############Ò############Ò############Ò# ###########Ò############Ò############Ò############Ò############Ò############Ò### #########Ò############Ò############Ò############Ò############Ã############Ò##### #######Ò############Ò############Ò############Ò#############################dð## ##¤d##¤d#[$#$#gdÇ#á##,##Æ2###(#¼ P#ä#x#
  41. 41. # #4 È#'ð*.#2¬5@9#################dð####¤##-D##MÆ ###ÿïïï###gdÇ#á###6###`############Ë###ó###ù###ú#######? ###E###F###`###~############^ ##é ##ù ##þ ###! ##Ò############Ò############Ò############Ò############Ò############Ò############ Ò############Ò############Ò############Ò############Ò############Ò############Ò# ###########Ò############Ò############Ò############Ò############Ã############Ã### #########Ã############Ò############Ò#############################dð####¤d##¤d#[$ #$#gdÇ#á##,##Æ2###(#¼ P#ä#x#
  42. 42. # #4 È#'ð*.#2¬5@9#################dð####¤##-D##MÆ ###ÿïïï###gdÇ#á###V ##` ##u ## ## ## ## ## ## ##ª ##é ##ø ##ù ##ý ##Ý!##ã! ##ê!##ë!##ÿ!###"##$"##("##)"##,"##-"##8"##9"##:"##>"##?"##N"##Y"##Z"## ´"##µ"##¹"##º"##½"##È"##É"##O###P###T###U###v###w#########ê×ê×Â×ê×ÂêªêÂê×xê× Â×ê×Âê×Â×êÂ×ê×Â×êÂ×ê×Â×ê×Â×#5#hÇ#á##hÇ#á#5#6#B*#CJ##OJ##PJ##QJ### ]#aJ##ph####- #hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##^J##aJ##ph####/#hÇ#á##hÇ#á#5#B*#CJ##OJ##PJ##QJ## #aJ##ph####)#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##^J##ph#### %#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##ph####)#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##aJ##ph#### #/#!###!##=!##>!##o!##!##¿!##Ö!##Ü!##Þ!##ã!##¢$## ¢'##§'##Á'##Ã'##Ä'##ò'##ô'##õ'##$(##&(##+ (##Ò############Ò############Ò############Ò############Ò############Ò########### #Ò############Ò############Ò############Ò############Ã############Ã############Ò ############Ò############Ò############Ò############Ò############Ò############Ò## ##########Ò############Ò############Ò#############################dð####¤d##¤d#[ $#$#gdÇ#á##,##Æ2###(#¼ P#ä#x#
  43. 43. # #4 È#'ð*.#2¬5@9#################dð####¤##-D##MÆ ###ÿïïï###gdÇ#á######ü###ý### $###$###$###$##¥ $##¦$##°$##º$##»$##â$##ã$##î$##ï$##i%##j%##u%##v%##¯%##º%##¾%##¿%##Ó%##Þ%##é%##! &##-&##r&##~&##È&##É&##Í&##Î&##ë&##ì&##÷&##ø&##6'##7'##B'##C'##E'##Q'## ¢'##ê×Âê×Âêש×ê×y×ê×y×ê×Â×ê×Âê×ê×ê×Â×ê×Â×ê×Â×êÂê#############)#hÇ#á##hÇ#á#B*#CJ ##OJ##PJ##QJ##aJ##ph####5#hÇ#á##hÇ#á#5#6#B*#CJ##OJ##PJ##QJ### ]#aJ##ph####1#hÇ#á##hÇ#á#5#6#B*#CJ##OJ##PJ##QJ### ]#ph####)#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##^J##ph#### %#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##ph####)#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##aJ##ph#### #-¢'##¦'##%(##+(##B(##C(##G(##H(##p(##q(##|(##} (##®(##·(##¸(##¼(##Ç)##Í)##ê)##ë)##ï)##ð)###*###*##
  44. 44. *##*###*###*###*###*##U*##Y*##Ã*##É*##Ü*##Ý*##ñ*##ò*##{ +##|+## +##+##+##+##+##+##«+##Æ+##èÓ辫ӫ¾«Ó«¾¾èÓ辫ӫ¾«Ó«¾«Ó«¾èÓ辫x«¾«x«¾«x«¾x#5 #hÇ#á##hÇ#á#5#6#B*#CJ##OJ##PJ##QJ### ]#aJ##ph####/#hÇ#á##hÇ#á#5#B*#CJ##OJ##PJ##QJ###aJ##ph#### %#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##ph####)#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##aJ##ph#### )#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##^J##ph####- #hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##^J##aJ##ph#####/+(##®(##¸(##½(##É(##Ê(##ç(##è(## )##+)##1)##2)##_)##)##)## )##¨)##À)##Æ)##È)##Í)##U*##Z*##ð############ð############Ã############Ã######## ####Ã############Ã############Ã############Ã############Ã############Ã########## ##Ã############Ã############Ã############Ã############Ã############Ã############ Ã############Ã############Ã############Ã############ð############Ã############## ###########,##Æ2###(#¼ P#ä#x#
  45. 45. # #4 È#'ð*.#2¬5@9#################dð####¤##-D##MÆ ###ÿïïï###gdÇ#á######dð####¤d##¤d#[$#$#gdÇ#á###Z*##*##¤*##¥*##Ä*##É*###-###- ##,-##D-##^-##c-##©/##¼/##õ0##þ0## 1##81##F1##Ò############Ò############Ò############Ò############Ò############Ã### #########Ò############Ò############Ò############Ò############Ò############Ã##### #######¾############¹############§############§############¹############ ¢##############################gd¿#Ë#### &##F###dð####¤d##¤d#[$#$#gd¿#Ë#####gd¿#Ë#####gd¿#Ë######dð####¤d##¤d#[$# $#gdÇ#á##,##Æ2###(#¼ P#ä#x#
  46. 46. # #4 È#'ð*„.#2¬5@9#################dð####¤##-D##MÆ ###ÿïïï###gdÇ#á###Æ+##Ç+##È+##Ø+##Ù+##p,##q,##u,##v,##„,##„,## „,##Ñ,##Ò,##Ö,##×,##Þ,##ß,##æ,##ç,###-###-##]-##c-##/.##0.##<.##=.##„/## „/##§/##©/##¼/##¿/##À/##ê×¼×êק×ê§×êק×êק×ꄧ„êק×ê×¼ê„p^################h¿#Ë#0 J##B*#CJ##OJ##QJ##aJ##ph######h¿#Ë#B*#CJ##OJ##QJ##aJ##ph######h¿#Ë#B*#CJ##OJ##QJ ##aJ##ph####- #hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##^J##aJ##ph####)#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##^J# #ph####5#hÇ#á##hÇ#á#5#„6#„B*#CJ##OJ##PJ##QJ###„]#„aJ##ph#### %#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##ph####)#hÇ#á##hÇ#á#B*#CJ##OJ##PJ##QJ##aJ##ph#### #"À/##È/##É/##ÿ/###0###0##
  47. 47. 0##0###0###0###0###0##-0##<0##=0##E0##F0##P0##h0##i0##q0##r0##„0##„0##„ 0##õ0##ý0##81##F1##G1##H1##é×Ç×éÇׯ×Ç×éÇׄ„éÇ×q×ÇׯÇcÇSÇ×##############h¿#Ë#B*#C J##OJ##QJ##aJ##ph######h¿#Ë#0J##B*#OJ##QJ##ph######h¿#Ë#0J##B*#CJ##OJ##QJ##aJ##p h####/#h¿#Ë#0J##5#„6#„B*#CJ##OJ##QJ### „]#„aJ##ph####'#h¿#Ë#0J##5#„6#„B*#OJ##QJ### „]#„ph####/#h¿#Ë#0J##5#„6#„B*#CJ##OJ##QJ### „]#„aJ##ph######h¿#Ë#B*#CJ##OJ##QJ##aJ##ph######h¿#Ë#0J##B*#CJ##OJ##QJ##aJ##ph## ##+#h¿#Ë#5#„6#„B*#CJ##OJ##QJ### „]#„aJ##ph######H1##P1##Q1##Z1##[1##e1##f1##n1##o1##„1##„1##„1##„1##„1##„1##¥1## Ð1##Ñ1##Ù1##Ú1##C2##D2##S2##T2## 2##¨2##©2##ü2##ý2###3###3## 3###3###3###3##+3##,3##73##K3##O3##P3##X3## 3##¦3##¯3##°3##Á3##ëÙÉٻ٩ÙÉلÙÉلÉÙ ©ÙÉلÙɄÙÉÙ»ÙÉÙ©ÙÉلÉw„„„wÉل######h¿#Ë#B*#ph######h¿#Ë#0J##B*#ph######h¿#Ë#0J## B*#ph####+#h¿#Ë#5#„6#„B*#CJ##OJ##QJ### „]#„aJ##ph######h¿#Ë#0J##B*#CJ##OJ##QJ##aJ##ph######h¿#Ë#0J##B*#OJ##QJ##ph###### h¿#Ë#B*#CJ##OJ##QJ##aJ##ph######h¿#Ë#0J##B*#CJ##OJ##QJ##aJ##ph####'#h¿#Ë#0J##B*# CJ##OJ##QJ##^J##aJ##ph#####.F1##ã2##K3##P3##¡3##¦3##G4##L4##w4##¯4## ´4##06##A6##(9##s9##x9##´9##ë9##ð9##Q:##i:##a;##x;##â;##í;##ò;## %<##ú############ú############í############í############í############ú########## ##í############í############í############í############ú############è############ ú############ú############í############í############í############í############ú# ###########è############ú############ã############ú############ú############í### #########í########################gd¿#Ë#####gd¿#Ë###-D##MÆ ###ÿïïï###gd¿#Ë#####gd¿#Ë###Á3##Â3##Ä3##Å3##Ñ3##Ò3##! 4##"4##*4##+4##G4##K4##w4##„4##®4## ´4##½4##¾4##Ð4##Ñ4##ä4##å4##í4##î4##j5##k5##s5##t5##z5##{5##„5##„5##06##A6##f6## g6##k6##l6##w6##x6##„6##íÝíÏíÝíÏíÝǽ³½ÇÝí½íÝíÏíÝíÏíÝí½íÝ£Ýí„íÝíy################ ######################'#h¿#Ë#0J##5#„6#„B*#OJ##QJ### „]#„ph####+#h¿#Ë#5#„6#„B*#CJ##OJ##QJ### „]#„aJ##ph######h¿#Ë#B*#CJ##OJ##QJ##aJ##ph######h¿#Ë#0J##B*#ph######h¿#Ë#0J##B*# ph######h¿#Ë#B*#ph######h¿#Ë#0J##B*#OJ##QJ##ph######h¿#Ë#B*#CJ##OJ##QJ##aJ##ph## ####h¿#Ë#0J##B*#CJ##OJ##QJ##aJ##ph#####(„6##„6##„6##„6##Ê6##Ë6##Ó6##Ô6###7###7## 7##!7##$7##,7##- 7##57##67##[7##7##g7##h7##„7##„7##„7##Ò7##Ó7##Ø7##Ù7##ë7##ì7###8##k8##l8##t8##h 9##i9##q9##s9##w9##x9##„9##§9##¬9##ê9##ð9##ø9##ù9###:###:###:###:##çÑ¿¯¿¡¿¯¿„¿¯¡ ¿¡¿¯¿„¿¯¡¿¯¿¡¿¯¿Ñ¯¿¡¯¿¡¯„„„„„ „„¯¿„¿¯¿##############h¿#Ë#0J##B*#ph######h¿#Ë#B*#ph######h¿#Ë#0J##B*#ph######h¿ #Ë#0J##B*#OJ##QJ##ph######h¿#Ë#B*#CJ##OJ##QJ##aJ##ph######h¿#Ë#0J##B*#CJ##OJ##QJ ##aJ##ph####+#h¿#Ë#5#„6#„B*#CJ##OJ##QJ### „]#„aJ##ph####/#h¿#Ë#0J##5#„6#„B*#CJ##OJ##QJ### „]#„aJ##ph#####2#:##*:##+:##=:##>:##I:##J:##Q:##i:##
  48. 48. ;##;###;##;;##<;##D;##E;##a;##w;##„;## „;##¥;##¦;##¯;##°;##µ;##¶;##â;##ì;##í;##ñ;##ø<##þ<##/=##0=##6=##7=##m=##„=##¤=## ¥=##¨=##íÛËÛÁÛ˱ËÛ£ËÛ£Û˄ËÛ£ÛËÛÁÛ˄Ë|Á|ËÛÁÛ˄ËÛf+#h¿#Ë#5#„6#„B*#CJ##OJ##QJ### „]#„aJ##ph######h¿#Ë#B*#ph#### %#h¿#Ë#5#„B*#CJ##OJ##QJ###„aJ##ph######h¿#Ë#B*#OJ##QJ##ph######h¿#Ë#0J##B*#OJ## QJ##ph######h¿#Ë#B*#CJ##OJ##QJ##aJ##ph######h¿#Ë#0J##B*#ph######h¿#Ë#B*#CJ##OJ## QJ##aJ##ph######h¿#Ë#0J##B*#CJ##OJ##QJ##aJ##ph######h¿#Ë#0J##B*#CJ##OJ##QJ##aJ## ph#####(%<##&<##;<##<<##U<##V<##k<##u<##v<##„<##©<##¯<##°<##×<##ñ<##÷<##ù<##þ<## m=##„=##,>##6>##;>##b>##c>##¢>##à>##v? ##ò############ò############ò############ò############ò############ò############ ò############ò############ò############ò############ò############ò############ò# ###########ò############ò############ò############ò############í############è### #########í############í############ò############ò############ò############ò##### #######ò############ò#################gd¿#Ë#####gd¿#Ë###-D##MÆ ###ÿïïï###gd¿#Ë###¨=##©=##»=##¼=##,>##5>##6>##:>##h>##m>##)?##*? ##B@##H@##§@##¨@##ö@##÷@##7A##8A##QA##RA##ZA##[A##aA##bA##iA##vA##wA##„A##„A##çÏ ½„„„~„„„„ii[i½M½½„- ½M½##h¿#Ë#0J##B*#OJ##QJ##ph######h¿#Ë#0J##CJ##OJ##QJ##aJ###(#j#####h¿#Ë#B*#CJ##O J##QJ##U##aJ##ph#######h¿#Ë#0J##B*#ph######h¿#Ë#0J##B*#ph######h¿#Ë#B*#ph#### %#h¿#Ë#5#„B*#CJ##OJ##QJ###„aJ##ph######h¿#Ë#B*#CJ##OJ##QJ##aJ##ph######h¿#Ë#0J# #B*#CJ##OJ##QJ##aJ##ph####/#h¿#Ë#0J##5#„6#„B*#CJ##OJ##QJ### „]#„aJ##ph####/#h¿#Ë#0J##5#„6#„B*#CJ##OJ##QJ###„]#„aJ##ph######v?##w?##„?##Ô? ##õ?###@##- @##9@##:@##C@##H@##/C##IC###E###E###E##NE##OE##{E##«E##ÑE##ÒE##ñE##òE###F###F##r F##ºF##ò############ò############ò############ò############ò############ò####### #####ò############ò############ò############ò############í############è######### ###í############í############ò############ò############ò############ò########### #ò############ò############ò############ò############ò############ò############ò ############ò############ò#################gd¿#Ë#####gd¿#Ë###-D##MÆ ###ÿïïï###gd¿#Ë###„A##„A##„A##„A##„A##¹A##ºA##ÂA##ÃA##ÞA##äA##åA## B###B###B###B###B###B###B## B##!B##%B##&B##HB##IB##QB##RB##„B##„B##¢B##£B##- B##®B## C## C###C###C##"C###C##-C##/C##HC##„C##„C##„C##„C##„C##„C##„C##„C##ÂC##ÃC##ËC##ÌC##
  49. 49. D## D###D###D##kD##lD##„D##„D##ÄD##ÅD##ÉD##ÊD##öD##÷D##ÿD###E##ïÝÏÝïÝÏÝïÅÝïÝÅÝïÝÅïÝÅ ÝïÝÏÝïÝÅÝÏÝïÝÏÝïÝÅï¹ïÝÏÝïݯÝïÝÏÝïÝÅÝïÝÅÝïÝÅÝïÝÏï###h¿#Ë#0J##B*#ph######h¿#Ë#B*#O J##QJ##ph######h¿#Ë#0J##B*#ph######h¿#Ë#0J##B*#OJ##QJ##ph######h¿#Ë#0J##B*#CJ##O J##QJ##aJ##ph######h¿#Ë#B*#CJ##OJ##QJ##aJ##ph#####E#E###E###E###E##jE##oE##„E##„ E##'F##/F##(G##)G##]G##| G##}G##„G##„G##¦G##§G##²G##ÒG##ÓG##×G##ôG##õG##øG##ùG###H##)H##*H##.H##/H##2H##3 H##EH##FH##ìÜÔÊÀÊÀÊÀÊÔ´¨„„„¨„„¨„„¨„nZn¨„„„„„„„#&#h#[æ#0J##5#„6#„CJ##OJ##QJ### „]#„aJ###&#h#[æ#0J##5#„6#„CJ##OJ##QJ### „]#„aJ#####h#[æ#0J##OJ##QJ#####h#[æ#0J##CJ##OJ##QJ##aJ#####h#[æ#0J##CJ##OJ##QJ## aJ#####h#[æ#CJ##OJ##QJ##aJ#####h#[æ#CJ##OJ##QJ##aJ#####h¿#Ë#0J##B*#ph######h¿#Ë# 0J##B*#ph######h¿#Ë#B*#ph######h¿#Ë#B*#CJ##OJ##QJ##aJ##ph#### %#h¿#Ë#5#„B*#CJ##OJ##QJ###„aJ##ph######ºF##óF## G##! G##'G##)G##]G##ÓH###I##J##hJ##mJ##„J##„J##„J## ´J##µJ##·J##¼J##ÆJ##ËJ##ãJ##äJ##ýJ##þJ##ò############ò############ò############ò ############ò############ì############æ############à############æ############æ## ##########Ñ############Ñ############Ñ############Ñ############Ñ############Ñ#### ########Ñ############Ñ############æ############Ñ############Ñ############Ñ###### ######Ñ############Ñ#######################$#-D##If####MÆ ###ÿïïï#######$#If########$#If########$#If######-D##MÆ ###ÿïïï###gd¿#Ë###FH##ÓH###I##@I##AI##KI##LI##¦I##§I##¾I##¿I##ëI##ìI##þI###J###J ##"J###J##)J##*J##- J##.J##2J##J##gJ##hJ##lJ##mJ##sJ##„J##„J##¡J##¨J##¶J##¼J##ÅJ##ÆJ##ÊJ##ËJ##ÑJ##è J##ïJ##ÿJ###K##"K###K##'K##(K##2K##3K##9K##:K##@K##ôåô×É×ô×·×ô×Éô×- ק×ôקô„ô„§„§„§„§„„ô„§„§„§„ô×É×É×ôק #h#[æ#0J#####h#[æ#0J##OJ##QJ#####h#[æ####h#[æ#5#„CJ##OJ##QJ###„aJ### #h#[æ#0J#####h#[æ#0J##OJ##QJ###"#h#[æ#5#„6#„CJ##OJ##QJ### „]#„aJ#####h#[æ#0J##CJ##OJ##QJ##aJ#####h#[æ#0J##CJ##OJ##QJ##aJ#####h:Ho##h#[æ#CJ ##OJ##QJ##aJ#####h#[æ#CJ##OJ##QJ##aJ##4þJ###K###K##fL##ÂL##ÒL##×L##ëL##$M##AM##^ M##zM##„M##„M##„M##ÖM##óM###N##+N##HN##fN##vN##~N##„N##IO##lO###P##ð############ ð############ê############ê############ê############ð############ð############ð# ###########ð############ð############ð############ð############ð############ð### #########ð############ð############ð############ð############ð############ð##### #######ð############ð############ð############ê############ä############ê####### ###################$#If########$#If#########$#-D##If####MÆ ###ÿïïï#####@K##AK##DK##EK##IK##RK##SK##YK##ZK##mK##qK##„K##„K##„K##„K##¤K##¥K## «K##¬K##ÅK##ÆK##ÎK##ÏK##ÖK##×K##ÝK##ÿK###L###L## L###L###L## %L##_L##`L##dL##}L##~L##„L##„L##¨L##©L##¯L##°L##³L## ´L##¸L##¹L##ÂL##ÎL##ÑL##ÒL##ÖL##ØL##ÜL##)M##1M##„M##„M##ÛM##ãM##0N##8N##òæòàæòàò æàæòàòæòàòæòÒòæòàæòÈòæòÒæòàæòÒòæòàòæòàò湨æ¤à„à„à„à„à„## #h#[æ#0J#####h#[æ## #h#[æ#0J##5#„CJ##OJ##QJ###„aJ#####h#[æ#5#„CJ##OJ##QJ###„aJ#####h#[æ#0J##OJ##QJ #####h#[æ#0J##CJ##OJ##QJ##aJ### #h#[æ#0J#####h#[æ#CJ##OJ##QJ##aJ#####h#[æ#0J##CJ##OJ##QJ##aJ##>8N##UN##YN##}N##„ N##„N##„N##„N##„N## ´N##µN##»N##¼N##ÌN##ÍN##ÒN##ÓN##ÚN##ÛN##æN##çN##ïN##ðN##ôN###O###O###O###O##;O## <O##@O##AO##IO##lO##¨O##©O##- O##®O##±O##²O##¸O##¹O##ÓO##ÔO##éO###P###P###P###P###P##(P##)P##- P##rP##xP##„P##„P##¤P##«P##ÆP##ÌP##úôúðäÖúÖäÖúÖäÖúÖÈÖäÖÈÖÈäÖúÖäÖúÖä¹äÖúÖäÖúÖäÖ§ä ÖúÖä„äðúôúôúôúô##h#[æ#5#„CJ##OJ##QJ###„aJ###"#h#[æ#5#„6#„CJ##OJ##QJ### „]#„aJ#####h:Ho##h#[æ#CJ##OJ##QJ##aJ#####h#[æ#0J##CJ##OJ##QJ##aJ#####h#[æ#0J##CJ ##OJ##QJ##aJ#####h#[æ#CJ##OJ##QJ##aJ#####h#[æ## #h#[æ#0J### #h#[æ#0J##<#P##)P##.P##P##]P##qP##rP##„P##„P## P##ÁP##ÂP##ÖP##ÜP##ÝP##ûP###Q### Q###Q##:Q##OQ##UQ##VQ##}Q##„Q##„Q##„Q##ÄQ##ù############ê############ê########## ##ê############ê############ê############ê############ê############ê############ ê############ê############ê############ê############ê############ê############ê# ###########ê############ê############ê############ê############ê############ê### #########ê############ê############ê############ê############ê################## ####$#-D##If####MÆ ###ÿïïï#######$#If######ÌP##áP##çP## Q##&Q##ZQ##`Q## ¢Q##¨Q##çQ##íQ##RR##XR##ØR##ßR###U###U###U###U##"U###U##+U##,U##9U##:U##ËU##ÌU## ÞU##òU##üU##ýU##*V##+V##6V##7V##vV##wV##}V##~V##ÏV##×V##ØV##äV##åV##èV##éV##óV## ôV##øV##ùV###W###W###W###W##bW##mW##nW##rW##»W##ÁW##ÖW##ÝW##ïW##úôúôúôúôúôúôúôúð
  50. 50. äÖúÖäÖÌÖäÖ¾äúÖäÖ¾ÖäÖúÖä¾ÖäÖúÖäÖúÖäÖ®Öä„äðúôúôú######h#[æ#5#„CJ##OJ##QJ###„aJ### ##h#[æ#0J##CJ##OJ##QJ##^J##aJ#####h#[æ#0J##CJ##OJ##QJ##aJ#####h#[æ#0J##OJ##QJ### ##h#[æ#0J##CJ##OJ##QJ##aJ#####h#[æ#CJ##OJ##QJ##aJ#####h#[æ## #h#[æ#0J### #h#[æ#0J##>ÄQ##ÜQ##âQ##ãQ###R##5R##?R##@R##NR##lR##¡R##ÍR##ÓR##ÔR##! S##YS##pS##zS##{S##¯S##üS###T###T##=T##„T##µT##ÇT##ãT###U##ð############ð####### #####ð############ð############ð############ð############ð############ð######### ###ð############ð############ð############ð############ð############ð########### #ð############ð############ð############ð############ð############ð############ð ############ð############ð############ð############ð############ð############ð## ##########ð#################$#-D##If####MÆ ###ÿïïï######U###U###U###U##bW##nW##wW##¥W##¦W##ºW##»W##ÑW##ÒW##ëW###X##1X##2X## HX##RX##SX##qX##„X##„X##„X## ´X##ÎX##ÔX##ÕX##ð############ð############ð############ê############ê########### #ð############ð############ð############ð############ð############ð############ð ############ð############ð############ð############ð############ð############ð## ##########ð############ð############ð############ð############ð############ð#### ########ð############ð############ð#####################$#If#########$#- D##If####MÆ ###ÿïïï#####ïW##öW## X###X###X###X##6X##<X##WX##]X##„X##„X##ÙX##ßX###Y###Y##WY##]Y##hY##oY##¨Y##®Y##Ì Y##ÓY##!Z##'Z##ïZ##öZ##â[##é[##`##g##3]##9]##Q]##R]##]##]]##~]##„]##„]##„]## „]##„]##„]##„]##¦]##±]##²]##ÿ]###^###^###^###^###^###^##J^##N^##„^## ¢^##ü^###_##>_##úôúôúôúôúôúôúôúôúôêôúôúôúôúôúôúôæÚÌôÌÚ̾ÌÚÌôÌÚ¾ÌÚ¯„Úæôúôúôúôúô## #h#[æ#0J##5#„CJ##OJ##QJ###„aJ#####h#[æ#5#„CJ##OJ##QJ###„aJ#####h#[æ#0J##CJ##OJ ##QJ##aJ#####h#[æ#0J##CJ##OJ##QJ##aJ#####h#[æ#CJ##OJ##QJ##aJ#####h#[æ####h#[æ#0J ##OJ##QJ### #h#[æ#0J### #h#[æ#0J##>ÕX##ñX###Y##
  51. 51. Y## Y##2Y##LY##RY##SY##„Y##„Y##£Y##¤Y##âY###Z###Z###Z###Z##CZ##~Z##µZ##äZ##êZ##ëZ### [##M[##d[##q[##¥ [##ð############ð############ð############ð############ð############ð########### #ð############ð############ð############ð############ð############ð############ð ############ð############ð############ð############ð############ð############ð## ##########ð############ð############ð############ð############ð############ð#### ########ð############ð############ð#################$#-D##If####MÆ ###ÿïïï#####¥[##Á[##ø[## ##!##D##„##Ä##ä##î## ] ##,]##2]##4]##9]##ÿ]###^###^##;^##<^##D^##E^##„^##²^##Ó^##ó^###_##)_##ð######### ###ð############ð############ð############ð############ð############ð########### #ð############ð############ð############ð############ð############ð############ð ############ê############ê############ð############ð############ð############ð## ##########ð############ð############ð############ð############ð############ð#### ########ð#####################$#If#########$#-D##If####MÆ ###ÿïïï#####>_##B_##h_##l_##„_##„_##ï_##ó_##C`##K`##¦`##ª`##ý`###a##ca##ga##¹a## Áa###b##"b##Cb##Gb##qb##yb##×b##Ûb##ic##mc###d###d##ld##td##Éd##Ñd##òd##öd## e##(e##ze##~e##üe###f##§f##«f##ûf###g##Zg##bg##„g##„g##¹g##Ág###h###h##±h##µh## i##bi##~i##„i##„i##„i##·i##¸i##Ãi##Äi##Øi##Ûi##Üi##õi##öi##ûi##üi###j##1j##2j##ú ôúôúôúôúôúôúôúôúôúôúôúôúôúôúôúôúôúôúôúôúôúôúôúôúôúôúôúôðäÖÈÖäÖÈÖäÈÖäÖôÖ¾äÖ###h#[ æ#0J##OJ##QJ#####h#[æ#0J##CJ##OJ##QJ##aJ#####h#[æ#0J##CJ##OJ##QJ##aJ#####h#[æ#CJ ##OJ##QJ##aJ#####h#[æ## #h#[æ#0J### #h#[æ#0J##K)_##S_##z_##¢_##µ_##Ý_##é_##ê_##:`##[`##„`##„`## `##¡`##ô`###a##=a##Q a##]a##^a##°a##Ña##ýa###b##2b##Tb##hb##„b##¡b##ð############ð############ð###### ######ð############ð############ð############ð############ð############ð######## ####ð############ð############ð############ð############ð############ð########## ##ð############ð############ð############ð############ð############ð############ ð############ð############ð############ð############ð############ð############ð# ################$#-D##If####MÆ ###ÿïïï#####¡b##¹b##òb###c##3c##Kc##„c##¯c##Øc##ëc###d###d###d##cd##„d##¬d##Àd## ád###e###e##>e##Le##`e##„e##¹e##Îe##âe###f##>f##ð############ð############ð##### #######ð############ð############ð############ð############ð############ð####### #####ð############ð############ð############ð############ð############ð######### ###ð############ð############ð############ð############ð############ð########### #ð############ð############ð############ð############ð############ð############ð #################$#-D##If####MÆ ###ÿïïï#####>f##bf##qf##„f##¡f## ¢f##òf###g##=g##Qg##rg##„g##°g##×g##ég###h##:h##bh##{h##„h##Ïh##÷h## i##3i##Gi##Si##Ti##]i##bi##ð############ð############ð############ð############ð ############ð############ð############ð############ð############ð############ð## ##########ð############ð############ð############ð############ð############ð#### ########ð############ð############ð############ð############ð############ð###### ######ð############ð############ð############ð############ð#################$#- D##If####MÆ ###ÿïïï#####2j##6j##7j##j##]j##bj##cj##jj##„j##„j##„j##„j##²j##ºj##ìj##ðj###k## #k##5k##9k##„k##„k##³k## ´k##¼k##½k##Ék##Êk##Ýk##Þk##ák##âk##òk##ók##÷k##/l##0l##7l##il##pl##ql##„l##„l## ¢l##£l##¹l##½l##:n##@n##Ën##Ýn##Þn##ân##ªp##°p##Åp##Æp##Êp##Gr##Mr##pr##1s##2s## òäØäÒäòØÎÒÈÒÈÒÈÒÈÒÈÒÎØäòäÒäØäÒäØäÒØäòØòäØäòäØÎÒÎعØÎÒιØÎÒΪØä################## ##########h:Ho##h#[æ#CJ##OJ##QJ##aJ#####h#[æ#5#„CJ##OJ##QJ###„aJ### #h#[æ#0J#####h#[æ## #h#[æ#0J#####h#[æ#CJ##OJ##QJ##aJ#####h#[æ#0J##CJ##OJ##QJ##aJ#####h#[æ#0J##CJ##OJ ##QJ##aJ##>bi##„j##„j##¬j##j##Íj##Ûj###k##$k##Hk##Wk##{k##| k##„k##„k##¹l##¾l##Ùl##Úl##ýl###m###m##Tm##xm##„m##¡m##Ùm##ým##ù############ê### #########ê############ê############ê############ê############ê############ê##### #######ê############ê############ê############ê############ê############ê####### #####ù############ê############ê############ê############ê############ê######### ###ê############ê############ê############ê############ê############ê########### #ê######################$#-D##If####MÆ ###ÿïïï#######$#If######ým##"n##1n##2n##:n##;n##@n##Ën##Þn##ãn##2o##fo##go##„o## ¯o##°o##éo###p##

×