<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2421921122565523879</id><updated>2024-09-01T20:32:46.538+05:30</updated><title type='text'>Program World</title><subtitle type='html'>Some Programming Help Notes.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://clickmyprogram.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2421921122565523879/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://clickmyprogram.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Kutti Master</name><uri>http://www.blogger.com/profile/04158320455119383243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIh8FUlLsBhS6S8vzuljG2G7fJlw3r6aIx4E5a0IRLZxszN9Mp5quxZR92JoImYLxe0sVQ3ldC6cgZ1FIAzoG6-bsldfq7LQr1WA-riFiunXflb6Mr2HWZxLNzYX-wOQY/s220/Rahul%27s+pics0147.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2421921122565523879.post-1596397468739047941</id><published>2012-06-30T21:45:00.001+05:30</published><updated>2012-06-30T21:48:12.338+05:30</updated><title type='text'>resize image to required height and width</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;


&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: small;&quot;&gt;&amp;nbsp;How to resize image to required height and width.&lt;/span&gt;&amp;nbsp;&lt;/h2&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;To resize the image firstly need to create a method &lt;span style=&quot;mso-spacerun: yes;&quot;&gt;&amp;nbsp;&lt;/span&gt;&#39;resizeImage()&#39; and pass the required
parameters .&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;

&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;Here the &#39;resizeImage()&#39; method accept 3 parameters (input Stream,
required Width , required height&lt;/span&gt; )&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0in 0in 10pt;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;the code is given below.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: #93c47d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;public static BufferedImage resizeImage(InputStream in, int requiredWidth, int requiredHeight) throws IOException {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: #93c47d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BufferedImage bfrImage = ImageIO.read(in);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: #93c47d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int imageWidth = bfrImage.getWidth();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: #93c47d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int imageheight = bfrImage.getHeight();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: #93c47d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; double scalex = (double) requiredWidth / imageWidth;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: #93c47d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; double scaley = (double) requiredHeight / imageheight;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: #93c47d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Image scaledImage = null;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: #93c47d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;scaledImage = bfrImage.getScaledInstance(imageWidth, imageheight, Image.SCALE_SMOOTH);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: #93c47d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;BufferedImage destination = new BufferedImage(requiredWidth, requiredHeight, BufferedImage.SCALE_SMOOTH);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: #93c47d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Graphics2D g2d = destination.createGraphics();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: #93c47d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g2d.scale(scalex, scaley);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: #93c47d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g2d.drawImage(scaledImage, 0, 0, null);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: #93c47d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; g2d.dispose();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: #93c47d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return destination;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: #93c47d; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: x-small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://clickmyprogram.blogspot.com/feeds/1596397468739047941/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://clickmyprogram.blogspot.com/2012/06/resize-image-to-required-height-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2421921122565523879/posts/default/1596397468739047941'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2421921122565523879/posts/default/1596397468739047941'/><link rel='alternate' type='text/html' href='http://clickmyprogram.blogspot.com/2012/06/resize-image-to-required-height-and.html' title='resize image to required height and width'/><author><name>Kutti Master</name><uri>http://www.blogger.com/profile/04158320455119383243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIh8FUlLsBhS6S8vzuljG2G7fJlw3r6aIx4E5a0IRLZxszN9Mp5quxZR92JoImYLxe0sVQ3ldC6cgZ1FIAzoG6-bsldfq7LQr1WA-riFiunXflb6Mr2HWZxLNzYX-wOQY/s220/Rahul%27s+pics0147.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2421921122565523879.post-4208037114826511139</id><published>2012-06-28T10:29:00.000+05:30</published><updated>2012-06-30T22:22:02.989+05:30</updated><title type='text'>access files inside web inf folder</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;


&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp; how to access files inside web inf folder&lt;/span&gt;&lt;/h2&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;font-weight: normal; line-height: 150%; margin-bottom: 0in; margin-left: -0.02in; text-decoration: none; text-indent: 0.29in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Direct accessing to
web-inf is not possible by client. And its&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;font-weight: normal; line-height: 150%; margin-bottom: 0in; margin-left: -0.02in; text-decoration: none; text-indent: 0.29in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;restricted. Files
inside the WEB-INF is only accessible by the&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;font-weight: normal; line-height: 150%; margin-bottom: 0in; margin-left: -0.02in; text-decoration: none; text-indent: 0.29in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;server.To access
files inside web-inf we need to create a&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;font-weight: normal; line-height: 150%; margin-bottom: 0in; margin-left: -0.02in; text-decoration: none; text-indent: 0.29in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;java servlet.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;font-weight: normal; line-height: 150%; margin-bottom: 0in; margin-left: -0.02in; text-decoration: none; text-indent: 0.29in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;font-weight: normal; line-height: 150%; margin-bottom: 0in; margin-left: -0.02in; text-decoration: none; text-indent: 0.29in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;using that servlet
we can redirect the request to specified file&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;font-weight: normal; line-height: 150%; margin-bottom: 0in; margin-left: -0.02in; text-decoration: none; text-indent: 0.29in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;inside the web-inf
folder. Here we are using a sample pure jsp&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;font-weight: normal; line-height: 150%; margin-bottom: 0in; margin-left: -0.02in; text-decoration: none; text-indent: 0.29in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;project that uses a
login page &#39;&lt;b&gt;login.jsp&lt;/b&gt;&#39;. And its inside the &lt;/span&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;font-weight: normal; line-height: 150%; margin-bottom: 0in; margin-left: -0.02in; text-decoration: none; text-indent: 0.29in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;WEB-INF folder.
Inside WEB-INF/jsp/login.jsp.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;font-weight: normal; line-height: 150%; margin-bottom: 0in; margin-left: -0.02in; text-decoration: none; text-indent: 0.29in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;font-weight: normal; line-height: 150%; margin-bottom: 0in; margin-left: -0.02in; text-decoration: none; text-indent: 0.29in;&quot;&gt;
&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;font-weight: normal; line-height: 150%; margin-bottom: 0in; margin-left: -0.02in; text-decoration: none; text-indent: 0.29in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;This example code
will show how toredirect the request
to&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;font-weight: normal; line-height: 150%; margin-bottom: 0in; margin-left: -0.02in; text-decoration: none; text-indent: 0.29in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;login.jsp inside the web-inf folder.To do this
firstly we need&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;font-weight: normal; line-height: 150%; margin-bottom: 0in; margin-left: -0.02in; text-decoration: none; text-indent: 0.29in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;to modify the &lt;b&gt;web.xml.&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;font-weight: normal; line-height: 150%; margin-bottom: 0in; margin-left: -0.02in; text-decoration: none; text-indent: 0.29in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2-rqFdHkexLcj8ZIZoydeJb1YFhFF5Fdr7zrrM4MEwBaMQ1be3G35uaZBN5mjci28AnSCeEke6gfLhA807g5k7-7KINN1Tf6MDDZF3qVbgVxLuxBL587URsHd61fCBlB64c79IJmFOcEK/s1600/servlet.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2-rqFdHkexLcj8ZIZoydeJb1YFhFF5Fdr7zrrM4MEwBaMQ1be3G35uaZBN5mjci28AnSCeEke6gfLhA807g5k7-7KINN1Tf6MDDZF3qVbgVxLuxBL587URsHd61fCBlB64c79IJmFOcEK/s1600/serv.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;font-weight: normal; line-height: 150%; margin-bottom: 0in; margin-left: -0.02in; text-decoration: none; text-indent: 0.29in;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;font-weight: normal; line-height: 150%; margin-bottom: 0in; margin-left: -0.02in; text-decoration: none; text-indent: 0.29in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;After modifying the
web.xml create a class names&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;font-weight: normal; line-height: 150%; margin-bottom: 0in; margin-left: -0.02in; text-decoration: none; text-indent: 0.29in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;background: rgb(148, 189, 94);&quot;&gt;LoginController.java&lt;/span&gt;&#39;and
place the class inside&#39;&lt;span style=&quot;background: rgb(148, 189, 94);&quot;&gt;servletmapping&lt;/span&gt;&#39;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;line-height: 150%; margin-bottom: 0in; margin-left: -0.02in; text-indent: 0.29in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;package.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;text-decoration: none;&quot;&gt;&lt;b&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;Code
is&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;text-decoration: none;&quot;&gt;&lt;b&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;given
below&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0in; text-indent: 0.23in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;background: rgb(148, 189, 94);&quot;&gt;pckage
servletmapping;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;margin-bottom: 0in; text-indent: 0.23in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; class=&quot;frame-contents&quot; style=&quot;text-indent: 0.24in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;background: rgb(148, 189, 94);&quot;&gt;import
java.io.IOException;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; class=&quot;frame-contents&quot; style=&quot;text-indent: 0.24in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;background: rgb(148, 189, 94);&quot;&gt;import
javax.servlet.RequestDispatcher;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; class=&quot;frame-contents&quot; style=&quot;text-indent: 0.24in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;background: rgb(148, 189, 94);&quot;&gt;import
javax.servlet.ServletException;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; class=&quot;frame-contents&quot; style=&quot;text-indent: 0.24in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;background: rgb(148, 189, 94);&quot;&gt;import
javax.servlet.http.HttpServlet;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; class=&quot;frame-contents&quot; style=&quot;text-indent: 0.24in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;background: rgb(148, 189, 94);&quot;&gt;import
javax.servlet.http.HttpServletRequest;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; class=&quot;frame-contents&quot; style=&quot;text-indent: 0.24in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;background: rgb(148, 189, 94);&quot;&gt;import
javax.servlet.http.HttpServletResponse;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; class=&quot;frame-contents&quot; style=&quot;text-indent: 0.24in;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; class=&quot;frame-contents&quot; style=&quot;text-indent: 0.24in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;background: rgb(148, 189, 94);&quot;&gt;public
class LoginController extends HttpServlet {&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; class=&quot;frame-contents&quot; style=&quot;text-indent: 0.24in;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; class=&quot;frame-contents&quot; style=&quot;text-indent: 0.24in;&quot;&gt;
&lt;span style=&quot;background: rgb(148, 189, 94);&quot;&gt;
   &lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;@Override&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; class=&quot;frame-contents&quot; style=&quot;text-indent: 0.24in;&quot;&gt;
&lt;span style=&quot;background: rgb(148, 189, 94);&quot;&gt;
   &lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;protected void
doGet(HttpServletRequest req, HttpServletResponse resp)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; class=&quot;frame-contents&quot; style=&quot;text-indent: 0.24in;&quot;&gt;
&lt;span style=&quot;background: rgb(148, 189, 94);&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;throws
ServletException, IOException{&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; class=&quot;frame-contents&quot; style=&quot;text-indent: 0.24in;&quot;&gt;
&lt;span style=&quot;background: rgb(148, 189, 94);&quot;&gt;
       &lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;String
location = &quot;/WEB-INF/jsp/login.jsp&quot;; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; class=&quot;frame-contents&quot; style=&quot;text-indent: 0.24in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;background: rgb(255, 255, 204);&quot;&gt;//
location of jsp file inside the web inf&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; class=&quot;frame-contents&quot; style=&quot;text-indent: 0.24in;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; class=&quot;frame-contents&quot; style=&quot;text-indent: 0.24in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;background: rgb(148, 189, 94);&quot;&gt;RequestDispatcher
rd = getServletContext().getRequestDispatcher(location);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; class=&quot;frame-contents&quot; style=&quot;text-indent: 0.24in;&quot;&gt;
&lt;span style=&quot;background: rgb(148, 189, 94);&quot;&gt;
       &lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;rd.forward(req,
resp);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; class=&quot;frame-contents&quot; style=&quot;text-indent: 0.24in;&quot;&gt;
&lt;span style=&quot;background: rgb(148, 189, 94);&quot;&gt;
   &lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; class=&quot;frame-contents&quot; style=&quot;text-indent: 0.24in;&quot;&gt;
&lt;span style=&quot;background: rgb(148, 189, 94);&quot;&gt;
   &lt;/span&gt;
&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; class=&quot;frame-contents&quot; style=&quot;text-indent: 0.24in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;background: rgb(148, 189, 94);&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-indent: 0.22in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 0in; text-indent: 0.22in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 150%; margin-bottom: 0in; text-indent: 0.22in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;This is how we redirect the
request inside the WEB-INF folder.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 150%; margin-bottom: 0in; text-indent: 0.22in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;when we request &#39;&lt;span style=&quot;font-size: x-small;&quot;&gt;&lt;span style=&quot;background: rgb(148, 189, 94);&quot;&gt;/app/login.jsp&lt;/span&gt;&lt;/span&gt;&#39;
then the corresponding &lt;/span&gt;
&lt;/div&gt;
&lt;div style=&quot;line-height: 150%; margin-bottom: 0in; text-indent: 0.22in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;servlet handle the request(that
we are defined inside the&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 150%; margin-bottom: 0in; text-indent: 0.22in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;web.xml) and serve the file
inside the web inf.And it is not&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 150%; margin-bottom: 0in; text-indent: 0.22in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;possible to access the file by
typing the exact&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;line-height: 150%; margin-bottom: 0in; text-indent: 0.22in;&quot;&gt;
&lt;span style=&quot;font-family: Courier New,monospace;&quot;&gt;location inside the server that
is &#39;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;text-decoration: none;&quot;&gt;&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;span style=&quot;background: rgb(148, 189, 94);&quot;&gt;WEB-INF/jsp/login.jsp&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div align=&quot;LEFT&quot; style=&quot;font-weight: normal; line-height: 150%; margin-bottom: 0in; margin-left: -0.02in; text-decoration: none; text-indent: 0.29in;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2-rqFdHkexLcj8ZIZoydeJb1YFhFF5Fdr7zrrM4MEwBaMQ1be3G35uaZBN5mjci28AnSCeEke6gfLhA807g5k7-7KINN1Tf6MDDZF3qVbgVxLuxBL587URsHd61fCBlB64c79IJmFOcEK/s1600/serv.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://clickmyprogram.blogspot.com/feeds/4208037114826511139/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://clickmyprogram.blogspot.com/2012/06/how-to-access-files-inside-web-inf.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2421921122565523879/posts/default/4208037114826511139'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2421921122565523879/posts/default/4208037114826511139'/><link rel='alternate' type='text/html' href='http://clickmyprogram.blogspot.com/2012/06/how-to-access-files-inside-web-inf.html' title='access files inside web inf folder'/><author><name>Kutti Master</name><uri>http://www.blogger.com/profile/04158320455119383243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIh8FUlLsBhS6S8vzuljG2G7fJlw3r6aIx4E5a0IRLZxszN9Mp5quxZR92JoImYLxe0sVQ3ldC6cgZ1FIAzoG6-bsldfq7LQr1WA-riFiunXflb6Mr2HWZxLNzYX-wOQY/s220/Rahul%27s+pics0147.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2-rqFdHkexLcj8ZIZoydeJb1YFhFF5Fdr7zrrM4MEwBaMQ1be3G35uaZBN5mjci28AnSCeEke6gfLhA807g5k7-7KINN1Tf6MDDZF3qVbgVxLuxBL587URsHd61fCBlB64c79IJmFOcEK/s72-c/serv.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2421921122565523879.post-6307963981890733112</id><published>2012-05-01T13:12:00.000+05:30</published><updated>2012-06-30T20:47:53.795+05:30</updated><title type='text'>Custom Entity Creation in Hibernate</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;


&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;&lt;b&gt;&lt;u&gt;CUSTOM
ENTITY CREATION&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;We can create entity class of a table
using hibernate and pojo. And it can be used with hibernate query and hibernate
native sql queries.`@Entity` annotation is used to identify the entity class.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;Assume that we use hibernate query to
return particular result from table and map the result to entity.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;Example :-&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;we have 2 table named `shop_type` and
`shop`&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;And we set `shop_type_id` as foreign
key for `shop ` table&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;table `shop_type`&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;border-collapse: collapse; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; height: 138px; margin-left: 2.25pt; width: 475px;&quot;&gt;
 &lt;tbody&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-style: solid none solid solid; border-width: 1pt medium 1pt 1pt; padding: 2.75pt; width: 240.9pt;&quot; valign=&quot;top&quot; width=&quot;321&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;shop_type_id&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border: 1pt solid black; padding: 2.75pt; width: 240.95pt;&quot; valign=&quot;top&quot; width=&quot;321&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;name&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 240.9pt;&quot; valign=&quot;top&quot; width=&quot;321&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;1&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none solid solid; border-width: medium 1pt 1pt; padding: 2.75pt; width: 240.95pt;&quot; valign=&quot;top&quot; width=&quot;321&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;Hotel&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 240.9pt;&quot; valign=&quot;top&quot; width=&quot;321&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;2&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none solid solid; border-width: medium 1pt 1pt; padding: 2.75pt; width: 240.95pt;&quot; valign=&quot;top&quot; width=&quot;321&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;M.Market&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 240.9pt;&quot; valign=&quot;top&quot; width=&quot;321&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;3&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none solid solid; border-width: medium 1pt 1pt; padding: 2.75pt; width: 240.95pt;&quot; valign=&quot;top&quot; width=&quot;321&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;Textile&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;table `shop`&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;border-collapse: collapse; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; height: 235px; margin-left: 2.25pt; width: 478px;&quot;&gt;
 &lt;tbody&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-style: solid none solid solid; border-width: 1pt medium 1pt 1pt; padding: 2.75pt; width: 120.45pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;shop_id&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: solid none solid solid; border-width: 1pt medium 1pt 1pt; padding: 2.75pt; width: 120.45pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;shop_type_Id&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: solid none solid solid; border-width: 1pt medium 1pt 1pt; padding: 2.75pt; width: 120.45pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;name&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border: 1pt solid black; padding: 2.75pt; width: 120.5pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;entry_date&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 120.45pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;1&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 120.45pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;1&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 120.45pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;AVN&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none solid solid; border-width: medium 1pt 1pt; padding: 2.75pt; width: 120.5pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;03/16/12 12:05 AM&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 120.45pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;2&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 120.45pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;1&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 120.45pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;AKN&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none solid solid; border-width: medium 1pt 1pt; padding: 2.75pt; width: 120.5pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;03/16/12 12:10 AM&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 120.45pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;3&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 120.45pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;2&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 120.45pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;Reliance m&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none solid solid; border-width: medium 1pt 1pt; padding: 2.75pt; width: 120.5pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;03/16/12 12:15 AM&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 120.45pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;4&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 120.45pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;3&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 120.45pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;AnimalTXT&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none solid solid; border-width: medium 1pt 1pt; padding: 2.75pt; width: 120.5pt;&quot; valign=&quot;top&quot; width=&quot;161&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;03/16/12 12:20 AM&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;Assume that we have 2 entity classes
named `&lt;b&gt;Shop&lt;/b&gt;` and `&lt;b&gt;ShopType&lt;/b&gt;`&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;and so we have two entity
classes.&amp;nbsp; if we want to select a
particular details from &#39;shop&#39; table we can simply use our hibernate query&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eg:-
&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;hql&amp;nbsp; = &quot;from Shop s where
s.shopId = ?&quot;;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Query
query = session.createQuery(hql);&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.setInteger(0,
shopId);&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (Shop)(query.uniqueResult());&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;and when we execute this statement .
Hibernate will include all column of `shop` table in select statement by
default and its a background process doing by hibernate. The reason for this
behavior is only then&amp;nbsp; hibernate can map
this result to corresponding entity class here it is `Shop.class`.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;Example for background process is
something like this&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;&amp;nbsp;
&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; color: black;&quot;&gt;select s.shop_id,s.shop_type_id,s.name,s.phone_number from shop s
whee&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; color: black; line-height: 150%;&quot;&gt;&amp;nbsp;
s.shop_id = 1;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;&amp;nbsp;we can also use our native sql query also for
select the result.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;&amp;nbsp;Eg :- &lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; color: black;&quot;&gt;sql = &quot;select {s.*} from shop s
where s.shop_id = ?&quot;;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; color: black; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SQLQuery
query = session.createSQLQuery(sql);&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; color: black; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.addEntity(&quot;s&quot;,
Shop.class);&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; color: black; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.setInteger(0,
shopId);&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; color: black; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  (Shop)(query.uniqueResult());&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;In this case also we need to select
full column in our select statement.&#39;{}&#39;&amp;nbsp;
symbol&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;is used when selecting all
columns&amp;nbsp; and this tells the hibernate
that all fields are selected.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;Until now we select all column from
table using select statements and mapped it to corresponding entity. And we
find that without this way we can&#39;t map the result to entity.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;Good news is that there is a way to
select specified columns from a table using hibernate native sql quires.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;using .&lt;b&gt;addScalar &lt;/b&gt;property we
can achieve this.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;Eg:-&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;sql = &quot;select s.name as sname from
shop s where s.shop_id = ?&quot;;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;SQLQuery countQuery =
session.createSQLQuery(hql).addScalar(&quot;sname&quot;,Hibernate.STRING)&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;return ((Object[])
countQuery.uniqueResult());&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;But using this properties we can&#39;t
map the result in to entity class and it only return&amp;nbsp; objects .&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;Until now the result set column names
are assumed to be the same as the column names specified in the mapping
document. This can be problematic for SQL queries which join multiple tables,
since the same column names may appear in more than one table. Assume that if
we have a situation and we want to join two table and select only 3 columns .
So we can use&amp;nbsp; &lt;b&gt;addScalar &lt;/b&gt;property
but if we need to select 10 columns then&amp;nbsp;
&lt;b&gt;addScalar &lt;/b&gt;will not be a proper way to accomplish this task.
Because using lots of &lt;b&gt;addScalar&lt;/b&gt; properties will&amp;nbsp; complicate our task and traveling of data
will be more difficult. Also if we pass this result to velocity there will be
difficulties.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;So in this case we can use&amp;nbsp; custom entity like classes for mapping our
join query result. Using this way we can reduce complexity and it behave like
an entity class object. We can use it anywhere we like. To doing this we need
to create a java class.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;This example will give you an clear
idea.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;We have a sql query&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;&amp;nbsp;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;sql = SELECT
s.`name`,st.name,,s.entry_date&amp;nbsp; FROM shop
s JOIN shop_type st ON(s.type_id = st.shop_type_id);&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;This will return&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;border-collapse: collapse; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; height: 154px; margin-left: 2.25pt; width: 488px;&quot;&gt;
 &lt;tbody&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-style: solid none solid solid; border-width: 1pt medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;u&gt;name&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: solid none solid solid; border-width: 1pt medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;u&gt;name&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border: 1pt solid black; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;entry_date&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;AVN&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Hotel&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none solid solid; border-width: medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;03/16/12 12:05 AM&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;AKN&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Hotel&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none solid solid; border-width: medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;03/16/12 12:10 AM&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;Reliance m&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;M.Market&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none solid solid; border-width: medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;03/16/12 12:15 AM&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;Animal TXT&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Textile&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none solid solid; border-width: medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;03/16/12 12:20 AM&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;&amp;nbsp;And i am trying to map the result in to an
custom entity to doing this we need&amp;nbsp; to
create a class just like entity class . And this class must have variables. And&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;1.Variable name must be same as
column names in our select statement&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;2.must include getter and setter
methods for that variables .&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;3.Data type of variable also same as
in table .&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;Here data type of column &lt;b&gt;entry_date
&lt;/b&gt;is Date in database and so variable `entryDate`.We can see that here some
column have same&amp;nbsp; names.[1&lt;sup&gt;st&lt;/sup&gt;
and 2&lt;sup&gt;nd&lt;/sup&gt; column have same name]and this will make some problems in
our entity because there is an ambiguity. To solve this we can use alias in our
query and so the column name will change&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;eg :- &lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;SELECT s.`name` as
shopName,st.name as typeName,s.entry_date as entryDate&lt;u&gt; &lt;/u&gt;&amp;nbsp;FROM shop s JOIN shop_type st ON(s.type_id =
st.shop_type_id);&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;This will return&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;border-collapse: collapse; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; height: 160px; margin-left: 2.25pt; width: 481px;&quot;&gt;
 &lt;tbody&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-style: solid none solid solid; border-width: 1pt medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;shopName&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: solid none solid solid; border-width: 1pt medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;typeName&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border: 1pt solid black; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;entryDate&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;AVN&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;hotel&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none solid solid; border-width: medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;03/16/12 12:05 AM&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;AKN&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;hotel&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none solid solid; border-width: medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;03/16/12 12:10 AM&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;Reliance m&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;M.market&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none solid solid; border-width: medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;03/16/12 12:15 AM&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;tr&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;Standard&quot; style=&quot;line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;Animal TXT&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none none solid solid; border-width: medium medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;textile&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
  &lt;td style=&quot;border-style: none solid solid; border-width: medium 1pt 1pt; padding: 2.75pt; width: 160.6pt;&quot; valign=&quot;top&quot; width=&quot;214&quot;&gt;&lt;div class=&quot;TableContents&quot; style=&quot;margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;03/16/12 12:20 AM&lt;/span&gt;&lt;/div&gt;
&lt;/td&gt;
 &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;So we can see that now 3 column have
different names &#39;&lt;b&gt;shopName&lt;/b&gt;&#39; and &#39;&lt;b&gt;typeName&lt;/b&gt;&#39;,&lt;b&gt;entryDate&lt;/b&gt;
respectively. Use this names for creating variable for class `&lt;b&gt;ShopView&lt;/b&gt;`
.Now we can create our custom entity class .&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;u&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;Created Class&lt;/span&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;public class ShopView {&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
private String shopName;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
private String typeName;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
private Date&amp;nbsp; entryDate&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
public String getShopName () {&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return shopName;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
public void setShopName(String shopName) {&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this. shopName = shopName;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
public String get TypeName () {&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return typeName;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
public void setTypeName (String typeName) {&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this. typeName = typeName;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
public Date getEntryDate() {&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return entryDate;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
public void setEntryDate(Date entryDate) {&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.entryDate = entryDate;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;}&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;ShopView&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt; is our new custom entity class for
mapping our result.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;For mapping our result to our newly
created class we need to&amp;nbsp; use&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;query.setResultTransformer(Transformers.aliasToBean(ClassName.class));&lt;/span&gt;
&lt;/b&gt;method&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;For our Example we can use like this.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;Sql =&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;&quot;&lt;b&gt;SELECT s.`name` as
shopName,st.name as typeName,s.entry_date as entryDate&lt;u&gt; &lt;/u&gt;&amp;nbsp;FROM shop s JOIN shop_type st ON(s.type_id =
st.shop_type_id)&quot;;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;SQLQuery query =
session.createSQLQuery(sql);&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;query.setResultTransformer(Transformers.aliasToBean(ShopView
.class));&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; line-height: 150%;&quot;&gt;pager.setResult(query.list());&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%; margin-left: 8.25pt;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;A ResultTransformer is a nice and
simple interface that allows you to transform any Criteria result element.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;&amp;nbsp; The above query will
return a list which has been instantiated and injected&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;&amp;nbsp; into its
corresponding properties or fields in ShopView&lt;b&gt; &lt;/b&gt;class.&amp;nbsp;&amp;nbsp; Using this way we can&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;&amp;nbsp; map our result into
any class. This way is&amp;nbsp; suitable in&amp;nbsp;&amp;nbsp; case of sql views. Means we&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;&amp;nbsp; can create custom
view entities for our needs.&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&amp;nbsp; &lt;u&gt;Use this object in
velocity page example.&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;Assume that&amp;nbsp; we passed&amp;nbsp;
the result&amp;nbsp; to velocity and we set
the name as `shopDetailsList`&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;&amp;nbsp; then&amp;nbsp; we can use the list&amp;nbsp; in velocity as&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;#foreach($shopObj in
$shopDetailsList)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%;&quot;&gt;
&lt;span style=&quot;background-color: #6fa8dc; font-size: small; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $ shopObj
.shopName&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%;&quot;&gt;
&lt;span style=&quot;background-color: #6fa8dc; font-size: small; line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $ shopObj
.typeName&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%;&quot;&gt;
&lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;line-height: 150%;&quot;&gt;&amp;nbsp;&amp;nbsp; #&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small; line-height: 150%;&quot;&gt;end&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;Standard&quot; style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; line-height: 150%;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://clickmyprogram.blogspot.com/feeds/6307963981890733112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://clickmyprogram.blogspot.com/2012/05/custom-entity-creation-in-hibernate.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2421921122565523879/posts/default/6307963981890733112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2421921122565523879/posts/default/6307963981890733112'/><link rel='alternate' type='text/html' href='http://clickmyprogram.blogspot.com/2012/05/custom-entity-creation-in-hibernate.html' title='Custom Entity Creation in Hibernate'/><author><name>Kutti Master</name><uri>http://www.blogger.com/profile/04158320455119383243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIh8FUlLsBhS6S8vzuljG2G7fJlw3r6aIx4E5a0IRLZxszN9Mp5quxZR92JoImYLxe0sVQ3ldC6cgZ1FIAzoG6-bsldfq7LQr1WA-riFiunXflb6Mr2HWZxLNzYX-wOQY/s220/Rahul%27s+pics0147.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2421921122565523879.post-7828866872551403737</id><published>2011-07-18T15:23:00.003+05:30</published><updated>2012-06-28T10:25:09.989+05:30</updated><title type='text'>How to add label icon in to our Swing List box</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;How to add label icon in to our Swing Jlist box&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;----------------------------------------------------&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Steps.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;-----&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;1.create a class(here OnlineUserCellRenderer) and implement ListCellRenderer.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;i&gt;&amp;nbsp; class OnlineUserCellRenderer extends JLabel implements&amp;nbsp;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;i&gt;&amp;nbsp; ListCellRenderer {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private final Color HIGHLIGHT_COLOR = new Color(0, 0, 128);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public OnlineUserCellRenderer() {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setOpaque(true);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setIconTextGap(12);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public Component getListCellRendererComponent(JList list, Object value,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int index, boolean isSelected, boolean cellHasFocus) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TestImageList entry = (TestImageList) value;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setText(entry.getUser());&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (entry.getImage() != null) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setIcon(entry.getImage());&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setIconTextGap(12);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (isSelected) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setBackground(HIGHLIGHT_COLOR);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setForeground(Color.white);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setBackground(Color.white);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; setForeground(Color.black);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return this;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;2. Then create a TestImageList class.This class is used to set&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp; properties for label.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; class TestImageList {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private final String Name;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private ImageIcon image;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public TestImageList(String Name, ImageIcon image) {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.Name = Name;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.image = image;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public String getName() {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return Name;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public ImageIcon getImage() {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return image;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Override standard toString method to give a useful result&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public String toString() {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return Name;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;3.&amp;nbsp; Declare DefaultListModel object for inserting data in to jlist&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp; &amp;nbsp; box in our class import javax.swing.DefaultListModel.and&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; declare a object for DefaultListModel.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public DefaultListModel model = new DefaultListModel();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;4.&amp;nbsp; Then add elements in to our DefaultListModel for insert it in&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp; &amp;nbsp; to swing jList box.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; model.add(comboCount, new OnlineUserListEntry(Name, newIcon));&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; lstChatlist.setModel(model);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; OnlineUserCellRenderer labelUser = new OnlineUserCellRenderer();&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; lstChatlist.setCellRenderer(labelName);&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://clickmyprogram.blogspot.com/feeds/7828866872551403737/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://clickmyprogram.blogspot.com/2011/07/how-to-add-label-icon-in-to-our-swing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2421921122565523879/posts/default/7828866872551403737'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2421921122565523879/posts/default/7828866872551403737'/><link rel='alternate' type='text/html' href='http://clickmyprogram.blogspot.com/2011/07/how-to-add-label-icon-in-to-our-swing.html' title='How to add label icon in to our Swing List box'/><author><name>Kutti Master</name><uri>http://www.blogger.com/profile/04158320455119383243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIh8FUlLsBhS6S8vzuljG2G7fJlw3r6aIx4E5a0IRLZxszN9Mp5quxZR92JoImYLxe0sVQ3ldC6cgZ1FIAzoG6-bsldfq7LQr1WA-riFiunXflb6Mr2HWZxLNzYX-wOQY/s220/Rahul%27s+pics0147.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2421921122565523879.post-6259743969022208908</id><published>2011-07-18T15:21:00.001+05:30</published><updated>2012-06-30T21:32:30.551+05:30</updated><title type='text'>How to resize image using java.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;



&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;How to resize image using java.&lt;/span&gt;&lt;/h2&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;strong&gt;Steps&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;1. Import useful libraries in to our class.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; here we need &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;&lt;span style=&quot;background-color: #6fa8dc; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; import java.awt.image.BufferedImage;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; import javax.swing.Icon;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; import javax.swing.ImageIcon;&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;2. Then we need to create a function ie &#39;imageIconResize&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;for resizing the image.and we need to pass some parameters in to&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; that function&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;here is the function.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: small;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;&amp;nbsp; public BufferedImage imageIconResize(Image img,int postionX,int&amp;nbsp; &lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #6fa8dc; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: small;&quot;&gt;&lt;b&gt;&lt;i&gt;&amp;nbsp; postionY, int width, int hight) &lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: #6fa8dc; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: small;&quot;&gt;&lt;b&gt;&lt;i&gt;&amp;nbsp; {&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: small;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;
&amp;nbsp; BufferedImage bi = new BufferedImage(img.getWidth(null), &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;&amp;nbsp; img.getHeight(null),&amp;nbsp; BufferedImage.SCALE_FAST);&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;background-color: #6fa8dc; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: small;&quot;&gt;&lt;b&gt;&lt;i&gt;&amp;nbsp; Graphics g = bi.createGraphics();&lt;br /&gt;
&amp;nbsp; g.drawImage(img, postionX, postionY, width, hight, null, null);&lt;br /&gt;
&amp;nbsp; return bi;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace; font-size: small;&quot;&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;
&amp;nbsp; }&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;3.&amp;nbsp;Then pass the parameters in to our function. for that we must &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;have a image.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;In my example i have byte array of image.then convert it to &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; ImageIcon.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;ie&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;&amp;nbsp;&amp;nbsp;iconImage = new ImageIcon(bytes);&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;I use getImage() function for get image from icon object.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: #6fa8dc; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;i&gt;&lt;span style=&quot;background-color: #6fa8dc; font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;iconImage = new ImageIcon(bytes);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Image img = iconImage.getImage();&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;4.&amp;nbsp;So we have a image&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt; then we call the function it return a &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;BufferedImage object.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;we need to convert it to ImageIcon.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&lt;span style=&quot;background-color: #6fa8dc;&quot;&gt;&amp;nbsp;BufferedImage&lt;/span&gt;&lt;span style=&quot;background-color: #6fa8dc;&quot;&gt; imageIconResize = imageIconResize(img,10,15, 50, 50);&lt;br /&gt;
&amp;nbsp;ImageIcon newIcon = new ImageIcon(imageIconResize);&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;5.&amp;nbsp;Changing the value of parameters will change the size of the&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; image.&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://clickmyprogram.blogspot.com/feeds/6259743969022208908/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://clickmyprogram.blogspot.com/2011/07/how-to-re-size-image-using-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2421921122565523879/posts/default/6259743969022208908'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2421921122565523879/posts/default/6259743969022208908'/><link rel='alternate' type='text/html' href='http://clickmyprogram.blogspot.com/2011/07/how-to-re-size-image-using-java.html' title='How to resize image using java.'/><author><name>Kutti Master</name><uri>http://www.blogger.com/profile/04158320455119383243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIh8FUlLsBhS6S8vzuljG2G7fJlw3r6aIx4E5a0IRLZxszN9Mp5quxZR92JoImYLxe0sVQ3ldC6cgZ1FIAzoG6-bsldfq7LQr1WA-riFiunXflb6Mr2HWZxLNzYX-wOQY/s220/Rahul%27s+pics0147.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2421921122565523879.post-658381429127619671</id><published>2011-05-26T16:08:00.001+05:30</published><updated>2012-06-28T10:26:22.245+05:30</updated><title type='text'>File upload using spring framework</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: left;&quot;&gt;
&lt;u&gt;&lt;b&gt;Upload file using spring framework&lt;/b&gt;&lt;/u&gt;&lt;/h2&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;how to upload file using spring.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Upload a file using spring framework is easy.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;first of all we must import the required spring classes(that are given below).&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;To upload file using spring framework we must import &#39;MultipartHttpServletRequest&#39; and &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&#39;MultipartFile&#39; in to our project.to deal with multi part content in a servelet request we must include&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;MultipartHttpServletRequest interface. MultipartFile interface is used to store file that are comming with&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Multipart HttpServlet Request. Here when the user click the &#39;Upload Doc&#39; button the corresponding handler function&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;works in this case &#39;upLoadHandler()&#39; and the function mapp the request(@RequestMapping(value = &quot;/fileupload.do&quot;, method =&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;RequestMethod.POST)).Then corresponding code executed.after uploading the file server redirect the request to upload page&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;again.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;package fileUpload.document;&lt;br /&gt;
&lt;br /&gt;
import org.springframework.beans.factory.annotation.Autowired;&lt;br /&gt;
import org.springframework.stereotype.Controller;&lt;br /&gt;
import org.springframework.web.bind.annotation.RequestMapping;&lt;br /&gt;
import org.springframework.web.bind.annotation.RequestMethod;&lt;br /&gt;
import java.io.File;&lt;br /&gt;
import javax.servlet.http.HttpServletRequest;&lt;br /&gt;
import javax.servlet.http.HttpServletResponse;&lt;br /&gt;
import org.springframework.web.multipart.MultipartFile;&lt;br /&gt;
import org.springframework.web.multipart.MultipartHttpServletRequest;&lt;br /&gt;
import org.springframework.web.servlet.ModelAndView;&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;@Controller&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;public class UploadController {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ModelAndView mav;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;//location where to upload file&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private static final String destinationDir = &quot;/mnt/disk1/uploads/&quot;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @RequestMapping(value = &quot;/upload.do&quot;, method = RequestMethod.GET)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public String uploadPage()&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &quot;document/upPage&quot;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @RequestMapping(value = &quot;/fileupload.do&quot;, method = RequestMethod.POST)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public String upLoadHandler(HttpServletRequest req,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; HttpServletResponse res) throws Exception {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; res.setContentType(&quot;text/plain&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!(req instanceof MultipartHttpServletRequest)) {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; res.sendError(HttpServletResponse.SC_BAD_REQUEST, &quot;Expected multipart request&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return null;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) req;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //here &quot;fileUploaded&quot; is the name of the html file upload tag in the web page&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MultipartFile file = multipartRequest.getFile(&quot;fileUploaded&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; File destination = new File(destinationDir + file.getOriginalFilename());&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file.transferTo(destination);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &quot;redirect:upload.do&quot;;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2 style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: left;&quot;&gt;
&lt;u&gt;&lt;b&gt;file uploading html&lt;/b&gt;&lt;/u&gt;&lt;/h2&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;this is the html page for uploading file in to server.only required part of the html&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;is given.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;here we can see that the method is POST and encryption type is&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;multipart/form-data&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;lt;form method=&quot;post&quot; action=&quot;/fileupload.do&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;input type=&quot;file&quot; name=&quot;fileUploaded&quot; /&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;input type=&quot;submit&quot; value=&quot;Upload Doc&quot;/&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/form&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;before writing the code we must include multi part resolver bean in our application-context.xml file&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;lt;!-- Configure the multipart resolver --&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;lt;bean id=&quot;multipartResolver&quot; class=&quot;org.springframework.web.multipart.commons.CommonsMultipartResolver&quot;&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;lt;!-- one of the properties available; the maximum file size in bytes --&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;lt;property name=&quot;maxUploadSize&quot; value=&quot;100000&quot;/&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;lt;/bean&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://clickmyprogram.blogspot.com/feeds/658381429127619671/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://clickmyprogram.blogspot.com/2011/05/file-upload-using-spring-framework.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2421921122565523879/posts/default/658381429127619671'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2421921122565523879/posts/default/658381429127619671'/><link rel='alternate' type='text/html' href='http://clickmyprogram.blogspot.com/2011/05/file-upload-using-spring-framework.html' title='File upload using spring framework'/><author><name>Kutti Master</name><uri>http://www.blogger.com/profile/04158320455119383243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIh8FUlLsBhS6S8vzuljG2G7fJlw3r6aIx4E5a0IRLZxszN9Mp5quxZR92JoImYLxe0sVQ3ldC6cgZ1FIAzoG6-bsldfq7LQr1WA-riFiunXflb6Mr2HWZxLNzYX-wOQY/s220/Rahul%27s+pics0147.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2421921122565523879.post-4355790300149358333</id><published>2011-05-19T18:11:00.001+05:30</published><updated>2012-06-28T10:26:53.938+05:30</updated><title type='text'>how to make Entity classes using Hibernate mapping file and POJO from Database?</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;How to make entity classes using hibernate mapping file and POJO from Database.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Step by step way is given below.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;using net beans you can done it easily &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;u&gt;With NetBeans.&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;assuming that we created a new project named &#39;HBN_Test&#39;.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;then add hibernate and spring framework file to our project.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;u&gt;&lt;b&gt;Making hibernate configuration wizard file&lt;/b&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;then we need to configure hibernate configuration file in to our program&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;1.&lt;/b&gt;Right click the project then in the &#39;new&#39; option select &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;hibernate configuration wizard option.it will open a new window.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;2.&lt;/b&gt;Then click next and select appropriate database connection and &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;and we can see that database dialect is&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&#39;org.hibernate.dialect.MySQLDialect&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;3.&lt;/b&gt;click finish button&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;this fill connect hibernate with our database&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;then&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;u&gt;&lt;b&gt;Making hibernate reverse engineering wizard file&lt;/b&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;1.&lt;/b&gt;Right click the project then in the &#39;new&#39; option select &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;hibernate reverse engineering wizard option.it will open a new window&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;2.&lt;/b&gt;click next then we can see the tables in our data base select wanted tables check if  we want to include related tables(forigen  key referance tables)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;3.&lt;/b&gt;click finish button.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;this fill connect hibernate with our selected tables &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;then&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;u&gt;&lt;b&gt;Making hibernate mapping file and pojo from database&lt;/b&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;1.&lt;/b&gt;Right click the project then in the &#39;new&#39; option select &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;hibernate mapping file and pojo from database option.it will open  a new window &lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;2.&lt;/b&gt;select our hibernate configuration file(hibernate.cfg.xml) and also hibernate    reverse engineering wizard(hibernate.reveng.xml)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;3.&lt;/b&gt;In general setting section select jdk 5 language features and EJB 3&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;annotation if we want.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;4.&lt;/b&gt;then select appropriate package to import our entity classes.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;5.&lt;/b&gt;then click finish button.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;6.&lt;/b&gt;this will makes entity classes for our tables in the database.&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://clickmyprogram.blogspot.com/feeds/4355790300149358333/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://clickmyprogram.blogspot.com/2011/05/how-to-make-entity-classes-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2421921122565523879/posts/default/4355790300149358333'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2421921122565523879/posts/default/4355790300149358333'/><link rel='alternate' type='text/html' href='http://clickmyprogram.blogspot.com/2011/05/how-to-make-entity-classes-using.html' title='how to make Entity classes using Hibernate mapping file and POJO from Database?'/><author><name>Kutti Master</name><uri>http://www.blogger.com/profile/04158320455119383243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIh8FUlLsBhS6S8vzuljG2G7fJlw3r6aIx4E5a0IRLZxszN9Mp5quxZR92JoImYLxe0sVQ3ldC6cgZ1FIAzoG6-bsldfq7LQr1WA-riFiunXflb6Mr2HWZxLNzYX-wOQY/s220/Rahul%27s+pics0147.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2421921122565523879.post-8389468575049136752</id><published>2011-03-03T18:53:00.005+05:30</published><updated>2012-06-30T21:39:40.806+05:30</updated><title type='text'>chat program using java</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: left;&quot;&gt;

Chatting program using Google account&lt;/h2&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Before using this program you need to download the following jar &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;files &lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;and include this jar files in to your application libraries.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;here we are making a sample chat program for Google.&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;with this exmaple you can chat with the person who is online.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;i&gt;&lt;span style=&quot;background-color: #93c47d;&quot;&gt;1.smack.jar&lt;br /&gt;
2.smackx-debug.jar&lt;br /&gt;
3.smackx-jingle.jar&lt;br /&gt;
4.smackx.jar&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;package ChatTest;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;br /&gt;&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;import java.util.*;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;import java.io.*;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;import org.jivesoftware.smack.Chat;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;import org.jivesoftware.smack.ConnectionConfiguration;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;import org.jivesoftware.smack.MessageListener;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;import org.jivesoftware.smack.Roster;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;import org.jivesoftware.smack.RosterEntry;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;import org.jivesoftware.smack.SASLAuthentication;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;import org.jivesoftware.smack.XMPPConnection;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;import org.jivesoftware.smack.XMPPException;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;import org.jivesoftware.smack.packet.Message;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;br /&gt;&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;public class ChatTest implements MessageListener {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;br /&gt;&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;XMPPConnection connection;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;public String[] ids;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;br /&gt;&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;public void login(String userName, String password) throws XMPPException {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;ConnectionConfiguration config = new ConnectionConfiguration(&quot;talk.google.com&quot;, 5222, &quot;gmail.com&quot;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;config.setSASLAuthenticationEnabled(false);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;connection = new XMPPConnection(config);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;try {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;connection.connect();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;SASLAuthentication.supportSASLMechanism(&quot;PLAIN&quot;, 0);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;connection.login(userName, password);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;System.out.println(connection.isAuthenticated());&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;} catch (Exception e) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;System.out.println(e);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;System.exit(0);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;br /&gt;&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;br /&gt;&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;public void sendMessage(String message, String to) throws XMPPException {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;Chat chat = connection.getChatManager().createChat(to, this);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;chat.sendMessage(message);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;br /&gt;&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;
&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;public void displayBuddyList() {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;Roster roster = connection.getRoster();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt;Collection&lt;/span&gt;&lt;rosterentry&gt;&lt;span style=&quot;background-color: #d0e0e3; font-size: x-small;&quot;&gt; entries = roster.getEntries();&lt;br /&gt;
System.out.println(&quot;\n\n&quot; + entries.size() + &quot; buddy(ies):&quot;);&lt;br /&gt;
for (RosterEntry r : entries) {&lt;br /&gt;
&lt;br /&gt;
System.out.println(r.getUser());&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public void disconnect() {&lt;br /&gt;
connection.disconnect();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public void processMessage(Chat chat, Message message) {&lt;br /&gt;
if (message.getType() == Message.Type.chat) {&lt;br /&gt;
System.out.println(chat.getParticipant() + &quot; says: &quot; + message.getBody());&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
public static void main(String args[]) throws XMPPException, IOException {&lt;br /&gt;
&lt;b&gt; // declare variables&lt;/b&gt;&lt;br /&gt;
ChatTest c = new ChatTest();&lt;br /&gt;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));&lt;br /&gt;
String msg;&lt;br /&gt;
DataInputStream input = new DataInputStream(System.in);&lt;br /&gt;
// turn on the enhanced debugger&lt;br /&gt;
XMPPConnection.DEBUG_ENABLED = true;&lt;br /&gt;
try {&lt;br /&gt;
&lt;b&gt; // Enter your login information here&lt;/b&gt;&lt;br /&gt;
System.out.println(&quot;Enter Your gmail id&quot;);&lt;br /&gt;
String userId = input.readLine();&lt;br /&gt;
System.out.println(&quot;Password :&quot;);&lt;br /&gt;
String password = input.readLine();&lt;br /&gt;
userId = userId.replaceAll(&quot;@gmail.com&quot;, &quot;&quot;);&lt;br /&gt;
c.login(userId, password);&lt;br /&gt;
System.out.println(&quot;-----&quot;);&lt;br /&gt;
c.displayBuddyList();&lt;br /&gt;
&lt;br /&gt;
System.out.println(&quot;-----&quot;);&lt;br /&gt;
&lt;br /&gt;
System.out.println(&quot;Who do you want to talk to? - Type contacts full email address:&quot;);&lt;br /&gt;
String talkTo = br.readLine();&lt;br /&gt;
&lt;br /&gt;
System.out.println(&quot;-----&quot;);&lt;br /&gt;
&lt;br /&gt;
System.out.println(&quot;All messages will be sent to &quot; + talkTo);&lt;br /&gt;
System.out.println(&quot;Enter your message in the console:&quot;);&lt;br /&gt;
System.out.println(&quot;-----\n&quot;);&lt;br /&gt;
&lt;br /&gt;
while (!(msg = br.readLine()).equals(&quot;bye&quot;)) {&lt;br /&gt;
c.sendMessage(msg, talkTo);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
c.disconnect();&lt;br /&gt;
System.exit(0);&lt;br /&gt;
} catch (Exception e) {&lt;br /&gt;
System.out.println(&quot;Sorry Failed&quot;);&lt;br /&gt;
System.exit(0);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;/span&gt;&lt;/rosterentry&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;rosterentry&gt;using this chat program.you can chat with one person at a time. &lt;/rosterentry&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://clickmyprogram.blogspot.com/feeds/8389468575049136752/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://clickmyprogram.blogspot.com/2011/03/chat-program.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2421921122565523879/posts/default/8389468575049136752'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2421921122565523879/posts/default/8389468575049136752'/><link rel='alternate' type='text/html' href='http://clickmyprogram.blogspot.com/2011/03/chat-program.html' title='chat program using java'/><author><name>Kutti Master</name><uri>http://www.blogger.com/profile/04158320455119383243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIh8FUlLsBhS6S8vzuljG2G7fJlw3r6aIx4E5a0IRLZxszN9Mp5quxZR92JoImYLxe0sVQ3ldC6cgZ1FIAzoG6-bsldfq7LQr1WA-riFiunXflb6Mr2HWZxLNzYX-wOQY/s220/Rahul%27s+pics0147.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2421921122565523879.post-8031138419459360213</id><published>2011-03-03T10:56:00.039+05:30</published><updated>2012-06-28T10:27:39.700+05:30</updated><title type='text'>Sending mail using java program</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
Chatting program using Google talk account&lt;/h2&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Before using this program you need to download the following jar files&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;and include this jar files in to your application libraries.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;here we are making a sample chat program for Google.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;with this exmaple you can chat with the person who is online.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;1.smack.jar&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;2.smackx-debug.jar&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;3.smackx-jingle.jar&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;4.smackx.jar&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;package ChatTest;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;import java.util.*;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;import java.io.*;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;import org.jivesoftware.smack.Chat;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;import org.jivesoftware.smack.ConnectionConfiguration;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;import org.jivesoftware.smack.MessageListener;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;import org.jivesoftware.smack.Roster;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;import org.jivesoftware.smack.RosterEntry;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;import org.jivesoftware.smack.SASLAuthentication;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;import org.jivesoftware.smack.XMPPConnection;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;import org.jivesoftware.smack.XMPPException;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;import org.jivesoftware.smack.packet.Message;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;public class ChatTest implements MessageListener {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;XMPPConnection connection;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;public String[] ids;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;public void login(String userName, String password) throws XMPPException {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;ConnectionConfiguration config = new ConnectionConfiguration(&quot;talk.google.com&quot;, 5222, &quot;gmail.com&quot;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;config.setSASLAuthenticationEnabled(false);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;connection = new XMPPConnection(config);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;try {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;connection.connect();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;SASLAuthentication.supportSASLMechanism(&quot;PLAIN&quot;, 0);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;connection.login(userName, password);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;System.out.println(connection.isAuthenticated());&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;} catch (Exception e) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;System.out.println(e);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;System.exit(0);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;public void sendMessage(String message, String to) throws XMPPException {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Chat chat = connection.getChatManager().createChat(to, this);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;chat.sendMessage(message);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;public void displayBuddyList() {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Roster roster = connection.getRoster();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;Collection entries = roster.getEntries();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;System.out.println(&quot;\n\n&quot; + entries.size() + &quot; buddy(ies):&quot;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;for (RosterEntry r : entries) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;System.out.println(r.getUser());&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;public void disconnect() {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;connection.disconnect();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;public void processMessage(Chat chat, Message message) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;if (message.getType() == Message.Type.chat) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;System.out.println(chat.getParticipant() + &quot; says: &quot; + message.getBody());&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;public static void main(String args[]) throws XMPPException, IOException {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;// declare variables&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;ChatTest c = new ChatTest();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;BufferedReader br = new BufferedReader(new InputStreamReader(System.in));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;String msg;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;DataInputStream input = new DataInputStream(System.in);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;// turn on the enhanced debugger&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;XMPPConnection.DEBUG_ENABLED = true;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;try {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;// Enter your login information here&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;System.out.println(&quot;Enter Your gmail id&quot;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;String userId = input.readLine();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;System.out.println(&quot;Password :&quot;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;String password = input.readLine();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;userId = userId.replaceAll(&quot;@gmail.com&quot;, &quot;&quot;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;c.login(userId, password);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;System.out.println(&quot;-----&quot;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;c.displayBuddyList();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;System.out.println(&quot;-----&quot;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;System.out.println(&quot;Who do you want to talk to? - Type contacts full email address:&quot;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;String talkTo = br.readLine();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;System.out.println(&quot;-----&quot;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;System.out.println(&quot;All messages will be sent to &quot; + talkTo);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;System.out.println(&quot;Enter your message in the console:&quot;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;System.out.println(&quot;-----\n&quot;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;while (!(msg = br.readLine()).equals(&quot;bye&quot;)) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;c.sendMessage(msg, talkTo);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
c.disconnect();&lt;br /&gt;
System.exit(0);&lt;br /&gt;
} catch (Exception e) {&lt;br /&gt;
System.out.println(&quot;Sorry Failed&quot;);&lt;br /&gt;
System.exit(0);&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
using this chat program.you can chat with one person at a time.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://clickmyprogram.blogspot.com/feeds/8031138419459360213/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://clickmyprogram.blogspot.com/2011/03/sending-mail.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2421921122565523879/posts/default/8031138419459360213'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2421921122565523879/posts/default/8031138419459360213'/><link rel='alternate' type='text/html' href='http://clickmyprogram.blogspot.com/2011/03/sending-mail.html' title='Sending mail using java program'/><author><name>Kutti Master</name><uri>http://www.blogger.com/profile/04158320455119383243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIh8FUlLsBhS6S8vzuljG2G7fJlw3r6aIx4E5a0IRLZxszN9Mp5quxZR92JoImYLxe0sVQ3ldC6cgZ1FIAzoG6-bsldfq7LQr1WA-riFiunXflb6Mr2HWZxLNzYX-wOQY/s220/Rahul%27s+pics0147.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2421921122565523879.post-3175200640827014190</id><published>2011-02-18T15:46:00.005+05:30</published><updated>2012-06-28T10:28:06.009+05:30</updated><title type='text'>Generate mySql Script</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
 
&lt;/script&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
 
&lt;/script&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
 
&lt;/script&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
  var _gaq = _gaq || [];
  _gaq.push([&#39;_setAccount&#39;, &#39;UA-21578180-1&#39;]);
  _gaq.push([&#39;_trackPageview&#39;]);

  (function() {
    var ga = document.createElement(&#39;script&#39;); ga.type = &#39;text/javascript&#39;; ga.async = true;
    ga.src = (&#39;https:&#39; == document.location.protocol ? &#39;https://ssl&#39; : &#39;http://www&#39;) + &#39;.google-analytics.com/ga.js&#39;;
    var s = document.getElementsByTagName(&#39;script&#39;)[0]; s.parentNode.insertBefore(ga, s);
  })();
&lt;/script&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2 style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: left;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;u&gt;&lt;b&gt;I am using Linux Ubuntu 10.x Os&lt;/b&gt;&lt;/u&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;1.Open &#39;MySql Workbench 5.2.31&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;2.Select your Default Database&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;3.Select &#39;Database&#39; option In menu bar&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;4.Then Select &#39;Reverse Engineer&#39; or press &#39;ctrl+R&#39;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;5.It Will Open A &#39;model&#39; Window Dont Close it&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;6.Then select &#39;File&#39; option in menu bar&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;7.Select &#39;Export&#39; then Select &#39;Forward Engineer Sql Create Script &#39; option&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp; /Ctrl+Shift+G it Will open a new Window&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;8.Click &#39;Browse&#39; Window Save Your File As &#39;.sql&#39; Extension&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;9.Then Tick Wanted Options In that Window then Click &#39;Next&#39; button&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;10.Then Tick wanted Options.This will import wanted tables into sql Script&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; You can Select Views as well as Triggers&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;11.Then Click &#39;Next&#39; Button(you Can see Generated Sql Script)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;12.Click &#39;Finish&#39;...Its Done!!!&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://clickmyprogram.blogspot.com/feeds/3175200640827014190/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://clickmyprogram.blogspot.com/2011/02/how-to-create-sql-script-using-mysql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2421921122565523879/posts/default/3175200640827014190'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2421921122565523879/posts/default/3175200640827014190'/><link rel='alternate' type='text/html' href='http://clickmyprogram.blogspot.com/2011/02/how-to-create-sql-script-using-mysql.html' title='Generate mySql Script'/><author><name>Kutti Master</name><uri>http://www.blogger.com/profile/04158320455119383243</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIh8FUlLsBhS6S8vzuljG2G7fJlw3r6aIx4E5a0IRLZxszN9Mp5quxZR92JoImYLxe0sVQ3ldC6cgZ1FIAzoG6-bsldfq7LQr1WA-riFiunXflb6Mr2HWZxLNzYX-wOQY/s220/Rahul%27s+pics0147.jpg'/></author><thr:total>0</thr:total></entry></feed>