Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Hibernate fIRST APPLICATION

Have Programming Question? Ask it here!
 
 
 


SAMAR
fIRST APPLICATION
2 Answer(s)      6 years and 4 months 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


Advertisement
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.
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
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!
is Java application programming interface that allows the Java programmers... and simple.    JDBC Versions From First To Latest  ...; JDBC is essentially an Application Programming Interface (API
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
Depth-first Polymorphism - tutorial
Depth-first Polymorphism 2001-02-15 The Java Specialists' Newsletter [Issue 009] - Depth-first Polymorphism Author: Dr. Heinz M. Kabutz If you... of Common Lisp." And Java? Depth-first Polymorphism (or Customised
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”); ?> </body> </html>
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
How to create first program in Java?
How to create first program in Java?  Hi, I am new in Java programming. Tell me How to create first program in Java? Thanks   Hi, Read more at First Java Program. Thanks
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
My first struts 2 program
My first struts 2 program  Hi, Please help me for my first struts 2... from one page to another. Details: I am trying my first Struts 2 example program. I want to pass values from first loginpage.jsp to displaypage.jsp. I
First Lambda Expressions in Java
How to create First Lambda Expression in Java? The Lambda Expression is the hot features added to the Java 8. The Lambda expression is the first major... first Lambda expression in Java 8. I am am assuming you have installed the JDK 8
First Java Program Example
First Java Program Example In this section we will discuss about the first java program example. To create a Java program we would be required to create... your first program in Java. In this example I have created a simple class named
UIPopOverController - Open a second PopOverController over first UIPopOverController
UIPopOverController - Open a second PopOverController over first UIPopOverController  How can i open a second UIPopoverController over my first UIPopoverController in my iPad application? Right now my first UIPopoverController
first entity bean example in eclipse europa - EJB
first entity bean example in eclipse europa  pls provide steps to create simple ejb3.0 application in eclipse .And also how to create entity bean ,session bean in ejb3.0  Hi Friend, Please visit the following links
First Java Program
First Java Program       In this section you will learn how to develop your first Java program and then compile and test the same on your development machine. Write first Program
First Version of JSF
JSF released its first version on 11 mar 2004, then JSF 1.1 and now it has reached to the version 1.2. There are many releases of 1.1 and 1.2. Read the article ?JSF Versions? to get the listing of versions released so far including
JavaScript array first element
JavaScript array first element  ... a code that makes you easy to understand in array first element example... Komal. First Element.java <html>  
First Java Program
Welcome to java tutorial series. In this lesson, you will learn to create your first Java program. In Java, all source code is written in plain text file... Machine. You can write a Hello World program as your first Java program. To write
program to display the first ten terms of the series
program to display the first ten terms of the series  Write a program to display the first ten terms of the following series : 1) 1,-3,5,-7,9..... 2) 3,6,12,24..... 3) 2,5,10,17....... 4) 0,1,2,3,6............ 5) 0,3,8,15
To find first two maximum numbers in an array
To find first two maximum numbers in an array  Java program to find first two maximum numbers in an array,using single loop without sorting array
How to find the first 6 characters of string in regex?
How to find the first 6 characters of string in regex?  How to find the first 6 characters of string in regex. I know the Syntax is to String.substring(strtindex, endindex-1) For first six characters is: String
Replacing the first subsequence of the input
Replacing the first subsequence of the input  ... the first subsequence of the String using regular expression. For this we... pattern p. matcher.replaceFirst("Java"):-This method will replace only the first
What is the first argument of the String array in main() method?
What is the first argument of the String array in main() method?  Hi, What is the first argument of the String array in main() method? Thanks.... This is unlike C/C++ where the first element by default is the program name. You also
Delete the First Child of the Root Node
Delete the First Child of the Root Node       This Example describes a method to Delete the first child of the Root node .Methods which are used for Deleting the child
Select all childs except first using JQuery
Select all childs except first using JQuery  Hello Sir I Have following code : <ul> <li>First item</li> <li>Second... a class to 2nd & 3rd element or child as follows : <ul> <li>First
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
Problem in running first hibernate program.... - Hibernate
Problem in running first hibernate program....  Hi...I am using eclipse ganymede and mysql.I have already configured mysql and did few sample... if the error occurs,send the directory structure of your application
Get first day of week
Get first day of week       In this section, we will learn how to get the first day of ...: The following program helps us in getting the first day of the week
How to Run First Java Bean Program ?
How to Run First Java Bean Program ?  Hi My Dear Friend I can run many Java Programs Like, Applet,Swing,RMI ,Socket Programming and Java Servlet too But Now I need that How to run Java Bean Now I have BDK1.1 But still don't
Advertisements
 

 

 

DMCA.com