Home Tutorialhelp Comment How to insert data into database?

 
 

Comment

Nitin Gupta
How to insert data into database?,
September 30, 2008 at 11:40 AM

SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
session =sessionFactory.openSession();
//Create new instance of Contact and set

System.out.println("Inserting Record");
Contact contact = new Contact();
//contact.setId(1);
contact.setFirstName("Nitin");
contact.setLastName("Kumar");
contact.setEmail("nitin_38@yahoo.com");
Transaction tx = session.beginTransaction();
session.save(contact);
tx.commit();
System.out.println("Done");
View All Comments | View Tutorial
Advertisement
Related Tutorial and Articles
Hibernate-Tutorials

Hibernate Insert
 

Java Beginners

How to insert data from textfields into database using hibernate?
 

JDBC Questions

How to insert clob data??
 

Hibernate Tutorial Example

Insert Data into Database Using Hibernate Native SQL
 

Hibernate Questions

hibernate insert image
 

Hibernate Questions

insert image using hibernate
 

SQL Question

single query to insert the data
 

Hibernate-Tutorials

Hibernate insert Query
 

EJB Questions

how to insert data from netbeans into databse
 

Hibernate Questions

how to Integrate MULE and HIBERNATE - Hibernate
 

JSP Interview Questions

To insert maximum number of data in database.
 

Java Beginners

how to insert data into database using jsp & retrive
 

Hibernate Questions

help me in inserting data into db using hibernate
 

JDBC Questions

how to insert, retrieve data from,to db(code)....
 

JDBC Questions

how to insert, retrieve data from,to db(code)....
 

Java Technology Tutorials

Insert file data into database
 

JSP Interview Questions

how to insert data in database using html+jsp
 

Java Interview Questions

how to insert data into databasse by using jdbc
 

Java Interview Questions

how to insert data into databasse by using jdbc
 

Java Interview Questions

how to insert data into databasse by using jdbc
 

Java Interview Questions

how to insert data into databasse by using jdbc
 

Hibernate Questions

Hibernate code - Hibernate
 

HTML Questions

insert
 

JSP Servlet Questions

insert data in the database using checkbox
 

Programming Tutorials

Insert Mysql Blob data
 

Hibernate Questions

How to save database data into excelsheet using hibernate
 

Java Technology Tutorials

Java insert file data to JTable
 

Java Beginners

insert data
 

JSP Interview Questions

How to insert data from a combobox and textbox values into DB using JSP?
 

Hibernate Questions

hibernate sql error - Hibernate
 

Development process Questions

how to insert data from database using oops concepts - Development process
 

JDBC Questions

insert excel value in to oracle data base
 

JSP Servlet Questions

How to Insert image and data both together in database in JSP/Servlet ?
 

Java Beginners

what is the jsp coding to insert a data in database tables
 

Java Code Examples

Insert XML file data to database
 

JavaScript Questions

How to insert data into databse by JSP form registration page in netbeans
 

General

Insert text file data into Database
 

JSP Servlet Questions

how to insert the bulk data into the data base from the table of jsp page to another jsp page
 

Framework Questions

Hibernate - Framework
 

JDBC Questions

insert and delete data in database
 

Java Beginners

how insert data from databse in array and compare new data to already stored value in array
 

JSP Servlet Questions

Uploading Excel sheet record in JSP to insert data in MySql
 

Hibernate Questions

Hibernate - Hibernate
 

Ant

Ant Script to Insert Data in Mysql Table
 

Hibernate-Tutorials

Hibernate : Dynamic-insert
 

Hibernate Questions

Hibernate - Hibernate
 

JSP Servlet Questions

insert data into database
 

Hibernate Questions

Hibernate code - Hibernate
 

Quartz Tutorials

Insert Data From File
 

SQL Question

can i use trigger to insert data within a time period ?
 

Spring Framework Questions

how to fetch data fron facebbok using spring batch and hibernate ?
 

JSP Servlet Questions

database is connected but not insert the data
 

Java Server Faces Questions

unable to insert data into database
 

Java Server Faces Questions

unable to insert data into database
 

Java Server Faces Questions

unable to insert data into database
 

Java Server Faces Questions

unable to insert data into database
 

XML Questions

how to insert the selected item of combobox in mysql - XML
 

JSP Servlet Questions

insert data into database
 

JSP Servlet Questions

How to insert multiple drop down list data in single column in sql database using servlet
 

General

EJB Insert data
 

Programming Tutorials

PDO Insert
 

Framework Questions

how read excel data into database using struts2 with hibernate
 

Java Beginners

How to read every cell of an excel sheet using Apache POI and insert those data into a DB?
 

JSP Servlet Questions

getting int values from form and insert it in data base in jsp
 

Spring Framework Questions

insert code using spring - Spring
 

Hibernate Questions

Hibernate code problem - Hibernate
 

Hibernate Questions

How to run? - Hibernate
 

Hibernate-Tutorials

Hibernate Annotation Example
 

SQL Tutorial

Insert Data From File
 

General

Insert excel file data into database Using Java Programming
 

JSP Servlet Questions

upload the text file through html and insert those data into the table
 

JDBC-Tutorials

Servlet Example To Insert Mysql Clob Data
 

Hibernate Questions

Hibernate code - Hibernate
 

Java Beginners

how to read data from excel file through browse and insert into oracle database using jsp or oracle???
 

Java Beginners

how to insert checkbox value into database using jsp
 

PHP Questions

How can i search and insert within a query
 

JSP Tutorials

Insert data in mysql database through jsp using prepared statement
 

Hibernate Questions

How to display data from database in a TableView via Hibernate
 

Java Technology Tutorials

Insert database values in the file
 

JDBC

JDBC Insert Statement Example
 

Hibernate Questions

Data fetch from multiple SQL tables - Hibernate
 

Blog

Sitemap Hibernate Tutorial
 

Development process Questions

how to insert image into server
 

Java Beginners

how to insert check box
 

Hibernate Questions

hibernate Excetion - Hibernate
 

SQL Question

FAILED TO INSERT DATA FROM FUNCTION();
 

Hibernate Tutorial Example

Hibernate Architecture
 

PHP Tutorial

PHP Insert Value
 

SQL Question

insert and retrive data and time - SQL
 

Hibernate Questions

hibernate Foreign key
 

Hibernate Questions

Bulk insert and dynamic schema loading
 

Hibernate-Tutorials

Hibernate Data types
 

Java Beginners

How to insert rows in jTable?
 

Java Beginners

hibernate
 

Hibernate Questions

Hibernate
 

Java Beginners

How to insert rows from Excel spreadsheet into database by browsing the excel file?
 

Hibernate Questions

hibernate
 

Hibernate Questions

hibernate
 

Java Code Examples

Insert pages pdf
 

Struts Questions

Struts2 and Hibernate Fetch Data Base Value
 

Advertisements Advertisements
 

 

 

DMCA.com