Saturday, September 19, 2015

Hibernate Configuration


Hibernate configuration properties :-


hibernate.dialect : allows Hibernate to generate SQL optimized for a particular relational database.

hibernate.show_sql : Write all SQL statements to console.
hibernate.format_sql : Pretty print the SQL in the log and console.
hibernate.connection.autocommit : Enables autocommit for JDBC pooled connections (it is not recommended)

Hibernate introduction


Hibernate ORM (Hibernate in short) is an object-relational mapping framework for the Java language, providing a framework for mapping an object-oriented domain model to a traditional relational database. Hibernate solves object-relational impedance mismatch problems by replacing direct persistence-related database accesses with high-level object handling functions.

PostgreSQL Basic Queries


SCHEMA

- Create Schema 

CREATE SCHEMA schema_name;

- Rename Schema

ALTER SCHEMA schema_name RENAME to schema_name_new

- Drop Schema

DROP SCHEMA schema_name;

Wednesday, May 20, 2015

Spring mvc example with maven using eclipse

Spring Mvc Example 


We are going to create a spring mvc base example with maven in eclipce.
In this example we will print a message "Hello World" on screen and will handle same common errors like 404 (URL not found) or 500 (internal server error).


1. Click on File -> New -> other and select Maven Project



Tuesday, May 12, 2015

Maven introduction

Maven introduction :-


Maven is a build management tool from the Apache Software Foundation. Maven allows a project to build using its project object model (POM) and a set of plugins that are shared by all projects using Maven. It is used for projects build, dependency and documentation.

Maven’s Objectives -



  1. Making the build process easy
  2. Providing a uniform build system
  3. Providing quality project information
  4. Providing guidelines for best practices development
  5. Allowing transparent migration to new features


Saturday, March 28, 2015

Java Object cloning

Object cloning means creating a copy of original object with different reference.

Object cloning can be of two types - Shallow cloning and Deep cloning.

Shallow cloning :-

Java Object Class already have a clone method. By default this clone method do shallow cloning.

As per java docs

Object clone method Creates and returns a copy of this object.
The precise meaning of "copy" may depend on the class of the object.
The general intent is that, for any object x, the expression:

1) x.clone() != x will be true
2) x.clone().getClass() == x.getClass() will be true, but these are not absolute requirements.
3) x.clone().equals(x) will be true, this is not an absolute requirement.


Tuesday, February 24, 2015

Select drop-down list in jquery

  Get selected value using class :-
$(".drop_down_class").val();


Get selected value using Id :-
$("#drop_down_id").val();


Get text of selected value :-
$("#drop_down_id").text();


How to sort a hashset

Covert set into list than sort it using collection utill
A HashSet does not guarantee any order of its elements


Set unSortedHashSet = new HashSet();

List sortedList = new ArrayList(unSortedHashSet);

Collections.sort(sortedList);