<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Murali's Weblog</title>
	<atom:link href="http://muralis.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://muralis.wordpress.com</link>
	<description></description>
	<pubDate>Thu, 24 Apr 2008 11:23:01 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
	<language>en</language>
			<item>
		<title>Portal</title>
		<link>http://muralis.wordpress.com/2008/04/24/portal/</link>
		<comments>http://muralis.wordpress.com/2008/04/24/portal/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 11:23:01 +0000</pubDate>
		<dc:creator>muralis</dc:creator>
		
		<category><![CDATA[Portal]]></category>

		<guid isPermaLink="false">http://muralis.wordpress.com/?p=107</guid>
		<description><![CDATA[Oracle Portal is a browser based, self-service, content publishing and development solution that allows end users and web developers to build data driven web sites. Portal gives content creators the tools needed to publish their own documents on the Web, by directly editing Web site from within their Web browsers. 

About Portals
Portals offer many advantages [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Oracle Portal is a browser based, self-service, content publishing and development solution that allows end users and web developers to build data driven web sites. Portal gives content creators the tools needed to publish their own documents on the Web, by directly editing Web site from within their Web browsers. </p>
<p><span id="more-107"></span></p>
<p>About Portals</p>
<p>Portals offer many advantages over other software applications. First, they provide a single point of entry for employees, partners, and customers. Second, portals can access Web services transparently from any device in virtually any location. Third, portals are highly flexible; they can exist in the form of B2E intra-nets, B2B extra-nets, or B2C inter-nets. Fourth, portals can be combined to form a portal network that can span a companys entire enterprise system, allowing for access both inside and outside the firewall. </p>
<p>Portals have many advantages, which is why they have become the de facto standard for Web application delivery. In fact, analysts have predicted that portals will become the next generation for the desktop environment. </p>
<p>Portals distinguish themselves from other software systems because they provide the ability to integrate disparate systems and leverage the functionality provided by those systems. As such, they are not mutually exclusive, and do not force you into an either-or decision vis-a-vis existing software systems. This point is of paramount importance, particularly when you consider the fact that Web services are destined to fuel the explosion of Web applications. Since portals can access any Web services, the conclusion is inescapable: portals provide a unique opportunity to leverage the functionality of nascent technologies as well as mature, well-established software systems. </p>
<p>Portal also lets you decentralized content management, while maintaining centralized control of your Internet infrastructure. </p>
<p>Oracle originally heavily touted the development capabilities of Portal, but it is cumbersome to develop anything other than the default generated forms and reports in Portal. Other products like Oracle Reports must be used along with Portal to generate much meaningful content. The management capabilities of Portal are strong however and are tied directly to the Oracle database. If you are already an Oracle shop Portal should be considered seriously as a portal framework. Given Oracle&#8217;s dominance in the marketplace the product will certainly be very prominent. </p>
<p>Oracle Portal is part of Oracle iAS (Intenet Application Server). Portal was build on top of Oracle PL/SQL. Consider Plumtree as a possible alternative. </p>
<p>Some Product Features: </p>
<p>Integrated web publishing services for content publishing and data publishing.<br />
An intuitive portal framework for organizing, structuring, and customizing corporate information.<br />
A central environment for portal deployment, management, monitoring, and maintenance.<br />
Available in other languages like French, German, Dutch, Spanish, Italian, French and Danish.<br />
Compatible with Oracle database (versions 7.3.4, 8.0.5, and 8i). </p>
<p>What is the difference between a portal and a portlet?</p>
<p>A portal is a web site that acts as hub, gateway or window to other information and services on the Web. Common Web portals are Yahoo, Netscape, etc. </p>
<p>A portlet is a specialised content area that occupies a small window of a portal page. Portlets from different sources (Portlet Providers) can be integrated into the portal framework. Example portlets: weather info, news flashes, stock tickers, etc. </p>
<p>What is Oracle-Portal-to-Go and what is it used for?</p>
<p>Oracle Portal-to-Go provides wireless services to mobile devices. It ships as part of the Oracle iAS (internet Application Server) Wireless Edition product. </p>
<p>Portal-to-Go dynamically translates existing Web content into XML, and then parses out that XML content into the format required by the mobile device; such as WML for WAP compliant devices, or &#8220;tiny&#8221; HTML for Palm devices. Additional output mark-up language capabilities include HDML, TTML, Pager-text and VoxML (for IVR systems). </p>
<p>How does one create a new Portlet?</p>
<p>Oracle provides a set of PL/SQL procedures to create new portlets.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/muralis.wordpress.com/107/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/muralis.wordpress.com/107/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/muralis.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/muralis.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/muralis.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/muralis.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/muralis.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/muralis.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/muralis.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/muralis.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/muralis.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/muralis.wordpress.com/107/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=muralis.wordpress.com&blog=2752651&post=107&subd=muralis&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://muralis.wordpress.com/2008/04/24/portal/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Edition 1 of Punc. &#38; Eng. Grammar</title>
		<link>http://muralis.wordpress.com/2008/04/08/edition-1-of-punc-eng-grammar/</link>
		<comments>http://muralis.wordpress.com/2008/04/08/edition-1-of-punc-eng-grammar/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 09:30:12 +0000</pubDate>
		<dc:creator>muralis</dc:creator>
		
		<category><![CDATA[Accent]]></category>

		<guid isPermaLink="false">http://muralis.wordpress.com/?p=106</guid>
		<description><![CDATA[Please ensure that the following is done wherever necessary:

1. always make sure that an empty space follows all the following punctuation marks: (only 1 empty space by pressing the space bar)
! % &#38; ) - = ] } &#8221; &#8216; : : &#62; . , ?
2. for hyphenated words, please ensure there is no space [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Please ensure that the following is done wherever necessary:</p>
<p><span id="more-106"></span></p>
<p>1. always make sure that an empty space follows all the following punctuation marks: (only 1 empty space by pressing the space bar)<br />
<em>! % &amp; ) - = ] } &#8221; &#8216; : : &gt; . , ?</em></p>
<p>2. for hyphenated words, please ensure there is no space before and after the hypen.<br />
<em>e.g. stop-gap, co-traveller, co-worker etc.</em></p>
<p>3. all short forms (abbreviations) should be followed by a full stop and a space.<br />
<em>eg.       abbrev.<br />
            vs.<br />
            etc.<br />
            Mr.<br />
            Ms.    </em>        </p>
<p>4. please do not abuse the existence of the apostrophe ( &#8216; ). an apostrophe is used only for possessive - when something belong to someone or something.<br />
<em>eg.<br />
David&#8217;s dog - this means the dog belonging to David<br />
video&#8217;s list - this means the list that belong to the video section</em></p>
<p>for Plurals and for words/names that end with &#8216;S&#8217; there need not be an apostrophe followed by an &#8216;S&#8217;, just apostrophe will do.<br />
<em>eg. Players&#8217; jerseys, Demarcus&#8217; shot - not Players&#8217;s jerseys or Demarcasus&#8217;s shot</em></p>
<p>5. please DO NOT use the apostrophe for plurals.<br />
<em>eg.<br />
The dogs went running in the park - this means many dogs ran in the park (it should not be &#8220;The dog&#8217;s went running&#8230;&#8221; - this is incorrect)<br />
The list of videos is not populated - this means that the list of videos (not video&#8217;s) is not populated. (it should not be &#8220;The list of video&#8217;s is not populated&#8221; - this is incorrect)</em></p>
<p>For some words like Sheep, data, information, news, furniture, the singular and plural are the same.</p>
<p>Check the words below to to find their plural.</p>
<p>Shot on Goal        Shots on Goal<br />
List                     Lists<br />
Survey                Surveys<br />
Axis                   Axes</p>
<p>6. Please use the articles (a, an and the) also properly.<br />
a will be used for all nouns/adjectives starting with a consonant. it should be a singular word.<br />
eg. a dog, a noisy cat - not an dog or an noisy cat</p>
<p>an will be used for nouns/adjectives starting with a vowel. it should be a singular word.<br />
eg. an ache, an ardent follower - not a ache or a ardent follower</p>
<p>the will be used for a definite word (either starting with a vowel or a consonant). it could be a singular or plural word.<br />
eg. the Earth, the skies etc.</p>
<p>exceptions:<br />
an will also be used wherever the word starts with a consonant, but is mute, giving place for the vowel (in the second letter) to be pronounced. it should be a singular word.<br />
eg. an honourable intention, an honest worker - not a honourable or a honest</p>
<p>a will be sued for some words which start with a vowel but are pronounced without the vowel&#8217;s phonetic sound but actual sound - don&#8217;t know if I made much sense here. it should be a singular word.<br />
eg. a university, a universe, a one rupee coin - not an university or an universe or an one rupee coin (if you notice the way &#8216;u&#8217; is pronounced here is different to the &#8216;u&#8217; in &#8216;umbrella&#8217;, &#8216;understanding&#8217; etc. and the way &#8216;o&#8217; is pronounced in &#8216;one&#8217; in comparison to &#8216;o&#8217; in &#8216;other&#8217;, &#8216;outsider&#8217; etc.)</p>
<p>7. Capital Letters have to be used at the beginning of all sentences. You know when a sentence begins when: 1. it is the forst sentence of a paragraph or 2) it will be preceeded by a full stop from the end of the sentence before it.</p>
<p>Captial Letters should also be used for Proper Nouns (names, places, titles etc.)<br />
eg. Anand, Chennai, Earth, Monday, December.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/muralis.wordpress.com/106/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/muralis.wordpress.com/106/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/muralis.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/muralis.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/muralis.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/muralis.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/muralis.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/muralis.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/muralis.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/muralis.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/muralis.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/muralis.wordpress.com/106/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=muralis.wordpress.com&blog=2752651&post=106&subd=muralis&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://muralis.wordpress.com/2008/04/08/edition-1-of-punc-eng-grammar/feed/</wfw:commentRss>
		</item>
		<item>
		<title>EMAIL Etiquettes-Tips</title>
		<link>http://muralis.wordpress.com/2008/04/04/email-etiquettes-tips/</link>
		<comments>http://muralis.wordpress.com/2008/04/04/email-etiquettes-tips/#comments</comments>
		<pubDate>Fri, 04 Apr 2008 10:30:15 +0000</pubDate>
		<dc:creator>muralis</dc:creator>
		
		<category><![CDATA[Accent]]></category>

		<guid isPermaLink="false">http://muralis.wordpress.com/2008/04/04/email-etiquettes-tips/</guid>
		<description><![CDATA[Here are some points that will definitely help.

1) The font of mail should be Verdana and font size should be 9.5 or 10.
2) The mail should have a Pyramid Structure i.e. it should contain:
* Situation: What&#8217;s the current situation is
* Action items: What you expect from the reader of the mail to-do
* Information: The information [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Here are some points that will definitely help.</p>
<p><span id="more-105"></span></p>
<p>1) The font of mail should be Verdana and font size should be 9.5 or 10.<br />
2) The mail should have a Pyramid Structure i.e. it should contain:<br />
* Situation: What&#8217;s the current situation is<br />
* Action items: What you expect from the reader of the mail to-do<br />
* Information: The information you want to give to the reader<br />
* Conclusion: Conclude with a Thank You.<br />
3) For writing use only Black or Blue color. For highlighting purpose make the word<br />
bold. Avoid using Red color as Red signifies danger, so use it when urgent.<br />
4) For greetings in mail:<br />
* For Americans: use Hi<br />
* For Europeans: use Hello<br />
* For Asians: use Dear<br />
To be more formal we could use Dear Mr. /Ms. followed by Last name or Full name.<br />
We should not use Dear Mr. /Ms. followed by First name alone.<br />
5) We should not put &#8216;/&#8217; in greetings like Hi X/Y. Instead we should say Hi X and Y.<br />
6) We should not use &#8216;Thanks and Regards&#8217;. Instead we should say:<br />
Thank you<br />
Regards</p>
<p>7) For requesting something we should not use Can, instead we should use Could. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> We should not write &#8216;Please find the attached file&#8217; because the reader does not<br />
have to find or search for the file in the mail it&#8217;s already there. So instead we should<br />
write<br />
&#8216;The file has been attached for your reference&#8217;.<br />
9) We should not use sentences like &#8216;As per your mail&#8217; because &#8216;per&#8217; is used only with<br />
units like per Kg etc. Instead we should write &#8216;According to your mail&#8217;.<br />
10) We should use parallel structure. Parallelism enables readers to read documents<br />
more efficiently. For e.g. The analysis will include planning, organizing, dividing and<br />
assessment<br />
(Instead assessment we should write Assessing) of turnaround functions.<br />
11) In our mails we often write &#8216;Please revert back&#8217;. Instead we should only write<br />
&#8216;Please revert&#8217;.<br />
12) For the Signature in mail, if we are sending to people in our company only then<br />
we should not write our company name in the signature because they already know<br />
that we are part of the same company but if we are sending mail to an external<br />
party like client etc then we should write our company name in the signature<br />
because there we have to brand our company name in front of others.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/muralis.wordpress.com/105/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/muralis.wordpress.com/105/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/muralis.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/muralis.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/muralis.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/muralis.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/muralis.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/muralis.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/muralis.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/muralis.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/muralis.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/muralis.wordpress.com/105/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=muralis.wordpress.com&blog=2752651&post=105&subd=muralis&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://muralis.wordpress.com/2008/04/04/email-etiquettes-tips/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Introduction to J2EE</title>
		<link>http://muralis.wordpress.com/2008/04/01/introduction-to-j2ee/</link>
		<comments>http://muralis.wordpress.com/2008/04/01/introduction-to-j2ee/#comments</comments>
		<pubDate>Tue, 01 Apr 2008 10:38:31 +0000</pubDate>
		<dc:creator>muralis</dc:creator>
		
		<category><![CDATA[J2EE]]></category>

		<guid isPermaLink="false">http://muralis.wordpress.com/?p=101</guid>
		<description><![CDATA[Today,more and more companies want to develop distributed transactional applications for the enterprise and leverage the speed,security,and reliability of server-side technology. Before presenting a way of designing such a system,several key terms need to be understood.

What is J2EE?
The Java 2 Platform Enterprise Edition (J2EE) technology provides a component-based approach to the design,development,assembly,and deployment of enterprise [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Today,more and more companies want to develop distributed transactional applications for the enterprise and leverage the speed,security,and reliability of server-side technology. Before presenting a way of designing such a system,several key terms need to be understood.</p>
<p><span id="more-101"></span></p>
<p><strong>What is J2EE?</strong></p>
<p>The Java 2 Platform Enterprise Edition (J2EE) technology provides a component-based approach to the design,development,assembly,and deployment of enterprise applications. The J2EE platform provides the ability to reuse components in different applications. J2EE is made up of 13 different technologies including JavaServer Pages,Servlets,Enterprise JavaBeans,JavaMail,XML,JavaMail and many more. </p>
<p><a href='http://muralis.files.wordpress.com/2008/04/intro_j2ee2.gif' title='intro_j2ee2.gif'><img src='http://muralis.files.wordpress.com/2008/04/intro_j2ee2.gif' alt='intro_j2ee2.gif'></a></p>
<p>The main technologies that we will be using are:<br />
• JavaServer Pages (JSP).<br />
• Servlets<br />
• EJB</p>
<p><strong>What are JavaServer Pages?</strong></p>
<p>JavaServer Pages (JSP) is a technology based on the Java language and enables the development of dynamic web sites. JSP was developed by Sun Microsystems to allow server side development. JSP files are HTML files with special Tags containing Java source code that provide the dynamic content.</p>
<p><strong><br />
What are Servlets?</strong></p>
<p>A Servlet is a Java class that provides special server side service. To display any information on a web page,HTML code is embedded in “println” statements. JSP technology is an extension of Servlets. It is easier to generate GUI pages using JSP because a web page editor (such as Macromedia DreamWeaver ) can be used to create simple pages.</p>
<p><strong>What are Enterprise JavaBeans?</strong></p>
<p>Enterprise JavaBeans (EJB) provides a component specification for the development of scalable and secure middleware components. The EJB Server handles security and transaction management details so developers can focus on implementing the business logic.</p>
<p><strong>What are the benefits of using J2EE?</strong></p>
<p>There are several reasons for using the J2EE set of technologies:</p>
<p> Extensibility and maintainability<br />
 Division of work along skill lines<br />
 Scalability,portability,availability.<br />
 Code reuse.<br />
 Interoperability – legacy integration<br />
 Focus on implementing business logic<br />
 Separation of code with differing rates of change.</p>
<p><strong>Simple J2EE application</strong></p>
<p>In our simple J2EE application,the customer visits a web page (JSP). The request is sent to the web server then passed to the JSP and Servlet engine. The JSP code is executed including a search on the database. The database results are returned to the JSP page. The JSP page dynamically generates a HTML page with the data and sends it to the Customer.</p>
<p><a href='http://muralis.files.wordpress.com/2008/04/jsp_design_diagrams1.jpg' title='jsp_design_diagrams1.jpg'><img src='http://muralis.files.wordpress.com/2008/04/jsp_design_diagrams1.jpg' alt='jsp_design_diagrams1.jpg'></a></p>
<p><em>Advantages.</em><br />
• Simple of understand and initially develop.<br />
<em><br />
<strong>Disadvantages.</strong></em><br />
• The JSP page is very difficult to maintain. It contains HTML and Java code with queries to the database. The business logic should not be in the JSP; otherwise many pages will need to be changed every time business requirements change.<br />
• Need to have data connectivity code in every JSP page.<br />
• Does not scale up very well.<br />
• Security issues - If a hacker gained access to the web server,all the confidential business logic can be read by opening the JSP files.</p>
<p>The following diagram shows the architecture of a typical J2EE application. This is similar to the previous example,except all business logic is contained in different EJB components.</p>
<p><a href='http://muralis.files.wordpress.com/2008/04/jsp_design_diagrams_ejb_2.gif' title='jsp_design_diagrams_ejb_2.gif'><img src='http://muralis.files.wordpress.com/2008/04/jsp_design_diagrams_ejb_2.gif' alt='jsp_design_diagrams_ejb_2.gif'></a></p>
<p>The diagram below shows how the JSP connects to the EJB object,which queries the database. This was the JSP does not contain the database queries and some business logic has been moved into the EJB layer. The EJB container is designed to create copies (instances) of the EJB class as required in memory. This enables it to scale up as multiple requests come in.</p>
<p><a href='http://muralis.files.wordpress.com/2008/04/jsp_design_diagrams_ejb_components_2b.gif' title='jsp_design_diagrams_ejb_components_2b.gif'><img src='http://muralis.files.wordpress.com/2008/04/jsp_design_diagrams_ejb_components_2b.gif' alt='jsp_design_diagrams_ejb_components_2b.gif' border='0' /></a></p>
<p><em>Advantages.</em></p>
<p>   More secure because all the business logic is stored in the EJB components. An EJB component can be configured so only a specific user in a group can be given access to a limited set of methods.</p>
<p>  By adding more EJB Application Servers,the system can easily scale up. However,you need to make sure the EJB components have been designed and deployed correctly.</p>
<p>  Transaction Management support - Transaction attributes are specified on an application component during assembly. This lets you group methods into transactions across application components,which means you can easily change application components within a J2EE application and reassign the transaction attributes without changing code and recompiling.</p>
<p><em>Disadvantages.</em></p>
<p>      All the JSP pages need to include code that locates the EJB components. </p>
<p>      There is still quite a bit of functionality in the JSP files.</p>
<p>      The current architecture does not support reuse at the JSP level so all the code will need to be replicated. This will cause major maintenance problems.</p>
<p>      The JSP pages are still too complex for web designers to use.</p>
<p><strong>Layered Approach.</strong></p>
<p>The actual architecture of the application has been separated out into several layers.</p>
<p>1. Presentation view<br />
2. Presentation logic<br />
3. Business logic<br />
4. Data Model</p>
<p>1. Presentation view.</p>
<p>This is the actual look,feel and presentation of the application. In J2EE,Java Server Pages (JSP) are used to implement your view.</p>
<p>2. Presentation Logic</p>
<p>This is the code required to call business logic and return output to the view. Java Servlets / java beans are the best way to implement presentation logic. </p>
<p>3. Business Logic</p>
<p>This is code required to execute the usecase actions and manipulate the data model. EJB Session beans are the containers of the business logic for all your usecases.</p>
<p>4. Data Model</p>
<p>J2EE provides a useful abstraction for your data model,called EJB Entity beans.  These are persistent objects that model your real world business abstractions.</p>
<p>The layered approach has the following benefits:</p>
<p>    • Encapsulation – each layer hides details from the other layers. Therefore a layer can change without affecting other layers.<br />
    • Separation - Complexity in the system is easier to manage because each layer is focused on a cohesive set of responsibilities.<br />
    • Reuse – each layer can provide services to the layer above,so classes can be reused whilst still abstracting the implementation details.</p>
<p>This leads to applications that are more flexible and maintainable.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/muralis.wordpress.com/101/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/muralis.wordpress.com/101/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/muralis.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/muralis.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/muralis.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/muralis.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/muralis.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/muralis.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/muralis.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/muralis.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/muralis.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/muralis.wordpress.com/101/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=muralis.wordpress.com&blog=2752651&post=101&subd=muralis&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://muralis.wordpress.com/2008/04/01/introduction-to-j2ee/feed/</wfw:commentRss>
	
		<media:content url="http://muralis.files.wordpress.com/2008/04/intro_j2ee2.gif" medium="image">
			<media:title type="html">intro_j2ee2.gif</media:title>
		</media:content>

		<media:content url="http://muralis.files.wordpress.com/2008/04/jsp_design_diagrams1.jpg" medium="image">
			<media:title type="html">jsp_design_diagrams1.jpg</media:title>
		</media:content>

		<media:content url="http://muralis.files.wordpress.com/2008/04/jsp_design_diagrams_ejb_2.gif" medium="image">
			<media:title type="html">jsp_design_diagrams_ejb_2.gif</media:title>
		</media:content>

		<media:content url="http://muralis.files.wordpress.com/2008/04/jsp_design_diagrams_ejb_components_2b.gif" medium="image">
			<media:title type="html">jsp_design_diagrams_ejb_components_2b.gif</media:title>
		</media:content>
	</item>
		<item>
		<title>Introduction to Hibernate-2</title>
		<link>http://muralis.wordpress.com/2008/04/01/introduction-to-hibernate-2/</link>
		<comments>http://muralis.wordpress.com/2008/04/01/introduction-to-hibernate-2/#comments</comments>
		<pubDate>Tue, 01 Apr 2008 10:25:31 +0000</pubDate>
		<dc:creator>muralis</dc:creator>
		
		<category><![CDATA[Hibernate]]></category>

		<category><![CDATA[J2EE]]></category>

		<guid isPermaLink="false">http://muralis.wordpress.com/?p=99</guid>
		<description><![CDATA[This section details the structure and functionality of the Hibernate XML Configuration File and the Hibernate Mapping Files.

Hibernate Configuration File
An application that uses Hibernate API must use a single configuration file. A configuration file for a Hibernate application will tell some of the information like the URL of the Database Server to which the application [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This section details the structure and functionality of the Hibernate XML Configuration File and the Hibernate Mapping Files.</p>
<p><span id="more-99"></span></p>
<p>Hibernate Configuration File</p>
<p>An application that uses Hibernate API must use a single configuration file. A configuration file for a Hibernate application will tell some of the information like the URL of the Database Server to which the application wants to connect, the username/password for the Database, class name of the Driver file and with other set of preferences.</p>
<p>A Hibernate configuration file can be an XML-based file (hibernate.cfg.xml) or it can be ordinary Java properties file (hibernate.properties) with key-value combination. This configuration file should be placed in the run-time classpath of an application. If both the XML-based configuration file and the properties-based configuration file are found in the classpath, then the XML-based configuration file will take preference over the other.</p>
<p>Following is the structure of a Hibernate configuration file,</p>
<p>Hibernate.cfg.xml:<br />
<em></p>
<p>  	    ClassNameOfTheDriver</p>
<p>	    DbServerUrl</p>
<p>	    DbUser</p>
<p>	    DbPassword</p>
<p>	<!-- Mapping files --></p>
<p>	&#8230;..				</p>
<p></em></p>
<p>Let us look into the structure of the XML in detail here. The first observable thing is that this XML has a well-defined DTD defined from &#8220;http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd&#8221; meaning that the construction of this XML document should be validated against the DTD.</p>
<p>The outer-most element is the &#8216;hibernate-configuration&#8217; element which forms the root element for specifying the configuration information. The next inner element is the &#8217;session-factory&#8217; element which corresponds to the SessionFactory class that contains information related to the Database like the URL of the Database server, the username/password information on the Database server etc.</p>
<p>The various properties within the &#8217;session-factory&#8217; element is represented in Hibernate Configuration file as a &#8216;property&#8217; element.</p>
<p>Whenever we say,Configuration configuration = new Configuration().configure(), the no argument Configuration.configure() method will load the configuration file called &#8220;hibernate.cfg.xml&#8221; from the application&#8217;s classpath. The default name for the Hibernate Configuration file is &#8220;hibernate.cfg.xml&#8221;. Different configuration file can be loaded into the application by calling the one-argument Configuration.configure() method, like the following,</p>
<p>File configurationFile = new File(&#8221;.\\config\\MyConfiguration.xml&#8221;);<br />
Configuration configuration = new Configuration().configure(configurationFile);</p>
<p>The code, SessionFactory sessionFactory = configuration.buildSessionFactory(), will populate the SessionFactory object with the set of property values values that are taken from the &#8217;session-factory&#8217; XML element. So, in our case, the SessionFactory object will be populated with values the class name of the driver, the URL of the Database server and the username/password of the Database.</p>
<p>The next section in the Hibernate Configuration File is the &#8216;mapping&#8217; element which represents a XML file that contains the mapping information such as how a Java Class should be mapped against a Database table. The next section deals with the structure of the Mapping Files in greater detail.</p>
<p>The same configuration information in the XML-based Hibernate configuration file can be given in the property-based Hibernate configuration file and such a file may look like the following,<br />
hibernate.properties:</p>
<p><em>hibernate.connection.driver_class = ClassNameOfTheDriver<br />
hibernate.connection.url = URLOfTheDatabaseServer<br />
hibernate.connection.username = DatabaseUsername<br />
hibernate.connection.password = DatabasePassword</em></p>
<p><strong>Hibernate Mapping Files</strong></p>
<p>A Hibernate mapping file provides mapping information like how a Java Class is mapped to a relational database table. It also contains other information like which Java Property (or Field) in a class will map to which Table Column. Relations between entities can be defined in the Mapping file through various associations like one-to-one, one-to-many, many-to-many etc.</p>
<p>The mapping files that are needed for an application are defined and referenced in the Hibernate configuration file throught the &#8216;mapping&#8217; element. If you remember, the Hibernate configuration file has references to Hibernate mapping files like this,<br />
<em></p>
<p>	&#8230;&#8230;</p>
<p>        &#8230;&#8230;</p>
<p></em></p>
<p>Let us look into the structure of a mapping file.<br />
TestMapping.xml:</p>
<p><em></p>
<p>		&#8230;.</p>
<p></em></p>
<p>Like the Hibernate Configuration file, this mapping file has to be validated against the DTD given by &#8220;http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd&#8221;. The root element in this XML file is the &#8216;hibernate-mapping&#8217; which acts as a container for several different mapping definitions in the form of &#8216;class&#8217; tag. Any number of mapping definitions can be given inside the &#8216;hibernate-mapping&#8217; element, but the preferred way is to give one definition per XML file.</p>
<p>The &#8216;name&#8217; attribute in the &#8216;class&#8217; element is the name of the Java class that we want to persist. The &#8216;table&#8217; attribute represents the name of the table for this java Class in the database. All the &#8216;property&#8217; elements will map Java fields to Table Column names. The Java Field is identified by the &#8216;name&#8217; attribute in the &#8216;property&#8217; element and the table column name is represented by the &#8216;name&#8217; attribute in the &#8216;column&#8217; element.</p>
<p>A primary key is a must for every table as it used to uniquely identify Java instances. The &#8216;id&#8217; element represents the primary-key portion wherein with &#8216;name&#8217; and the &#8216;column&#8217; attribute corresponds to the Java Field and the table primary key column. The value for the &#8216;generator&#8217; element represents how the primary-key is generated for the table. So many different implementations for generating a primary-key are available in Hibernate like &#8216;identity&#8217;, &#8217;select&#8217;, &#8216;assigned&#8217;, etc. If the value of the &#8216;generator&#8217; element is &#8216;assigned&#8217;, then it is the responsibility of the developer to manually set the primary key. </p>
<p><em>   Hibernate Configuration file:</em></p>
<p>Following is the Hibernate configuration file.</p>
<p>hibernate.cfg.xml:</p>
<p><em>                </p>
<p>            jdbc:mysql://localhost/DbForHibernate</p>
<p>            com.mysql.jdbc.Driver</p>
<p>            root</p>
<p>            root</p>
<p>            org.hibernate.dialect.MySQLDialect</p>
<p></em></p>
<p>The above XML file has the various database parameters like the URL, class name of the driver, username and password set to &#8216;jdbc:mysql://localhost/DbForHibernate&#8217;, &#8216;com.mysql.jdbc.Driver&#8217;, &#8216;root&#8217; and &#8216;root&#8217; respectively. We have already seen how these various parameters will affect the configuration of the SessionFactory object.<br />
Sql Dialects:</p>
<p>The only new property defined in this file is the &#8216;dialect&#8217; property which is pointing to org.hibernate.dialect.MySQLDialect. Dialects are one among the various new features in Hibernate. Consider a database vendor &#8216;DB-V1&#8242; who provides a feature called performance tuning using some SQL syntax. If some other database vendor &#8216;DB-V2&#8242; provides that performance tuning feature, then it&#8217;s very likely that the syntax of both the queries will be different.</p>
<p>Suppose, if such a feature is enabled in a hibernate application by some piece of code, Hibernate should using two different syntax for two different databases. How will Hibernate knows the correct SQL syntax for different databases?</p>
<p>The answer lies in SQL Dialect. Every database has their own SQL Dialect. The following provides some major SQL Dialects from some popular Database vendors.</p>
<p>Database 	SQL Dialect</p>
<p><em>Microsoft SQL Server 	org.hibernate.dialect.SQLServerDialect<br />
MySQL 	org.hibernate.dialect.MySQLDialect<br />
Oracle 	org.hibernate.dialect.OracleDialect<br />
Informix 	org.hibernate.dialect.InformixDialect<br />
Sybase 	org.hibernate.dialect.SybaseDialect</em></p>
<p>So, if an application uses any vendor specific features, it is a must that the application must provide that particular SQL Dialect in the Hibernate Configuration file to function properly.<br />
Hibernate Mapping File: The XML-based Hibernate mapping file is shown below,</p>
<p><em></p>
<p>	</em>	</p>
<p>As explained previously, the Hibernate mapping file contains the mapping information between a Java Class and the database table name. In the above file, the value for the &#8216;generator&#8217; element is given as &#8216;assigned&#8217;, which means that the application when persisting the Java object must manually set the value for the primary key (in our case, it&#8217;s the &#8216;Id&#8217; column). If it is not set, then an exception will be thrown by Hibernate at run-time.<br />
Client Application:</p>
<p>Following is the listing for the Client Application.<br />
RunClient.java:</p>
<p><em>package client;</p>
<p>import org.hibernate.*;<br />
import org.hibernate.cfg.Configuration;<br />
import test.User;</p>
<p>public class RunClient {<br />
    public static void main(String[] args) {</p>
<p>	    try{<br />
		   Configuration conf = new Configuration().configure();<br />
		   SessionFactory sessionFactory = conf.buildSessionFactory();<br />
		   Session session =sessionFactory.openSession();</p>
<p>		   User user = new User();<br />
		   user.setId(1000);<br />
		   user.setName(&#8221;Test User&#8221;);<br />
		   user.setAge(24);</p>
<p>		   Transaction t = session.beginTransaction();<br />
		   session.save(user);<br />
		   t.commit();</p>
<p>		   session.close();<br />
      	  }catch(Exception e){<br />
      		e.printStackTrace();<br />
      }<br />
   }<br />
}		</em></p>
<p>For the above program to compile and run properly, two set of Jar files have to placed properly in the application&#8217;s class-path. One is the set of Jar files that are available within the Hibernate Ditribution, which is normally the \lib, where  refers to the installation of the Hibernate. Following jar files from the Hibernate distribution have to be maintained in the class-path of the application,</p>
<p>    * cglib2.jar<br />
    * commons-collections<br />
    * commons-Logging<br />
    * dom4j.jar<br />
    * ehcache.jar<br />
    * jdbc2.0-stdext<br />
    * jta.jar<br />
    * log4j.jar<br />
    * odmg.jar<br />
    * xalan.jar<br />
    * xerces.jar<br />
    * xml-apis.jar</p>
<p>The other set of the jar files are for the Jdbc Driver, which is &#8216;mysql-connector-java-5.0.5-bin.jar&#8217; in the case of MySQL Database.</p>
<p>The above code establishes a Configuration object by calling new Configuration().configure() which scans the classpath for the presence of hibernate.cfg.xml file. It then creates an instance of SessionFactory object with the details populated from the Configuration File by calling Configuration.buildSessionFactory(). A new Session object is then created for persisting objects by calling SessionFactory.openSession().</p>
<p>A new Java object called &#8216;User&#8217; is populated with some test values and the object is persisted into the Session object within a transactional context by calling Session.beginTransaction() which marks the beginning of the transaction. Remember that Session.save(object) only marks the object to be persisted. After a successful save operation and transaction is committed by calling Transaction.commit(), which means that the object will be synchronized with the database.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/muralis.wordpress.com/99/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/muralis.wordpress.com/99/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/muralis.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/muralis.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/muralis.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/muralis.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/muralis.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/muralis.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/muralis.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/muralis.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/muralis.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/muralis.wordpress.com/99/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=muralis.wordpress.com&blog=2752651&post=99&subd=muralis&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://muralis.wordpress.com/2008/04/01/introduction-to-hibernate-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Introduction to Hibernate-1</title>
		<link>http://muralis.wordpress.com/2008/04/01/introduction-to-hibernate/</link>
		<comments>http://muralis.wordpress.com/2008/04/01/introduction-to-hibernate/#comments</comments>
		<pubDate>Tue, 01 Apr 2008 09:48:58 +0000</pubDate>
		<dc:creator>muralis</dc:creator>
		
		<category><![CDATA[Hibernate]]></category>

		<category><![CDATA[J2EE]]></category>

		<guid isPermaLink="false">http://muralis.wordpress.com/?p=98</guid>
		<description><![CDATA[Before the advent of Hibernate, there were so many other technologies and specifications from Sun, for persistence. Few are them are explained in detail in the following sections along with their drawbacks which led them not being able to become a successful one.

Problems with JDBC
Java provided an initial solution for persistence in the form of [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Before the advent of Hibernate, there were so many other technologies and specifications from Sun, for persistence. Few are them are explained in detail in the following sections along with their drawbacks which led them not being able to become a successful one.</p>
<p><span id="more-98"></span></p>
<p><b>Problems with JDBC</b></p>
<p>Java provided an initial solution for persistence in the form of JDBC and developers are depending on JDBC API&#8217;s to connect to the database. One of the major drawbacks of JDBC is that, one has to embed the application&#8217;s data into the SQL syntax, i.e., for saving the data in an application, the business object has to be converted to relational-object model by embedding the various pieces of data within the SQL language syntax.</p>
<p>Consider the following situation, there is a business object called Employee with properties name and age and this has to be persisted to a database. The following is the class representation of the Employee class,</p>
<p><i>class Employee<br />
{<br />
private String name;<br />
private int age;</i></p>
<p><i>    //Other Methods go here.</i></p>
<p><i>}</i></p>
<p><i>Employee employee = getEmployeeObject();<br />
String sqlInsertStmt = &#8220;INSERT INTO EMPLOYEE VALUES (&#8217;&#8221; + employee.getName() + &#8220;&#8216;, &#8216;&#8221; +<br />
employee.getAge() + &#8220;&#8216;)&#8221;);<br />
statement.executeQuery(sqlInsertStmt);</i></p>
<p>The above is generally a poorer code, and also the business object (Employee object, in our case) is tightly integrated with the SQL syntax.</p>
<p>During data retrieval, the reverse of the above process will happen. The information that is fetched from the database has to be mapped to the business object. Consider the following piece of code which has the conversion process of representing the business object from the relational data model.</p>
<p><i>String sqlQueryStmt = &#8220;SELECT * FROM EMPLOYEE WHERE EMP_ID = &#8216;100&#8242;&#8221;);<br />
ResultSet employees = statement.executeQuery(sqlInsertStmt);</i></p>
<p><i>if (employees.next())<br />
{<br />
Employee fetchedEmployee = new Employee();<br />
fetchedEmployee.setName(employees.getString(&#8221;name&#8221;));<br />
fetchedEmployee.setAge(employees.getInt(&#8221;age&#8221;));<br />
}</i></p>
<p><b> Entity Beans</b></p>
<p>Entity beans, which were one of the major components in the EJB Specification failed drastically to provide a persistent layer in the applications.</p>
<p>The initial version of the EJB specification has little support for the Entity beans. The first disadvantage is, an Entity Bean is not a local object, but a remote object, so, there are overheads related to network performance issues. And the worst thing is that the relationships between entity beans have to be manually managed in the application code and the actual mappings were done in vendor-specific configuration files which invented lots of changes in the configuration files when the application is made to point out to a different database server.</p>
<p>Though, the later version of the specification overcome many of the drawbacks that were found in the initial versions by introducing the notion of local interfaces for representing an enterprise bean and EJB Query Language (EJB-QL), etc., the art of designing and managing an entity bean still yielded much complexity in the hands of the developers.</p>
<p><b>Hibernate - ORM product</b></p>
<p>Hibernate is one of the Object-Relational Mapping software for persisting and querying data. Most of the Hibernate features look very similar that are found in &#8220;Java Persistence API (JPA)&#8221; specification. Also Hibernate provides some add-on functionalities that are not mentioned in the JPA specification. Hibernate doesn&#8217;t replace JDBC. Hibernate is sitting on top of JDBC to connect to the database. Internally Hibernate is using these JDBC calls to connect to the database systems.</p>
<p>Hibernate is neither forcing its developers to use some specific interfaces for the classes to be persisted in an application nor it requires the program to follow some standard design to achieve its goals. For this reason, Hibernate can well integrate with all kinds any of J2SE/J2EE application and with any kind of frameworks (like Spring, Struts etc).</p>
<p><b>Hibernate Modules</b></p>
<p>The open-source Hibernate project has various different modules each representing a unique functionality.</p>
<p>* Hibernate Core which represent the basic and the core module of the Hibernate project provides support for OO features along with the Query services.<br />
* Another module called Java Persistence with Hibernate is an implementation for the specification &#8220;Java Persistence API (JPA)&#8221; from Sun and we can be used in any Sun&#8217;s compliant Application Server as well as with J2SE applications.<br />
* There is a separate module called Hibernate Search that provides rich functionality for searching the persistence domain model using a simplified API.<br />
* For validating the data, Hibernate comes with a set of validation rules in the form of Annotations in a module called Hibernate validations and it also allows the developers to create custom validation rules.<br />
* Support for Querying and inserting data from multiple databases can be achieved by using the Hibernate Shards API.</p>
<p><b>Hibernate Core AP</b>I</p>
<p>Following section covers the various core interfaces/classes that should be used by an application which is depending on the persistence-level service from Hibernate.</p>
<p><b> The &#8216;Configuration&#8217; class</b></p>
<p>The Configuration class is the initial entry point of a Hibernate application. An instance of Configuration class represents application specific configuration that provides persistence services. This class provides convinient ways to import the Hibernate Configuration File and the necessary Mapping Files (which are discussed later) into an application which can be later used by SessionFactory (which is detailed in the next section) class to create Session objects.</p>
<p>The following code shows how to create and configure a Configuration object.</p>
<p>Configuration configuration = new Configuration().configure();</p>
<p>Calling the Configuration.configure() method will configure the object by loading the configuration file and the mapping files that are available in the application&#8217;s class-path.</p>
<p>Usually only one instance of a Configuration class will be maintained by an application.</p>
<p><b>The &#8216;SessionFactory&#8217; interface</b></p>
<p>The Configuration class can be used to create SessionFactory object which serves as a factory class that creates Session objects (discussed in the next section). An application may have one SessionFactory class but many number of Session objects. The following code shows how to create a SessionFactory object by calling the Configuration.buildSessionFactory().</p>
<p><i>Configuration configuration = new Configuration().configure();<br />
SessionFactory sessionFactory = configuration.buildSessionFactory();</i></p>
<p>Configuration.buildSessionFactory() will create a new SessionFactory object with configurations and the mapping information taken from the Hibernate Configuration and the Mapping Files.</p>
<p><b>The &#8216;Session&#8217; interface</b></p>
<p>A Hibernate Session interface forms the primary interface for promoting persistence services to the application classes. The following code shows how to create a Session object.<br />
<i><br />
Configuration configuration = new Configuration().configure();<br />
SessionFactory sessionFactory = configuration.buildSessionFactory();<br />
Session newSession = sessionFactory.openSession();</i></p>
<p>Calling the SessionFactory.openSession() method, will create a new database connection (the connection related information like the Database server, username, password etc., will be taken the Hibernate configuration files which is discussed in the later section) and opens a new session from the created connection. Calling the SessionFactory.openSession() method again will create new Session objects as well as new java.sql.Connection object. One can get a reference to the newly created connection by calling the Session.connection() method, like the following,</p>
<p>java.sql.Connection connection = session.connection();</p>
<p><b><i>Object Classification based on States</i></b></p>
<p>Three different types of objects are categorized in Hibernate technology based on the state of the object. They are,</p>
<p># Persistent Object<br />
# Transient Object<br />
# Detached Object</p>
<p><b>Persistent Object:</b></p>
<p>A persistent object is one which is associated with the current Session and has its state values synchronized with the database.</p>
<p><b>Transient Object:</b></p>
<p>A transient object doesn&#8217;t have any association with the current Session, but can be made persistent at a later time.</p>
<p><b>Detached Object:</b></p>
<p>A detached object was having an association at a previous point of time with the Session interface, but now is made to detach (taken-off) from the current Session.<br />
<i><br />
<b>Operations using the Session Interface</b></i></p>
<p>As seen previously, the Session interface provides various services in the form of operations for persisting any Object. It also provides transactional services to the persistent objects. Rich Querying operations are also supported in the form of Query interface. The following code can be used to persist an object.</p>
<p><i>Employee objectToBePersisted = new Employee();<br />
// Set properties for employee object here.<br />
Session session = …;<br />
session.save(objectToBePersisted);</i></p>
<p>Session.save(object) can be used to save a persistent object along with a unique key (primary key). Calling the method again on the same object will cause the following exception to be thrown. org.hibernate.exception.ConstraintViolationException. However, calling this method doesn&#8217;t immediately synchronize the state of the object with the database. It will just mark this object to be saved. Calling the method Session.flush() will make all the objects that are associated with the Session to be synchronized with the database.</p>
<p>session.flush();</p>
<p>There is a method called Session.update(object) which is used to update the state of the persistent object that was modified for some reasons after a call to Session.save(object). Consider the following code which will demonstrate this,</p>
<p><i>Employee employee = …;<br />
//Set employee properties here.<br />
session.save(employee);</i></p>
<p><i>//Update the properties of employee object here.<br />
employee.set(…);<br />
session.update(employee);</i></p>
<p>If you don&#8217;t like to use Session.save(object) or Session.update(object), use the smart Session.saveOrUpdate(object) method, which will call Session.save(object), if the object in consideration is a new object or will call Session.update(object), if it is an updated (saved) object.</p>
<p>session.saveOrUpdate(employee);</p>
<p>There are so many other useful services and operations available from Session interface like Session.delete(object), Session.merge(object), and Session.refresh(object).</p>
<p>Objects can be retrieved from the Database using the Query interface. The following code resembles the traditional select query to select all the object from a table called User.</p>
<p><i>Query selectQuery = session.createQuery(&#8221;FROM User&#8221;);<br />
List userList = selectQuery.list();<br />
for(int index = 0; index &lt; userList.size(); index ++){<br />
User user = (User)userList.get(0);<br />
System.out.println(&#8221;Name = &#8221; + user.getName() + &#8220;, Age = &#8221; + user.getAge());<br />
}</i></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/muralis.wordpress.com/98/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/muralis.wordpress.com/98/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/muralis.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/muralis.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/muralis.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/muralis.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/muralis.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/muralis.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/muralis.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/muralis.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/muralis.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/muralis.wordpress.com/98/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=muralis.wordpress.com&blog=2752651&post=98&subd=muralis&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://muralis.wordpress.com/2008/04/01/introduction-to-hibernate/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>