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

  • Home
  • SEARCH
  • 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 8001231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:02:30+00:00 2026-06-04T16:02:30+00:00

I am using join query through createQuery in JPA. I have 2 tables MasterScrip

  • 0

I am using join query through createQuery in JPA. I have 2 tables MasterScrip and OrderMaster. Entity code is given below. The dynamic query is returning collection object. I debugged and found that the query executes and returns collection object correctly; but, after the object returned an error, shown below:

   [javax.xml.bind.JAXBException: class [Ljava.lang.Object; nor any of its super class is known to this context.]
    javax.xml.ws.WebServiceException: javax.xml.bind.MarshalException...

    SEVERE: Error Rendering View[/ClientTemplate/orderReport.xhtml]
    javax.el.ELException: /ClientTemplate/orderReport.xhtml @14,142 value="#{stockOrderBean.scripLst}": com.sun.xml.ws.streaming.XMLStreamReaderException: unexpected XML tag. expected: {http://service/}getOrderScripByUserNameResponse but found: {http://schemas.xmlsoap.org/soap/envelope/}Envelope
        at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:114)

Stateless bean method:

 public Collection<MasterScrip> getOrderScripByUserName(String userName)
{        
    try
    {
        String squery = "select DISTINCT(s.scripSymbol),s.scripID from MasterScrip s,OrderStock o where o.scripID.scripID = s.scripID and o.userName.userName = '" + userName + "'";
        Collection<MasterScrip> c = em.createQuery(squery).getResultList();
        //UserMaster um = em.find(UserMaster.class,userName);
        return c;
    } catch(Exception e) {
        System.out.println(e);
        return null;
    }
}

What is the cause of this error? How do I solve it?

  • 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-06-04T16:02:31+00:00Added an answer on June 4, 2026 at 4:02 pm

    First, as noted in the comments, you should always use parameters instead of concatenating parameter values:

    select DISTINCT(s.scripSymbol), s.scripID from MasterScrip s, OrderStock o 
    where o.scripID.scripID = s.scripID and o.userName.userName = :userName
    

    This would prevent SQL injection attacks, or simply incorrect queries in case of a user name like O'Reilly for example.

    Your query returns two different columns. There is no way for such a query to magically return instances of MasterScrip. It returns a List<Object[]>, where each Object[] contains two values: the scripSymbol and the scripID.

    The query would return instances of MasterScrip if it was

    select distinct s from MasterScrip s, OrderStock o 
    where o.scripID.scripID = s.scripID and o.userName.userName = :userName
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have the query below. Using a LEFT OUTER join takes 9 seconds to
I have some older (broken) code that has a join using a *= table1.ID
I have a big mysql query which needs to trawl through 4 tables to
i'm using cursor to loop through a self join table. the query that i
I'm using a many-to-many database with join tables connecting main data tables through foreign
I have a query that returns a bunch of information and using a join
I am using this query: SELECT DISTINCT pat.PublicationID FROM dbo.PubAdvTransData AS pat INNER JOIN
Whats the difference between using a LEFT OUTER JOIN , rather than a sub-query
Consider i am using join on three tables to get a desired result-set... Now
Any idea how to join multiple tables in ssis programatically using Merge Join ?

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.