could not execute native bulk manipulation query

could not execute native bulk manipulation query

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

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
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
Advertisements
Hibernate Native Scalar Query
In this section, you will learn Hibernate Native Scalar Query
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
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 Native Entity Query
This section contains detail about Hibernate Native Entity Query with example code
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
Hibernate Named Native SQL Query
In this section, you will learn Named Native SQL Query in Hibernate
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 5 native query example
Hibernate 5 native Query example to get entity data In this tutorial we... Query The word Native Query is used for the SQL query which we can directly run... have a table called employee then the native query (SQL) for getting all
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 Query using XML Mapping
In this section, you will learn Named Native SQL Query using XML Mapping in Hibernate with an example
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 Named Native SQL in Annotation
In this section, you will learn how to execute the Named Native SQL written in Model class Annotation
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... the average of  invested amount: /*Hibernate Native Query Average Examle*/ADS
bulk sms - MobileApplications
Bulk SMS  how we can create our own program to send bulk SMS
MySQL PHP Query delete
;  Mysql PHP Query delete is used to execute Mysql function... into MyTable values(07,'Q','26000'); Query OK, 1 row affected (0.01 sec... should be omitted. To get PHP to execute the statement we use mysql _query
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.ADS_TO_REPLACE_1   
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
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
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
native library
native library  how to create native library in java
MySQL PHP Query delete
;  Mysql PHP Query delete is used to execute Mysql function... into MyTable values(07,'Q','26000'); Query OK, 1 row affected (0.01 sec... should be omitted. To get PHP to execute the statement we use mysql _query
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
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:ADS_TO_REPLACE_1 A native query returns either a single scalar value
query in JDBC
query in JDBC  What are the steps required to execute a query in JDBC
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
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
ModuleNotFoundError: No module named 'data-manipulation'
ModuleNotFoundError: No module named 'data-manipulation'  Hi, My... named 'data-manipulation' How to remove the ModuleNotFoundError: No module named 'data-manipulation' error? Thanks   Hi, In your
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
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 
ModuleNotFoundError: No module named 'djangorestframework-bulk'
ModuleNotFoundError: No module named 'djangorestframework-bulk'  Hi...: No module named 'djangorestframework-bulk' How to remove the ModuleNotFoundError: No module named 'djangorestframework-bulk' error? Thanks  
ModuleNotFoundError: No module named 'djangorestframework-bulk'
ModuleNotFoundError: No module named 'djangorestframework-bulk'  Hi...: No module named 'djangorestframework-bulk' How to remove the ModuleNotFoundError: No module named 'djangorestframework-bulk' error? Thanks  
ModuleNotFoundError: No module named 'salesforce-bulk'
ModuleNotFoundError: No module named 'salesforce-bulk'  Hi, My... named 'salesforce-bulk' How to remove the ModuleNotFoundError: No module named 'salesforce-bulk' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'sfdc-bulk'
ModuleNotFoundError: No module named 'sfdc-bulk'  Hi, My Python... 'sfdc-bulk' How to remove the ModuleNotFoundError: No module named 'sfdc-bulk' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'bulk-geocoding'
ModuleNotFoundError: No module named 'bulk-geocoding'  Hi, My... named 'bulk-geocoding' How to remove the ModuleNotFoundError: No module named 'bulk-geocoding' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'Bulk-Import'
ModuleNotFoundError: No module named 'Bulk-Import'  Hi, My Python... 'Bulk-Import' How to remove the ModuleNotFoundError: No module named 'Bulk-Import' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'bulk-rename'
ModuleNotFoundError: No module named 'bulk-rename'  Hi, My Python... 'bulk-rename' How to remove the ModuleNotFoundError: No module named 'bulk-rename' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'bulk-renamer'
ModuleNotFoundError: No module named 'bulk-renamer'  Hi, My Python... 'bulk-renamer' How to remove the ModuleNotFoundError: No module named 'bulk-renamer' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'bulk-support'
ModuleNotFoundError: No module named 'bulk-support'  Hi, My Python... 'bulk-support' How to remove the ModuleNotFoundError: No module named 'bulk-support' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'djangorestframework-bulk'
ModuleNotFoundError: No module named 'djangorestframework-bulk'  Hi...: No module named 'djangorestframework-bulk' How to remove the ModuleNotFoundError: No module named 'djangorestframework-bulk' error? Thanks  
Mysql Date Manipulation
Mysql Date Manipulation       Mysql Date Manipulation find out the difference between two values... an example from Mysql Date Manipulation. To grasp this example, we create a table
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
What is the use of Hibernate Native SQL?
What is the use of Hibernate Native SQL?  What is the use of Hibernate Native SQL? How it is useful in database access programming using the Hibernate framework? Thanks   Hibernate Native query is used used to run SQL
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
ModuleNotFoundError: No module named 'could'
ModuleNotFoundError: No module named 'could'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'could' How to remove the ModuleNotFoundError: No module named 'could'

Ads