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

Ads









Related Tutorials/Questions & Answers:
How to insert data from textfields into database using hibernate?
how to insert data into database using jsp & retrive
Advertisements
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
How to insert data from a combobox and textbox values into DB using JSP?
insert data in the database using checkbox
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
How to get data from Oracle database using JSP
using ajax i want to insert data into oracle database
Insert data in Excel File from Database using JSP
how to insert checkbox value into database using jsp
i need program to insert data in database using javascript
how to insert checkbox value into database using jsp
how to retrieve data from database ?????/
how to retrieve data from database ?????/
how to retrieve data from database ?????/
how to retrieve data from database ?????/
how to insert checkbox value into database using jsp
how to insert data from netbeans into databse
how to retrieve data from database
How to insert rows from Excel spreadsheet into database by browsing the excel file?
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
How to export data from database to excel sheet by using java in standalone project
retrieve data from database using jsf
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
Insert data in mysql database through jsp using prepared statement
how to insert, retrieve data from,to db(code)....
how to make a radiobutton selected when retrieving data from database using struts framework and spring jdbc
how to insert, retrieve data from,to db(code)....
How to insert dynamic textbox values into database using Java?
Populate a combo box using data from a database
insert data into database
How to save database data into excelsheet using hibernate
retrive data from database using jsp in struts?
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
insert data using drop down box in java into database postgresql
database is connected but not insert the data
How to delete the row from the Database by using servlet
How to get the data from the database (Oracle) in console or in ie using servlet or jsp as Front end
How to extract values from SOAP Response message and insert in database

Ads