How to insert data from textfields into database using hibernate?

How to insert data from textfields into database using hibernate?

try{ Session session = HibernateUtil.getSessionFactory().openSession(); org.hibernate.Transaction tx = session.beginTransaction(); Produs produs = new Produs(); produs.setIdprodus("IdProdusTextField"); produs.setFurnizor("IdFurnTextField"); produs.setCategorie(IdCatTextField); produs.setRaft(IdRaftTextField); produs.setDenumire(DenumireTextField); produs.setCantitate(IdCantitateTextField); produs.setUnitMas(UnitMasTextField);

    session.save(produs);
    System.out.println("Successfully data insert in database");
    tx.commit();

}

This method doesn't work. I tried with quotes for textfields, without them. The setters require other parameters, not textfields. I tried to cast them, but it doesn't work either.

Maybe you can help me. Thanks!

View Answers









Related Tutorials/Questions & Answers:
How to insert data from textfields into database using hibernate?
how to insert data from database using oops concepts - Development process
Advertisements
how to insert data into database using jsp & retrive
how to read data from excel file through browse and insert into oracle database using jsp or oracle???
how to insert data in database using html+jsp
How to insert image in sql database from user using servlet
insert data in the database using checkbox
How to insert data from a combobox and textbox values into DB using JSP?
Insert image from user using and save in database
How to Retrieve Data from the database and write into excel file using Java
How to insert multiple drop down list data in single column in sql database using servlet
How to get the data from the database using Servlet or JSP program
Insert data in Excel File from Database using JSP
How to get data from Oracle database using JSP
using ajax i want to insert data into oracle database
i need program to insert data in database using javascript
how to retrieve data from database using combobox value without using request.getParameter in jsp - JSP-Servlet
how to insert data from netbeans into databse
how to retrieve data from database ?????/
how to retrieve data from database ?????/
how to retrieve data from database ?????/
how to retrieve data from database ?????/
Insert excel file data into database Using Java Programming
how to retrieve data from database
how to fetch data from mysql database table and draw a bar chart on that data using in jsp
place data in text fields from database using jdbc
insert and delete data in database
how to insert checkbox value into database using jsp
how to insert checkbox value into database using jsp
retrieve data from database using jsf
how to insert checkbox value into database using jsp
How to insert rows from Excel spreadsheet into database by browsing the excel file?
Insert data in mysql database through jsp using prepared statement
how to insert, retrieve data from,to db(code)....
How to export data from database to excel sheet by using java in standalone project
how to insert data into databasse by using jdbc
how to insert data into databasse by using jdbc
how to insert data into databasse by using jdbc
how to insert data into databasse by using jdbc
how to insert, retrieve data from,to db(code)....
Populate a combo box using data from a database
insert data into database
how to make a radiobutton selected when retrieving data from database using struts framework and spring jdbc
Problem insert data into database using servlet n javabean - Java Beginners
retrive data from database using jsp in struts?
database is connected but not insert the data
Insert file data into database
insert data using drop down box in java into database postgresql
insert data using drop down box in java into database postgresql
insert data using drop down box in java into database postgresql

Ads