fIRST APPLICATION

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

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;
try{
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();

pojo.setUsername("amardeep");
pojo.setLastname("Patel");
pojo.setAddress("rohini,delhi-85");
pojo.setQualification("MCA");
pojo.setState("delhi");
session.save(pojo);
tx.commit();
session.flush();
session.close();
}catch(Exception e){
System.out.println(e.getMessage());
}
finally{
}
}
}

------------------------

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) {
this.id = id;
}
}


----------------------------

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

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

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

</class>

-------------------------------------

try again,

read for information,

http://www.roseindia.net/hibernate/









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 http://www.roseindia.net/jsf/jsf1.2
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
Advertisements
fIRST APPLICATION - Hibernate
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.
first application. So, here is the code of our 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 4.2.2.1... in the video. Here we will learn how to create the first application using... to create first application": ADS_TO_REPLACE_1 We have the following fixed bugs
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... from scratch. This is the first example in Ajax that will give you quick start
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
Spring Boot Console Application
Spring Boot Tutorial- Spring Boot Console Application Welcome to the first example of Spring Boot, today we will teach you to create your first application... applications in Spring Boot. Here we will teach you the steps to create the first console
Spring Boot Console Application
Spring Boot Tutorial- Spring Boot Console Application Welcome to the first example of Spring Boot, today we will teach you to create your first application... applications in Spring Boot. Here we will teach you the steps to create the first console
Writing first JPA 2.1 example
and run the application easily. Let's start developing our first JPA 2.1... for storing the data for this application. The MySQL database is very easy to use... Following software/tools are need for developing the first JPA 2.1 example
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
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
struts first - Struts
struts first  struts first program example
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
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
ModuleNotFoundError: No module named 'first'
ModuleNotFoundError: No module named 'first'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'first' How to remove the ModuleNotFoundError: No module named 'first'
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
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
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
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
SQL Aggregate Functions First
SQL Aggregate Functions First       SQL Aggregate Function First, that performs calculation... The Tutorial illustrate an example from SQL Aggregate Functions First
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 http://www.maestric.com/doc/java/spring/setup But I am not getting the simple "Hi" message ,I have created simple one jsp page and /WEB_INF/web.xml
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
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”); ?>ADS_TO_REPLACE_1 </body>
How to make first JSP page?
How to make first JSP page?  Hello, How I can make first JSP page? Thanks   HI, Beginner can learn JSP from writing the first Program. You can do it manually by creating a web application and then write jsp page
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
How to make first JSP page?
How to make first JSP page?  Hello, How I can make first JSP page? Thanks
ModuleNotFoundError: No module named 'first-a-package'
ModuleNotFoundError: No module named 'first-a-package'  Hi, My... named 'first-a-package' How to remove the ModuleNotFoundError: No module named 'first-a-package' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'first-a-package'
ModuleNotFoundError: No module named 'first-a-package'  Hi, My... named 'first-a-package' How to remove the ModuleNotFoundError: No module named 'first-a-package' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'first-app'
ModuleNotFoundError: No module named 'first-app'  Hi, My Python... 'first-app' How to remove the ModuleNotFoundError: No module named 'first... have to install padas library. You can install first-app python with following
ModuleNotFoundError: No module named 'first-app'
ModuleNotFoundError: No module named 'first-app'  Hi, My Python... 'first-app' How to remove the ModuleNotFoundError: No module named 'first... have to install padas library. You can install first-app python with following
ModuleNotFoundError: No module named 'first_function'
ModuleNotFoundError: No module named 'first_function'  Hi, My... named 'first_function' How to remove the ModuleNotFoundError: No module named 'first_function' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'first-generator'
ModuleNotFoundError: No module named 'first-generator'  Hi, My... named 'first-generator' How to remove the ModuleNotFoundError: No module named 'first-generator' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'first_hh'
ModuleNotFoundError: No module named 'first_hh'  Hi, My Python... 'first_hh' How to remove the ModuleNotFoundError: No module named 'first_hh... to install padas library. You can install first_hh python with following
ModuleNotFoundError: No module named 'first-package'
ModuleNotFoundError: No module named 'first-package'  Hi, My... 'first-package' How to remove the ModuleNotFoundError: No module named 'first-package' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'first_program'
ModuleNotFoundError: No module named 'first_program'  Hi, My... 'first_program' How to remove the ModuleNotFoundError: No module named 'first_program' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'lixc_first'
ModuleNotFoundError: No module named 'lixc_first'  Hi, My Python... 'lixc_first' How to remove the ModuleNotFoundError: No module named 'lixc_first' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'lks_first'
ModuleNotFoundError: No module named 'lks_first'  Hi, My Python... 'lks_first' How to remove the ModuleNotFoundError: No module named 'lks_first' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'luke-first'
ModuleNotFoundError: No module named 'luke-first'  Hi, My Python... 'luke-first' How to remove the ModuleNotFoundError: No module named 'luke-first' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'lz_first'
ModuleNotFoundError: No module named 'lz_first'  Hi, My Python..._first' How to remove the ModuleNotFoundError: No module named 'lz_first... to install padas library. You can install lz_first python with following
ModuleNotFoundError: No module named 'mos_first'
ModuleNotFoundError: No module named 'mos_first'  Hi, My Python... 'mos_first' How to remove the ModuleNotFoundError: No module named 'mos_first' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'my-first'
ModuleNotFoundError: No module named 'my-first'  Hi, My Python...-first' How to remove the ModuleNotFoundError: No module named 'my-first... to install padas library. You can install my-first python with following

Ads