How to insert data from textfields into database using hibernate?

Ads
 

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 from database using oops concepts - Development process
Advertisements
how to insert data into database using jsp & retrive
how to insert data in database using html+jsp
how to read data from excel file through browse and insert into oracle database using jsp or oracle???
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
How to Retrieve Data from the database and write into excel file using Java
how to retrieve data from database
How to get the data from the database using Servlet or JSP program
How to insert multiple drop down list data in single column in sql database using servlet
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 get data from Oracle database using JSP
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 fetch data from mysql database table and draw a bar chart on that data using in jsp
Insert image from user using and save in database
using ajax i want to insert data into oracle database
How to export data from database to excel sheet by using java in standalone project
how to insert, retrieve data from,to db(code)....
Insert data in Excel File from Database using JSP
how to insert, retrieve data from,to db(code)....
Insert excel file data into database Using Java Programming
i need program to insert data in database using javascript
insert and delete data in database
how to insert data into databasse by using jdbc
how to insert data into databasse by using jdbc

Ads