Thursday, December 5, 2013

JDBC vs Hibernate

JDBC 
Hibernate 
With JDBC, developer has to write code to map an object model's data representation to a relational data model and its corresponding database schema.  
Hibernate is flexible and powerful ORM solution to map Java classes to database tables. Hibernate itself takes care of this mapping using XML files so developer does not need to write code for this. 
With JDBC, the automatic mapping of Java objects with database tables and vice versa conversion is to be taken care of by the developer manually with lines of code.  
Hibernate provides transparent persistence and developer does not need to write code explicitly to map database tables tuples to application objects during interaction with RDBMS.  
JDBC supports only native Structured Query Language (SQL). Developer has to find out the efficient way to access database, i.e. to select effective query from a number of queries to perform same task.  
Hibernate provides a powerful query language Hibernate Query Language (independent from type of database) that is expressed in a familiar SQL like syntax and includes full support for polymorphic queries. Hibernate also supports native SQL statements. It also selects an effective way to perform a database manipulation task for an application.  
Application using JDBC to handle persistent data (database tables) having database specific code in large amount. The code written to map table data to application objects and vice versa is actually to map table fields to object properties. As table changed or database changed then it’s essential to change object structure as well as to change code written to map table-to-object/object-to-table. 
Hibernate provides this mapping itself. The actual mapping between tables and application objects is done in XML files. If there is change in Database or in any table then the only need to change XML file properties.  
With JDBC, it is developer’s responsibility to handle JDBC result set and convert it to Java objects through code to use this persistent data in application. So with JDBC, mapping between Java objects and database tables is done manually.  
Hibernate reduces lines of code by maintaining object-table mapping itself and returns result to application in form of Java objects. It relieves programmer from manual handling of persistent data, hence reducing the development time and maintenance cost.  
With JDBC, caching is maintained by hand-coding.  
Hibernate, with Transparent Persistence, cache is set to application work space. Relational tuples are moved to this cache as a result of query. It improves performance if client application reads same data many times for same write. Automatic Transparent Persistence allows the developer to concentrate more on business logic rather than this application code.  
In JDBC there is no check that always every user has updated data. This check has to be added by the developer.  
Hibernate enables developer to define version type field to application, due to this defined field Hibernate updates version field of database table every time relational tuple is updated in form of Java class object to that table. So if two users retrieve same tuple and then modify it and one user save this modified tuple to database, version is automatically updated for this tuple by Hibernate. When other user tries to save updated tuple to database then it does not allow saving it because this user does not have updated data.  

Wednesday, August 7, 2013

JOBS AT INFOSYS

Hi All, 

Jobs in Infosys - for below requirements - Please send your resumes at


SAMBAMCA06@GMAIL.COM 



Skill sets we are looking for:
·         Java / J2EE
·         SharePoint
·         Oracle Pl/Sql


Pre-requisites:

·         2 to 8 years of relevant experience in any of the above mentioned skills
·         Referrals must have excellent, consistent academic credentials and should be B.E / B.Tech /        M.C.A / M.Sc / M.E / M.Tech

Wednesday, May 29, 2013

differences between a genuine note and a forged note?


i) Security thread: Rs.10, Rs.20 and Rs.50 notes contain a readable but fully embedded security windowed security thread. Rs.100, Rs.500 and Rs.1000 notes contain a readable windowed security thread. This thread is partially exposed and partially embedded. When held against light, this thread can be seen as one continuous line. Other than on Rs.1000 notes, this thread contains the words 'Bharat' in the devnagri script and 'RBI' appearing alternately. The security thread of the Rs.1000 note contains the inscription 'Bharat' in the devnagri script, '1000' and 'RBI'. Notes issued earlier have a plain, non-readable fully embedded security thread. ii) Latent Image: A vertical band behind on the right side of the Mahatma Gandhi’s portrait, which contains a latent image, showing the denominational value 20, 50, 100, 500 or 1000 as the case may be. The value can be seen only when the note is held on the palm and light allowed to fall on it at 45° ; otherwise this feature appears only as a vertical band.

 iii) Microletterings: This feature appears between the vertical band and Mahatma Gandhi portrait. It contains the word ‘RBI’ in Rs.10. Notes of Rs.20 and above also contain the denominational value of the notes. This feature can be seen better under a magnifying glass.

iv) Identification mark: A special intaglio feature has been introduced on the left of the watermark window on all notes except Rs.10/- note. This feature is in different shapes for various denominations (Rs.20-Vertical Rectangle, Rs.50-Square, Rs.100-Triangle, Rs.500-Circle, Rs.1000-Diamond) and helps the visually impaired to identify the denomination.

v) Intaglio Printing: The portrait of Mahatma Gandhi, Reserve Bank seal, guarantee and promise clause, Ashoka Pillar Emblem on the left, RBI Governor's signature are printed in intaglio i.e. in raised prints in Rs.20, Rs.50, Rs.100, Rs.500 and Rs.1000 notes. vi) Fluorescence: The number panels of the notes are printed in fluorescent ink. The notes also have optical fibres. Both can be seen when the notes are exposed to ultra-violet lamp.

vii) Optically Variable Ink: The numeral 500 & 1000 on the Rs.500 [revised colour scheme of mild yellow, mauve and brown] and Rs.1000 notes are printed in Optically Variable Ink viz., a colour-shifting ink. The colour of these numerals appear green when the notes are held flat but would change to blue when the notes are held at an angle.
Forgeries How does one differentiate between a genuine note and a forged note?
The notes on which the above features are not available can be suspected as forged notes and examined minutely.

New 100 Rupee Coin


Thursday, May 23, 2013

How to print GC details into a file for your program?

 For your local program (for example - say you have written a standalone DOM xml parser or any memory intensive program on which you want to check GC*  usage).

In RAD (for IBM JVM) --> right click on the java class --> goto "Run As" --> goto "Run configurations" --> goto "Arguments" tab in the pop-up --> set the below under VM arguments

-Xverbosegclog:D:\Your_Path\Your_Sub_Path\jvm.log

On a Sun JVM:
  -Xloggc:C:\Your_Path\jvm.log -verbose:gc -XX:+PrintGCDateStamps
(if there are spaces in folder or file names, it will be interpreted as another VM argument)
Then Run your program. GC details will be logged in that file (jvm.log in this case)

* GC- Garbage Collector
Referene:

http://stackoverflow.com/questions/1161647/how-to-redirect-verbose-garbage-collection-output-to-a-file

JVM Architecture

The Java Virtual Machine (JVM) is an abstract computing machine. The JVM is a program that looks like a machine to the programs written to execute in it. This way, Java programs are written to the same set of interfaces and libraries. Each JVM implementation for a specific operating system, translates the Java programming instructions into instructions and commands that run on the local operating system. This way, Java programs achieve platform independence.
        The Java virtual machine knows nothing of the Java programming language, only of a particular binary format, the class file format. A class file contains Java virtual machine instructions (or bytecodes) and a symbol table, as well as other ancillary information.
For the sake of security, the Java virtual machine imposes strong syntactic and structural constraints on the code in a class file. However, any language with functionality that can be expressed in terms of a valid class file can be hosted by the Java virtual machine. Attracted by a generally available, machine-independent platform, implementors of other languages can turn to the Java virtual machine as a delivery vehicle for their languages.

 

Exploring the JVM Architecture

Hotspot Architecture

The HotSpot JVM possesses an architecture that supports a strong foundation of features and capabilities and supports the ability to realize high performance and massive scalability. For example, the HotSpot JVM JIT compilers generate dynamic optimizations. In other words, they make optimization decisions while the Java application is running and generate high-performing native machine instructions targeted for the underlying system architecture. In addition, through the maturing evolution and continuous engineering of its runtime environment and multithreaded garbage collector, the HotSpot JVM yields high scalability on even the largest available computer systems.

The main components of the JVM include the classloader, the runtime data areas, and the execution engine.

Key Hotspot Components

The key components of the JVM that relate to performance are highlighted in the following image.




There are three components of the JVM that are focused on when tuning performance. The heap is where your object data is stored. This area is then managed by the garbage collector selected at startup. Most tuning options relate to sizing the heap and choosing the most appropriate garbage collector for your situation. The JIT compiler also has a big impact on performance but rarely requires tuning with the newer versions of the JVM.

Tuesday, May 21, 2013

JVM Memory


•Eden Space (heap): The pool from which memory is initially allocated for most objects.
•Survivor Space (heap): The pool containing objects that have survived the garbage collection of the Eden space.
•Tenured Space (heap): The pool containing objects that have existed for some time in the survivor space.
•Perm Space (non-heap): The pool containing all the reflective data of the virtual machine itself, such as class and method objects. With Java VMs that use class data sharing, this generation is divided into read-only and read-write areas.
•Code Cache (non-heap): The HotSpot Java VM also includes a code cache, containing memory that is used for compilation and storage of native code.

Tuesday, May 14, 2013

Openings At Infosys

Pre-requisites:
       ·         Candidate must have good, consistent academics & should be B.E / B.Tech / M.C.A /   M.Sc / M.E / M.Tech.
       ·         Candidate must have 3 to 11 years of relevant experience.
       ·         Date of Birth, personal email id and contact number of the candidate should be updated in the resume.

         Please send resumes to: samba_mca06@gmail.com



Tracks
Skill Sets
Location
VLSI
Design and verification, DFT, Physical Design
Bangalore
Application Development
Java-J2EE, Struts, Hibernate
Bangalore, Trivandrum, Hyderabad
HTML5
Bangalore
C++ with Telecom domain
Bangalore, Trivandrum
.Net
Pune, Bangalore
MES
PI, LIMS, Simatic IT
Pune, Bangalore
Industrial Automation
Power controls, DCS configuration, .net, WPF
Mysore
Plant Engineering
CeasarII, PDMS, Piping
Mysore
Turbomachinery
Computational Fluid Dynamics-Fluent, CFX, Ansys ,
Aerodynamic & thermodynamic cycle, Calculations
Mysore

Design- Catia V4/5, Manufacturing
Mysore 
Stress
Aerospace-FEA: Hypermesh, Ansys, Abaqus, Patran, Nastran, Hand calculations
Mysore, Bangalore
Automotive- Crash, Safety, NVH, Durability, Interior CAE
Tools-Ansa, LS-DYNA, Nastran
Chennai

PLM
Windchill , FlexPLM, SAP PLM, Teamcenter, PDMS LICAD
Mysore, Bangalore, Hyderabad, Pune
Contact centre
Genesys Framework 7.x/8.x, Cisco IPCC, Avaya, Aura,Designing of Routing, Reporting, work force management( WFM), call/voice recorders
Chennai, Pune
POS
POS Domain :  Retail, Grocery, QSRPOS
Platforms : Windows POSReady,IBM SurePOS, Wincor,Epicor, Fujitsu Technology Platforms : VBScript, VB6,  VC++, C#, C, C++, SQL, Java
OS Customization : OSD, MDT, WAIK
OS Deployment : SCCM, PXE, WDS
Compliance and Regulations : PCI Compliance
Bangalore, Trivandrum
Embedded
Windows Drivers, Linux Device Drivers, Connectivity, Graphics and Audio, Multimedia frameworks, Embedded firmware
Bangalore, Hyderabad

Sunday, April 21, 2013

Access Specifiers and Access Modifiers

All the four access specifiers, Java supports, can be applied to variables – public,protecteddefault and private. If the specifier is not mentioned, it takes default access. A local variable must be default only.The two access specifiers a class can accept are public or defaultDefault means the specifier is not mentioned at all.

The list of modifiers are : public, protected,default,private,abstract,final, static.


Type Conversions in Java

This summary is not available. Please click here to view the post.

Saturday, March 23, 2013

JSP - Auto Page Refresh


Consider a webpage which is displaying live game score or stock market status or currency exchange ration. For all such type of pages, you would need to refresh your web page regularly using referesh or reload button with your browser.
JSP makes this job easy by providing you a mechanism where you can make a webpage in such a way that it would refresh automatically after a given interval.
The simplest way of refreshing a web page is using method setIntHeader() of response object. Following is the signature of this method:
public void setIntHeader(String header, int headerValue)
This method sends back header "Refresh" to the browser along with an integer value which indicates time interval in seconds.

Auto Page Refresh Example:

Following example would use setIntHeader() method to set Refresh header to simulate a digital clock:
<%@ page import="java.io.*,java.util.*" %>
<html>
<head>
<title>Auto Refresh Header Example</title>
</head>
<body>
<center>
<h2>Auto Refresh Header Example</h2>
<%
   // Set refresh, autoload time as 5 seconds
   response.setIntHeader("Refresh", 5);
   // Get current time
   Calendar calendar = new GregorianCalendar();
   String am_pm;
   int hour = calendar.get(Calendar.HOUR);
   int minute = calendar.get(Calendar.MINUTE);
   int second = calendar.get(Calendar.SECOND);
   if(calendar.get(Calendar.AM_PM) == 0)
      am_pm = "AM";
   else
      am_pm = "PM";
   String CT = hour+":"+ minute +":"+ second +" "+ am_pm;
   out.println("Crrent Time: " + CT + "\n");
%>
</center>
</body>
</html>

Monday, March 18, 2013

JSP - Implicit Objects


SP Implicit Objects are the Java objects that the JSP Container makes available to developers in each page and developer can call them directly without being explicitly declared. JSP Implicit Objects are also called pre-defined variables.
JSP supports nine Implicit Objects which are listed below:
ObjectDescription
requestThis is the HttpServletRequest object associated with the request.
responseThis is the HttpServletResponse object associated with the response to the client.
outThis is the PrintWriter object used to send output to the client.
sessionThis is the HttpSession object associated with the request.
applicationThis is the ServletContext object associated with application context.
configThis is the ServletConfig object associated with the page.
pageContextThis encapsulates use of server-specific features like higher performance JspWriters.
pageThis is simply a synonym for this, and is used to call the methods defined by the translated servlet class.
ExceptionThe Exception object allows the exception data to be accessed by designated JSP.
The request Object:
The request object is an instance of a javax.servlet.http.HttpServletRequest object. Each time a client requests a page the JSP engine creates a new object to represent that request.
The request object provides methods to get HTTP header information including form data, cookies, HTTP methods etc.

The response Object:

The response object is an instance of a javax.servlet.http.HttpServletResponse object. Just as the server creates the request object, it also creates an object to represent the response to the client.
The response object also defines the interfaces that deal with creating new HTTP headers. Through this object the JSP programmer can add new cookies or date stamps, HTTP status codes etc.

The out Object:

The out implicit object is an instance of a javax.servlet.jsp.JspWriter object and is used to send content in a response.
The initial JspWriter object is instantiated differently depending on whether the page is buffered or not. Buffering can be easily turned off by using the buffered='false' attribute of the page directive.
The JspWriter object contains most of the same methods as the java.io.PrintWriter class. However, JspWriter has some additional methods designed to deal with buffering. Unlike the PrintWriter object, JspWriter throws IOExceptions.
Following are the important methods which we would use to write boolean char, int, double, object, String etc.
MethodDescription
out.print(dataType dt)Print a data type value
out.println(dataType dt)Print a data type value then terminate the line with new line character.
out.flush()Flush the stream.
The session Object:
The session object is an instance of javax.servlet.http.HttpSession and behaves exactly the same way that session objects behave under Java Servlets.
The session object is used to track client session between client requests.
The application Object:
The application object is direct wrapper around the ServletContext object for the generated Servlet and in reality an instance of a javax.servlet.ServletContext object.
This object is a representation of the JSP page through its entire lifecycle. This object is created when the JSP page is initialized and will be removed when the JSP page is removed by the jspDestroy() method.
By adding an attribute to application, you can ensure that all JSP files that make up your web application have access to it.

The config Object:

The config object is an instantiation of javax.servlet.ServletConfig and is a direct wrapper around the ServletConfig object for the generated servlet.
This object allows the JSP programmer access to the Servlet or JSP engine initialization parameters such as the paths or file locations etc.
The following config method is the only one you might ever use, and its usage is trivial:
 
config.getServletName();
This returns the servlet name, which is the string contained in the <servlet-name> element defined in the WEB-INF\web.xml file
The pageContext Object:
The pageContext object is an instance of a javax.servlet.jsp.PageContext object. The pageContext object is used to represent the entire JSP page.
This object is intended as a means to access information about the page while avoiding most of the implementation details.
This object stores references to the request and response objects for each request. The application, config, session, and out objects are derived by accessing attributes of this object.
The pageContext object also contains information about the directives issued to the JSP page, including the buffering information, the errorPageURL, and page scope.
The PageContext class defines several fields, including PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, and APPLICATION_SCOPE, which identify the four scopes. It also supports more than 40 methods, about half of which are inherited from the javax.servlet.jsp. JspContext class.
One of the important methods is removeAttribute, which accepts either one or two arguments. For example, pageContext.removeAttribute ("attrName") removes the attribute from all scopes, while the following code only removes it from the page scope:
 
pageContext.removeAttribute("attrName", PAGE_SCOPE);

The page Object:

This object is an actual reference to the instance of the page. It can be thought of as an object that represents the entire JSP page.
The page object is really a direct synonym for the this object.
The exception Object:
The exception object is a wrapper containing the exception thrown from the previous page. It is typically used to generate an appropriate response to the error condition.