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 8420847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:58:17+00:00 2026-06-10T02:58:17+00:00

I want to write the below SQL query in HQL – select * from

  • 0

I want to write the below SQL query in HQL –

select * from ITPMAST 
inner join STKMAST on ITPMAST.ITPITP=STKMAST.stkstk where STKMAST.STKSIT='S101'

Itpmast class

public class Itpmast implements java.io.Serializable {

    private String itpitp;
    private Sizmast sizmast;
    private User usdmastByItpaddusd;
    private User usdmastByItpamdusd;
    private Prmmast prmmast;
    private Sctmast sctmast;
    private String itpnam;
    private short itpfcn;
    private short itptcn;
    private BigDecimal itpcpr;
    private BigDecimal itpspr;
    private String itpactyn;
    private String itpbscode;
    private String itpcolor;
    private BigDecimal itpspr1;
    private BigDecimal itpspr2;
    private BigDecimal itpspr3;
    private Date itpsactddt1;
    private Date itpsactddt2;
    private Date itpsactddt3;
    private Date itpaddddt;
    private String itpaddtime;
    private Date itpamdddt;
    private String itpamdtime;
    private Short itpbscodeord;
    private String itptrnactno;
    private String itpactcode;
    private Date itpsactddt;
    private String itpprtflg;
    private Set<Skumast> skumasts = new HashSet<Skumast>(0);
    private Set<Igpmast> igpmasts = new HashSet<Igpmast>(0);
    private Set<Dismastb> dismastbs = new HashSet<Dismastb>(0);
    private Set<Dismastd> dismastds = new HashSet<Dismastd>(0);
    private Set<Rbttran> rbttrans = new HashSet<Rbttran>(0);
    private Set<Lytmast> lytmasts = new HashSet<Lytmast>(0);
    private Set<Stkmast> stkmasts = new HashSet<Stkmast>(0);
    private Set<Sslmast> sslmastsForSslitp = new HashSet<Sslmast>(0);
    private Set<Sslmast> sslmastsForSslssl = new HashSet<Sslmast>(0);
}

Stkmast class

public class Stkmast implements java.io.Serializable {

    private StkmastId id;
    private User usdmastByStkamdusd;
    private User usdmastByStkaddusd;
    private Sctmast sctmast;
    private Sitmast sitmast;
    private Itpmast itpmast;
    private BigDecimal stksohqty;
    private BigDecimal stksohqty01;
    private BigDecimal stksohqty02;
    private BigDecimal stksohqty03;
    private BigDecimal stksohqty04;
    private BigDecimal stksohqty05;
    private BigDecimal stksohqty06;
    private BigDecimal stksohqty07;
    private BigDecimal stksohqty08;
    private BigDecimal stksohqty09;
    private BigDecimal stksohqty10;
    private BigDecimal stksohqty11;
    private BigDecimal stksohqty12;
    private BigDecimal stksohqty13;
    private BigDecimal stksohqty14;
    private BigDecimal stksohqty15;
    private BigDecimal stksohqty16;
    private BigDecimal stksohqty17;
    private BigDecimal stksohqty18;
    private BigDecimal stksohqty19;
    private BigDecimal stksohqty20;
    private Date stkaddddt;
    private String stkaddtime;
    private Date stkamdddt;
    private String stkamdtime;
    private String stkcat;
    private Date stkltddt;
    private Date stklsalddt;
    private Date stklpurddt;
    private Date stklsalrtddt;
    private Date stklpurrtddt;
    private Date stklshortddt;
    private Date stklexcessddt;
    private Date stkltransferin;
    private Date stkltransferout;
    private BigDecimal stkmedsohqty;
    private BigDecimal stkmedsohqty01;
    private BigDecimal stkmedsohqty02;
    private BigDecimal stkmedsohqty03;
    private BigDecimal stkmedsohqty04;
    private BigDecimal stkmedsohqty05;
    private BigDecimal stkmedsohqty06;
    private BigDecimal stkmedsohqty07;
    private BigDecimal stkmedsohqty08;
    private BigDecimal stkmedsohqty09;
    private BigDecimal stkmedsohqty10;
    private BigDecimal stkmedsohqty11;
    private BigDecimal stkmedsohqty12;
    private BigDecimal stkmedsohqty13;
    private BigDecimal stkmedsohqty14;
    private BigDecimal stkmedsohqty15;
    private BigDecimal stkmedsohqty16;
    private BigDecimal stkmedsohqty17;
    private BigDecimal stkmedsohqty18;
    private BigDecimal stkmedsohqty19;
    private BigDecimal stkmedsohqty20;
}

My best attempt was

from Stkmast s 
join fetch s.itpmast i where s.sitmast.sitsit=:siteCode and i.itpitp like :code 

But this HQL query produces many SQL queries to obtain data. Thanks.

  • 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-10T02:58:19+00:00Added an answer on June 10, 2026 at 2:58 am

    You need to set the fetch type to join instead of the default select in the mapping.

    Example:

    <hibernate-mapping>
        <class name="com.mkyong.common.Stock" table="stock">
            <set name="stockDailyRecords"  cascade="all" inverse="true" 
                table="stock_daily_record" batch-size="10" fetch="join">
                <key>
                    <column name="STOCK_ID" not-null="true" />
                </key>
                <one-to-many class="com.mkyong.common.StockDailyRecord" />
            </set>
        </class>
    </hibernate-mapping>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write an SQL statement like below: select * from tbl where
I have below SQL query: SELECT * FROM ( SELECT S.aCol, S.bCol, S.cCol, ROW_NUMBER()
I am doing project in cakephp . I want to write below query in
I want write a simple query which will fetch data from a table (which
how can i write the select case statement in t-sql ? My Code below
Guys i want to write an oracle sql query for table A of the
I want to write the below InsertInto query in Hibernate Criteria. Any Suggestions ..
I have the sql query below. I want to take the results and insert
How do I write an sql query to display items from 2 tables based
I have a access query as below : select column_date, sum(qty1), sum(qty2), sum(qty3) from

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.