Skip to main content

Posts

Showing posts from November, 2013

Effective Resume Writing

A resume is a medium for advertising yourself, its the first most means which you use to present yourself and try to claim that you are the best choice to your prospects employer. Through your resume you have to showcase your major assets like: Qualifications Experience Achievements Capabilities, and Qualities You have to prepare your resume in such a way that it gives impression in first look that you are a perfect fit for the job you have applied. An employer hardly takes 10-15 seconds to make a decision about your interview call after looking at your resume. If your resume is well written then definitely you will be in the shortlisted candidates does not matter you have required potential or not but you will get a call otherwise your resume will become a part of either recycle bin or dustbin, again it does not matter if you are Einstein or Newton. The first draft of your resume may not be so impressive because a resume is always an evolving document which improves over the period of...

ORM Overview

What is JDBC? JDBC stands for  Java Database Connectivity  and provides a set of Java API for accessing the relational databases from Java program. These Java APIs enables Java programs to execute SQL statements and interact with any SQL compliant database. JDBC provides a flexible architecture to write a database independent application that can run on different platforms and interact with different DBMS without any modification. Pros and Cons of JDBC Pros of JDBC Cons of JDBC Clean and simple SQL processing Good performance with large data Very good for small applications Simple syntax so easy to learn Complex if it is used in large projects Large programming overhead No encapsulation Hard to implement MVC concept Query is DBMS specific Why Object Relational Mapping (ORM)? When we work with an object-oriented systems, there's a mismatch between the object model and the relational database. RDBMSs represent data in a tabular format whereas object-oriented languages, such as J...

Hibernate Batch Processing

Consider a situation when you need to upload a large number of records into your database using Hibernate. Following is the code snippet to achieve this using Hibernate: Session session = SessionFactory.openSession(); Transaction tx = session.beginTransaction(); for ( int i=0; i<100000; i++ ) { Employee employee = new Employee(.....); session.save(employee); } tx.commit(); session.close(); Because by default, Hibernate will cache all the persisted objects in the session-level cache and ultimately your application would fall over with an  OutOfMemoryException  somewhere around the 50,000th row. You can resolve this problem if you are using  batch processing  with Hibernate. To use the batch processing feature, first set  hibernate.jdbc.batch_size  as batch size to a number either at 20 or 50 depending on object size. This will tell the hibernate container that every X rows to be inserted as batch. To implement this in your code we would need to do...

Hibernate Interceptors

As you have learnt that in Hibernate, an object will be created and persisted. Once the object has been changed, it must be saved back to the database. This process continues until the next time the object is needed, and it will be loaded from the persistent store. Thus an object passes through different stages in its life cycle and  Interceptor Interface  provides methods which can be called at different stages to perform some required tasks. These methods are callbacks from the session to the application, allowing the application to inspect and/or manipulate properties of a persistent object before it is saved, updated, deleted or loaded. Following is the list of all the methods available within the Interceptor interface: S.N. Method and Description 1 findDirty() This method is be called when the  flush()  method is called on a Session object. 2 instantiate() This method is called when a persisted class is instantiated. 3 isUnsaved() This method is called when an o...