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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:27:05+00:00 2026-06-14T11:27:05+00:00

I was wondering if there is a way to have a filter annotation with

  • 0

I was wondering if there is a way to have a filter annotation with a hard coded values. I am joining two tables called itemRate and ratemaster. Rate master has a composite key of application rateid and ratekind id. The rate kind id can be 1 of 3 id’s (primary, component, item rate).

My Item Rate table knows the application and references two different columns item_rate and rate (which is the primary rate),

My question is, is there a way with hibernate to hard code a filter so when i call getRate() it will filter on all rates with a rate kind id of 0 and when i call getItemRate() it will filter on all rates with a ratekind id of 2?

I tried doing something like this to get the rate masters with a rate kind of 0:

@ManyToOne(fetch = FetchType.EAGER)
@JoinColumns({
    @JoinColumn(name = "CIITM_RATE", nullable = false , updatable = false, insertable = false, referencedColumnName = "RATE"),
    @JoinColumn(name = "CIITM_APPLICATION", nullable = false , updatable = false, insertable = false, referencedColumnName = "APPLICATION") })
@FilterJoinTable(name = "kindId", condition="RATEKINDID = 0")
public Ciratemaster getRateMaster() {
    return rateMaster;
}

and this to get rate masters with rate kinds of 2:

@ManyToOne(fetch = FetchType.EAGER)
@JoinColumns({
    @JoinColumn(name = "CIITM_ITEM_RATE", nullable = false , updatable = false, insertable = false, referencedColumnName = "RATE"),
    @JoinColumn(name = "CIITM_APPLICATION", nullable = false , updatable = false, insertable = false, referencedColumnName = "APPLICATION") })
@FilterJoinTable(name = "kindId", condition="RATEKINDID = 2")
public Ciratemaster getItemRateMaster() {
   return itemRateMaster;
}

I tried searching hibernate website and other sites and nothing has really worked. I always come up with the error that it fetched more than 1 result when it shouldn’t

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-06-14T11:27:06+00:00Added an answer on June 14, 2026 at 11:27 am

    Try this instead of filters:

    @org.hibernate.annotations.Where(clause = "RATEKINDID = 2")
    

    Edit: Try the JoinColumnsOrFormula annotation:

    @JoinColumnsOrFormulas({
      @JoinColumnOrFormula(formula = @JoinFormula(value = "2", referencedColumnName = "RATEKINDID")),
      @JoinColumnOrFormula(column = @JoinColumn(name = "CIITM_RATE", nullable = false , updatable = false, insertable = false, referencedColumnName = "RATE")),
      @JoinColumnOrFormula(column = @JoinColumn(name = "CIITM_APPLICATION", nullable = false , updatable = false, insertable = false, referencedColumnName = "APPLICATION"))
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two regular expressions: /\/(\w\w+)/g /(^\w\w+)/g and am wondering if there's any way
I was wondering if there is a way to filter rows which have a
I was wondering if there's any way to have a scipy.sparse.csc_matrix format for mlpy
Just wondering if there is a way in Spring to have a parent controller:
I am wondering if there is some way to make an box have the
If I have this line and I'm wondering if there's better way to do
I was wondering if there a way I can pass two or more variables
Just wondering is there any way I can check whether the url links to
I was wondering is there a way to give the user a small guided
I was wondering is there a way in visual studio 2010 to search in

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.