Tuesday 8 January 2013

Hibernate Introduction


Hibernateis a solution for object relational mapping and a persistence
management solution or persistent layer. This is probably not
understandable for anybody learning Hibernate.
What
you can imagine is probably that you have your application with some
functions (business logic) and you want to save data in a database.
When you use Java all the business logic normally works with objects
of different class types. Your database tables are not at all
objects.
Hibernate
provides a solution to map database tables to a class. It copies one
row of the database data to a class. In the other direction it
supports to save objects to the database. In this process the object
is transformed to one or more tables.

Saving
data to a storage is called persistence. And the copying of tables to
objects and vice versa is called object relational mapping.
read more...

Hibernate First Example

Hibernate First Example

read more...

JDBC in Java Example

Simple Example for JDBC in Java


import java.sql.*;

public class clsDatabase 
{
public static void main(String args[]) 
{
    // URL for where the database is
String url = "jdbc:postgresql://localhost:5432/interview";
   
 // Load the postgres driver
    try
    {
           Class.forName("org.postgresql.Driver");
    }
    catch( Exception e )
   {
     System.out.println("Failed to load mSQL driver.");
     return;
   }
    
    try {

   // Get the connection object using the drivermanager class
  Connection con = DriverManager.getConnection(url, "postgres", "pass@1234!@#$");

      // create a statement object using the connection object
      Statement select = con.createStatement();

      // get the resultset by firing the query using the statement object
      ResultSet result = select.executeQuery("Select * from users");         

      // loop through the resul object and display the name field
      while(result.next()) 
      { 
        String key = result.getString(1);
        System.out.println(key);
      }
      select.close();
      con.close();
    }
    catch( Exception e ) 
    {
      e.printStackTrace();
    }
  }
}

read more...

Rating criteria for Interview


Rating criteria for Interview

0 :You have no idea about the question

1: You know only the definition.

2: You Know the concept but not the depth of the subject.

3: You know the concept and have partial knowledge about the concept.

4 : You know the concept and have in depth knowledge about the subject. But its possible that you will    stumble in some in depth question.

5 : You are a expert and no one can touch you in this.

____________________________________________________________________________
Decide what ratings you have.....
read more...

Popular Posts