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



Home Answers Viewqa Hibernate could not execute native bulk manipulation query

Have Programming Question? Ask it here!
 
 
 


pradeep Kundu
could not execute native bulk manipulation query
0 Answer(s)      a year and 11 months ago
Posted in : Hibernate


I am insert data in mysql through struts hibernate integration. But above error is coming. Please help me I am sending our Insert Class coding

My Insert class coding

package com.myapp.struts;

import java.sql.SQLException;

import org.hibernate.SQLQuery;
import javax.servlet.ServletContext;
import org.hibernate.SessionFactory;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
/**
 *
 * @author pradeep.kundu
 */
public class InsertDataAction extends Action {


    private static final String SUCCESS = "success";
    private static final String FAILURE = "failure";

    boolean flag;
    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {
          ActionErrors errors = new ActionErrors();
          InsertDataForm idf = new InsertDataForm();
          Integer userId = idf.getuserId();
          String firstName = idf.getfirstName();
          String lastName = idf.getlastName();
          Integer age = idf.getage();
          Long number = idf.getnumber();
           Session session = null;
           System.out.println("Getting session factory");
 /*Get the servlet context */
         ServletContext context =
         request.getSession().getServletContext();
         try {
            Configuration cfg = new Configuration();
             cfg.configure("hibernate.cfg.xml");
 /*Retrieve Session Factory */
       SessionFactory _factory = new
          Configuration().configure().buildSessionFactory();
 /*Open Hibernate Session */
         session = _factory.openSession();
         Transaction tx = session.beginTransaction();
         String str = "insert into emp values(?,?,?,?,?)";
         SQLQuery query = session.createSQLQuery(str);
         System.out.println("Pradeep");
        if(userId!=null){
          query.setInteger(1,userId);
          System.out.println("pra"); 
          query.setString(2,firstName);
          System.out.println("pra");
          query.setString(3,lastName);
          System.out.println("pra");
          query.setInteger(4,age);
          System.out.println("pra");
          query.setLong(5,number);
          System.out.println("pra");
        }
          int row = query.executeUpdate();
          //session.saveOrUpdate(query);
          System.out.println("data is successfully submitted"); 
          tx.commit();
          session.close();
       }
       catch (Exception ex) {
            errors.add("SQLException", new ActionMessage("error.SQLException"));
            throw new SQLException(ex.fillInStackTrace());
        }
           saveErrors(request, errors);
           if (errors.isEmpty()) {
            flag = true;
        } else {
            flag = false;
          }
        if (flag == true ) {
            return mapping.findForward(SUCCESS);
        } else {
            return mapping.findForward(FAILURE);
        }
   }
}

Thanks in advance
Pradeep Kundu


Advertisement
View Answers

Related Tutorials/Questions & Answers:
could not execute native bulk manipulation query
could not execute native bulk manipulation query  I am insert data... public ActionForward execute(ActionMapping mapping, ActionForm form... = "insert into emp values(?,?,?,?,?)"; SQLQuery query
Hibernate Native Scalar Query
In this section, you will learn Hibernate Native Scalar Query
Advertisements
Hibernate SQL Query/Native Query
This tutorial describes Hibernate SQL Query, which is also known as Native Query
Hibernate Native SQL Query Introduction
In this section, you will learn Hibernate Native SQL query
Hibernate Native Entity Query
This section contains detail about Hibernate Native Entity Query with example code
Hibernate Named Native SQL Query
In this section, you will learn Named Native SQL Query in Hibernate
steps required to execute a query in JDBC
steps required to execute a query in JDBC  What are the steps required to execute a query in JDBC
HQL Query in execute method of Struts2
HQL Query in execute method of Struts2  I am making login page... data from database using hql. And where I need to write the hql query. Is it possible to write it at execute method of struts2
Hibernate Named Native SQL in XML Returning Scalar
In this section, you will learn to execute Hibernate named native SQL query written in XML mapping file which return scalar values(raw values
JDBC Execute Query
JDBC Execute Query       The  Execute Query in JDBC retrieve the elements from a database. In this Tutorial we want to describe you a code that helps you to understand JDBC Execute Query
Hibernate Named Native SQL Query using XML Mapping
In this section, you will learn Named Native SQL Query using XML Mapping in Hibernate with an example
How to execute mysql query based on checkboxes values in java swing application.
How to execute mysql query based on checkboxes values in java swing... have to execute query based on selection of checkboxes.Means I have to to execute query acording to the checkbox. whichever checkbox is selected query should
How to execute mysql query based on checkboxes values in java swing application.
How to execute mysql query based on checkboxes values in java swing... have to execute query based on selection of checkboxes.Means I have to to execute query acording to the checkbox. whichever checkbox is selected query should
How to execute mysql query based on checkboxes values in java swing application.
How to execute mysql query based on checkboxes values in java swing... have to execute query based on selection of checkboxes.Means I have to to execute query acording to the checkbox. whichever checkbox is selected query should
How to execute my query fast..When A date filter is there in a query it takes more time for execution.?
How to execute my query fast..When A date filter is there in a query it takes more time for execution.?  When A date filter is there in a query... in 30 seconds with 5000 records... what is the problem ... how to execute my query
Hibernate Named Native SQL in Annotation
In this section, you will learn how to execute the Named Native SQL written in Model class Annotation
Execute database query by using sql tag of JSTL SQL library
Execute database query by using sql tag of JSTL SQL library... to create application that execute sql query given by user using JSTL SQL Library. To execute query first create a data source and then execute sql query
Hibernate Native SQL Example
create, update, delete and select. Hibernate Native Query also supports stored procedures. Hibernate allows you to run Native SQL Query for all the database...; invested amount: /*Hibernate Native Query Average Examle*/ String sql ="
bulk sms - MobileApplications
Bulk SMS  how we can create our own program to send bulk SMS
native library
native library  how to create native library in java
Develop Bulk SMS sender
Develop Bulk SMS sender   Hi, i Want to implement Bulk SMS sender Application using java is it possible through XMPP ? any other technology
native methods
native methods  what is native methods in java?   A native... native method is a great way to gain and merge the power of C or C++ programming... efficient native Java compilers are not fully implemented, use native method can
Bulk insert and dynamic schema loading
Bulk insert and dynamic schema loading  Hi All, I am new to H2... assistance regarding H2 database. Overview of my work : I get the query from reporting engine. Query is split and only the select with where is run
JPA Native Queries, JPA Native Queries Tutorials
to use native query in your JPA application.  JPA Native Queries: JPA native query executes plain SQL queries. JPA Native queries have the following properties: A native query returns either a single scalar value. Or It returns
SQL Bulk Insert Example
SQL Bulk Insert Example       SQL Bulk Insert Example is used to insert a bulk record to the table... Bulk Insert .To grasp this example we create a table 'Stu_Table'. 
java native implementation
java native implementation  What is java native implementation
Manipulation of war fie contents
Manipulation of war fie contents  How can I manipulate a specific file inside my war file without extracting it? Please help... Thanks and regards, Swapnil
SQL Bulk Insert Example
SQL Bulk Insert Example       SQL Bulk Insert Example is used to insert a bulk record to the table... Bulk Insert .To grasp this example we create a table 'Stu_Table'. 
Hibernate : Bulk Insert/Batch Insert
This tutorial contains description of Hibernate bulk insertion(Batch insertion
SQL Bulk Insert csv
SQL Bulk Insert csv       SQL Bulk Insert is used to import the records from csv  file... an example from 'SQL Bulk Insert CSV'.To understand and  grasp this example
SQL Bulk Insert
SQL Bulk Insert       SQL Bulk Insert is performed when you insert a records  or row to a table in a bulk. Understand with Example The Tutorial covers an example from 'SQL
What is a native method?
What is a native method?   Hi, What is a native method? thanks,   Hi, This Native mathod is a Java keyword that is used in method..., not in Java. The Java Native Interface (JNI) is also known as programming
string manipulation in xml
string manipulation in xml  im working on build.xml using apache ant... in one of the targets i am assigning a var file with the full path of .sql files present in a folder. while executing that .sql file in xml its giving me
JDBC Execute Update Example
JDBC Execute Update Example       JDBC Execute Update query is used to modify or return you an integer value specify... and execute sql query in the backend database.    st.executeUpdate
Image Manipulation in Swing AWT
Image Manipulation in Swing AWT  Sir, I'am new to Swing Programming. I have to create an application where an image is displayed on one Label. The same image has to be split in parts and stored in database pert wise. Later
MySQL PHP Query delete
MySQL PHP Query delete       Mysql PHP Query delete is used to execute Mysql function ( ) delete query from a database table. MySQL PHP Query is used to delete the records
Mysql Date Manipulation
Mysql Date Manipulation       Mysql Date Manipulation find out the difference between two values... Date Manipulation. To grasp this example, we create a table 'Person' with field
PHP SQL Query Insert
PHP SQL Query Insert       This example illustrates how to execute insert query in php...). Now, queries can be executed using mysql_query() method to insert values
Php Sql Query Insert
Php Sql Query Insert  This example illustrates how to execute insert query with values in php application. In this example we create two mysql query...; mysql_query("INSERT INTO users (username, password
PHP SQL Query Where Clause
PHP SQL Query Where Clause       This example illustrates how to create and execute the sql query with where clause. To understand how to display the result returned 
MySQL PHP Query delete
MySQL PHP Query delete       Mysql PHP Query delete is used to execute Mysql function ( ) delete query from a database table. MySQL PHP Query is used to delete the records
Query
second time i got different value. Could you please tell me answer. For Example
query
query  Sir this is table code. i created successfully ,but i want to get table data.so could you please help me for this problem.Thank you sir import java.util.*; import java.awt.*; import javax.swing.*; import
Working with CSS(CSS Manipulation)
Working with CSS(CSS Manipulation)       Working with CSS(CSS Manipulation) These methods are used to manipulate CSS specially by getting and setting
Hibernate Native vs Hibernate JPA
Hibernate Native vs Hibernate JPA  What is the difference between Hibernate Native vs Hibernate JPA?   Hibernate is ORM framework which you can use in your application. You can also use Hibernate as Persistence
Unable to execute JSP page
folder. But I could not execute the JSP page. Please help me...Unable to execute JSP page  I have written one jsp file. It contains html tags and jsp directives. I have saved the file with the extension .jsp
PayPal integration in iPhone native app
PayPal integration in iPhone native app  I am looking for some help in integrating the paypal in iPhone application. Please help. Thanks.   Instead of integrating the paypal into the app .. you can open it within
query in JDBC
query in JDBC  What are the steps required to execute a query in JDBC
Calendar's native alarm not working in j2me
Calendar's native alarm not working in j2me  Hi friend, I am developing an application to set Reminders in the phones calendar using PIM api on j2me.I am able to set reminders successfully but the problem is that when alarm
could not start server. - EJB
could not start server.  Dear All I have installed netbeans 5.5.1 and sun java Application server 9.2 to run ejb program. But when I start... comes ---sun java server could not start. so what should I do to start this server
 

 

 

DMCA.com