2 Answer(s)      8 years ago
Posted in : Hibernate

Dear Sir, with due respect,it is here to tell you i am beginner in hibernate.AS I M TRYING TO RUN YOUR FIRST APPLICATION OF HIBERNATE. BUT IT IS SHOWING exception Exception in thread "main


View Answers

April 22, 2008 at 7:43 PM

Hi friend,

package roseindia;

import org.hibernate.*;
import org.hibernate.criterion.*;
import org.hibernate.cfg.*;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import java.util.*;

public class pojoexample {
public static void main(String arg[]){
Session session = null;
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
session =sessionFactory.openSession();
org.hibernate.Transaction tx = session.beginTransaction();
System.out.println("Insert data into database");
HibernatePojoExample pojo = new HibernatePojoExample();

}catch(Exception e){


April 22, 2008 at 7:45 PM

package roseindia;

public class HibernatePojoExample {

private String username;
private String lastname;
private String address;
private String qualification;
private String state;
private int id;

public String getUsername(){
return username;
public void setUsername(String username) {
this.username = username;
public String getLastname() {
return lastname;
public void setLastname(String lastname) {
this.lastname = lastname;
public String getAddress() {
return address;
public void setAddress(String address) {
this.address = address;

public String getQualification(){
return qualification;
public void setQualification(String qualification){
this.qualification = qualification;
public String getState(){
return state;
public void setState(String state){
this.state = state;
public int getId() {
return id;
public void setId(int id) { = id;


<class name="roseindia.HibernatePojoExample" table="pojoinformation">
<id name="id" type="int" column="id" >
<generator class="assigned"/>

<property name="username">
<column name="username" />
<property name="lastname">
<column name="lastname"/>
<property name="address">
<column name="address"/>
<property name="qualification">
<column name="qualification"/>

<property name="state">
<column name="state"/>



try again,

read for information,

Related Tutorials/Questions & Answers:
First JSF Application - WebSevices
First JSF Application  First JSF application and JSF application folder structure, please help me in writing my first application using JSF. thanx :-)  Hi,Please check
First Struts Application - Struts
First Struts Application  Hello, Hello, I have created a struts simple application by using struts 1.2.9 and Jboss 4.0.4. I am getting below exception when I start JBoss server. INFO [[/project1]] Marking servlet
fIRST APPLICATION  Dear Sir, with due respect,it is here to tell you i am beginner in hibernate.AS I M TRYING TO RUN YOUR FIRST APPLICATION OF HIBERNATE. BUT IT IS SHOWING exception Exception in thread "main   Hi friend
Writing your First WAP Application.
different cards. Let's create our first application... WML application first three line is must and it contains...; Writing your First
First Hibernate Application
First Hibernate Application In this tutorial you will learn about how to create an application of Hibernate 4. Here I am giving an example which will demonstrate you how can you make your application using Hibernate 4. To create
Hibernate ORM - learn to create first application
Hibernate ORM - learn to create first application Hibernate ORM in the video. Here we will learn how to create the first application using... to create first application": We have the following fixed bugs in this version
Writing First Hello World application in JSP
to create first web page on tomcat server. JSP simply application that work...;. This one the simply exercise for your first application JSP. Just modify file... html pages. Then the application load the new file, with the "Hello.jsp"
First Ajax Example
Ajax First Example - Print Date and Time   ... Ajax Application for displaying the current date and time. Date and time.... This is the first example in Ajax that will give you quick start in the Ajax
First Step towards JDBC!
First Step towards JDBC      ... and shows you how to create a database application to access the databases. For the shake of simplicity, in very first example Access database
struts first example - Struts
struts first example  I got errors in struts first example like can... # -- welcome -- welcome.title=Struts Blank Application welcome.heading=Welcome... ERROR: Application resources not loaded
First Step towards JDBC!
; JDBC is Java application programming interface that allows the Java... First To Latest      Relational Database... Here is the video insturction "First JDBC Example for Inserting data
Writing first JPA 2.1 example
/tools are need for developing the first JPA 2.1 example application: Java... the application easily. Let's start developing our first JPA 2.1 example. Step 1... for storing the data for this application. The MySQL database is very easy to use
struts first - Struts
struts first  struts first program example
the focus to the first form field
the focus to the first form field   How do I set the focus to the first form field
focus to the first form field
focus to the first form field  How do I set the focus to the first form field
focus to the first form field
focus to the first form field  How do I set the focus to the first form field
Struts first example - Struts
Struts first example  when i am doing struts first example , it is raising 404 error sometimes it is raised 500 error. what is the problem, and how to do the first program in struts. please give reply with regad's
find the first character is vowel or not
find the first character is vowel or not  hi friend, can u plz send me javascript code for find the wether the first character is a vowel or not. 2) check wether the last character is same as the first character or not 3) check
Sum of first n numbers
Sum of first n numbers  i want a simple java program which will show the sum of first n numbers....   import java.util.*; public class SumOfNumbers { public static void main(String[]args){ Scanner input=new
resign first responder keyboard
resign first responder keyboard  Hi, How I can hide keyboard on click on of done button in keyboard. Give me example of resign first responder keyboard example code. Thanks   Hi, Make your controller delegate to text
Struts First Example - Framework
Struts First Example  HI i am new to Struts and developing a single loginForm project. But it gives me the following exception javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean
My first Java Program
My first Java Program  I have been caught with a practical exam to do the following: Write a program that takes input from a user through the command line. The user must be prompt to enter a sentence (anything). The sentence
SQL Aggregate Functions First
SQL Aggregate Functions First       SQL Aggregate Function First, that performs calculation... illustrate an example from SQL Aggregate Functions First. The Example create a table
Struts first example - Struts
Struts first example  Hi! I have field price. I want to check require and input data type is int. can you give me an example code of validation.xml file to resolve it? thanks you so much!  Hi friend, Plz specify
spring first example - Spring
spring first example  I am trying my first example of spring from the link But I am not getting the simple "Hi" message ,I have created simple one jsp page and /WEB_INF/web.xml
dismissmodalviewcontrolleranimated first deprecated in ios 6.0
dismissmodalviewcontrolleranimated first deprecated in ios 6.0  In Xcode 6.1 while developing an application I am getting the following error: dismissmodalviewcontrolleranimated first deprecated in ios 6.0 I used the following
JDBC ResultSet first() Example
JDBC ResultSet first() Example: The ResultSet first() are use to moves the cursor to the first row in the ResultSet object. It return true if the cursor pointed first row in the ResultSet and return false if the ResultSet object does
Creating Web application on tomcat server
Create your first Tomcat Web application       In this section we will show you how to create first web application using Servlet on the tomcat server.  We first make a class
First Program
Now, lets move ahead for printing the first and most simple & common example of programming “Hello World”. <html> <body> <?php print (“Hello World”); ?> </body> </html>
Spark Application Container in Flex4
Spark Application Container in flex4: Spark container is define in the spark.components package. The application container is the first container... application. The tag for the spark application container is <s:Application
How to write first example in Ajax?
How to write first example in Ajax?  Hi, I am beginner in Ajax and want learn it. How can I write first example in Ajax? Thanks   Hi, Please check the tutorial First Ajax Example. Thank