Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6578197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:44:24+00:00 2026-05-25T15:44:24+00:00

I am using struts and hibernate in my problem. I tried the following query

  • 0

I am using struts and hibernate in my problem. I tried the following query

String hql ="insert into  "+
        "OPENQUERY(OracleLinkedServer, \'SELECT * FROM     report_access_log\') "+
        "(CALLINGHOST, ACCESSTIMESTAMP, HTTPREQUESTMETHOD, ACCESSURL,"+ 
        "HTTPRESPONSECODE, HTTPRESPONSETIMEMILLI, USERNAME, REPORTNAME, ID)"+
        " values "+
         "(:CALLINGHOST,:ACCESSTIMESTAMP,:HTTPREQUESTMETHOD,:ACCESSURL,:HTTPRESPONSECODE," +
         ":HTTPRESPONSETIMEMILLI,:USERNAME,:REPORTNAME,"+ 
         "(select * from OPENQUERY(OracleLinkedServer,"+ 
                 "\'select SQ_RPT_ACC_LOG_ID.nextval from dual\')))";
        Query query=session.createQuery(hql);
        query.setString("CALLINGHOST", userLogReport.get(0).toString());
        query.setDate("ACCESSTIMESTAMP", (Date)userLogReport.get(1));
        query.setString("HTTPREQUESTMETHOD", userLogReport.get(2).toString());
        query.setString("ACCESSURL", userLogReport.get(3).toString());
        query.setString("HTTPRESPONSECODE", userLogReport.get(4).toString());
        query.setInteger("HTTPRESPONSETIMEMILLI", (Integer)userLogReport.get(5));
        query.setString("USERNAME", userLogReport.get(6).toString());
        query.setString("REPORTNAME", userLogReport.get(7).toString());

The query printed on the console is as follows

insert into  OPENQUERY(OracleLinkedServer, 'SELECT * FROM report_access_log')     
(CALLINGHOST, ACCESSTIMESTAMP, HTTPREQUESTMETHOD, ACCESSURL,HTTPRESPONSECODE, 
HTTPRESPONSETIMEMILLI, USERNAME, REPORTNAME, ID) values 
(:CALLINGHOST,:ACCESSTIMESTAMP,:HTTPREQUESTMETHOD,:ACCESSURL,:HTTPRESPONSECODE:HTTPRESPONSE
TIMEMILLI,:USERNAME,:REPORTNAME,(select * from OPENQUERY(OracleLinkedServer,'select 
SQ_RPT_ACC_LOG_ID.nextval from dual')))

i get a query syntax exception at column no 79 which is (CALLINGHOST,…

But when i ran the query in SQL it is getting executed. The query is as follows

insert into  OPENQUERY(OracleLinkedServer, 'SELECT * FROM report_access_log') 
(CALLINGHOST, ACCESSTIMESTAMP, HTTPREQUESTMETHOD, ACCESSURL,HTTPRESPONSECODE, 
HTTPRESPONSETIMEMILLI, USERNAME, REPORTNAME, ID) values 
('10.87.192.246','GET','/cci/bby/ImageViewer/viewImages.action','200',6,'su','Insert 
Review',(select * from OPENQUERY(OracleLinkedServer,'select SQ_RPT_ACC_LOG_ID.nextval 
from dual')))

Please explain the problem and provide me a solution for executing it from Java.
Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:44:24+00:00Added an answer on May 25, 2026 at 3:44 pm

    HQL and SQL are two different languqges. HQL works on Hibernate entities, their properties, and associations between them. SQL works on database tables and columns.

    Use

    Query query = session.createSQLQuery(sql); 
    

    rather than

    Query query = session.createQuery(hql);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Tomcat Version :5.0.28 JDK: 1.5.0.14 The problem: I am using both hibernate and struts
I'm writing a website in JSP using Struts and Hibernate. I'm looking for a
I am developing a web application using Struts 2.1.2 and Hibernate 3.2.6.GA. I have
I am using hibernate 3.2 with struts 1.2 framework here is the details of
I am using hibernate, struts, extjs in my project. I have a Customer object
I am using hibernate, spring, struts framework for my application. In my application, each
I'm trying to save a data in a simple form through Hibernate using struts
I have legacy application using struts & ejb2.0 , hibernate v3.0 running on JBoss
I'm trying to make a project using struts 2, spring 3 and hibernate, but
I have developed demo application using spring struct and hibernate and getting following error

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.