Java

Java is a set of computer software and specifications developed by Sun Microsystems, which was later acquired by the Oracle Corporation, that provides a system for developing application software and deploying it in a cross-platform computing environment. Java is used in a wide variety of computing platforms from embedded devices and mobile phones to enterprise servers and supercomputers.

Spring Logo

Spring Framework

The Spring Framework provides a comprehensive programming and configuration model for modern Java-based enterprise applications - on any kind of deployment platform. A key element of Spring is infrastructural support at the application level: Spring focuses on the "plumbing" of enterprise applications so that teams can focus on application-level business logic, without unnecessary ties to specific deployment environments.

Hibernate Logo

Hibernate Framework

Hibernate ORM is an object-relational mapping framework for the Java language. It provides a framework for mapping an object-oriented domain model to a relational database.

Friday, January 24, 2014

Downloading Spring Framework

Click here to Downl...

Tuesday, January 14, 2014

Externalization in Java

In my previous post ( Serialization), we saw about Serialization. While using Serialization we can get some limitations.Limitations of Serialization: File size is very high because it contains meta information of the file.Customization due to transient which is not effective because we get “null” in place of transient attributes.To overcome the limitations of Serialization, we can use the Externalization.Externalization(java.io.Externalizable): Externalization...

Sunday, January 12, 2014

How to get the System Properties and System Environment variables by using Java

To get the System properties we can use getProperty() of System class. To get all the System properties we can use the getProperties() of System class.package com.ranga;/** * Created by ranga on 1/12/14. */public class Application {  public static void main(String[] args) {    System.out.println("Java Version: "+ System.getProperty("java.version"));  }}Output: Java Version: 1.6.0_35Fetching all System properties.---------------------------------------------------------------package com.ranga;import java.util.Map;import...

Sorting and Searching the Employee Object by using Collection

In this post, we can learn how to sort the Employee object by using age and search the Employee object by using age.Employee.java---------------------------------------- package com.ranga;import java.io.Serializable;/** * Created by ranga on 1/12/14. */public class Employee implements Serializable {  private long serialVersionUID = 31462223600l;  private long id;  private String firstName;  private String lastName;  private int age;  private String address;  public Employee() {    super(); ...

Serialization in Java

 Serialization: Serialization is a process of writing the object state into a file system with extension .ser and recreatign object state from that file(this is called deserialization). Generally objects are stored in the Memory. In order to store the object permanently we can use the Serialization process.In order to make any object as Serialization we need to implement with java.io.Serializable interface. Serializable interface is marker interface...

Saturday, January 11, 2014

Write a SQL program to accept the users birthdate and calculates the Age.

create table Persons(id int, name varchar2(40), dob date);insert into Persons values(1,'ranga','01-JUN-88');insert into Persons values(2,'eswar','01-JUL-88');insert into Persons values(3,'vinod','01-APR-87');1. SELECT p.*, trunc( (sysdate - dob) / 365.25) as age FROM Persons p;2. SELECT p.*, floor(months_between(sysdate,dob)/12) age FROM Persons p;3. SELECT  p.*, trunc((sysdate - p.dob)/365.25) as age FROM Persons p;Output:Displaying the Year...

Thursday, January 9, 2014

Finding the Nth heighest Salary in SQL

Program: Write a SQL query to get the Nth highest salary from Employee table. Here N can be any number.Solution:SELECT e.* FROM Employee e;Step1: If you want to find the height salary, initially you need to sort the employee data in descending order or if you want to find the lowest salary you need to sort the employee data in ascending. Here i am finding the height salary so i will sort the employee data in descending order.SELECT e.* FROM...

Caused by: java.sql.SQLSyntaxErrorException: ORA-00918: column ambiguously defined

Caused by: java.sql.SQLSyntaxErrorException: ORA-00918: column ambiguously definedProblem: The problem comes from while triggering a select query. In select query the multiple tables having the same column name but if we specified with out any prefix then it will throws the column ambiguously defined.Example: Assume it two table Student and Employee. Both tables is having id, id.Then while fetching the recoredSelect id, * from Student s, Employee e; Solution: Add prefix to the columnSelect s.id, e.id, * from Student s, Employee e;Note: Columns...

Wednesday, January 8, 2014

Write the program to generate following triangle. 1 1 3 1 3 5 1 3 5 7

Program:  Write the program to generate following triangle.  1   1 3   1 3 5   1 3 5 7Code:package com.ranga;class TriangleDemo{    public static void main (String[] args)    {        int temp = 0;        for(int i=0; i< 4; i++) {            for(int j = 0; j<=i; j++) {                if(j == 0) {       ...

Thursday, January 2, 2014

Component Mapping in Hibernate

A Component (Embedded Object) is an object that is persisted as a value type, not an entity (table). A Component mapping is a mapping for a class having a reference to another class as a member variable.Consider the following Person classPerson class contains the following properties like firstName, lastName, age, houseNo, street etc. Instead of keeping the all attributes in one class(Person) we can divide the some properties(house, street, city)...