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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:52:44+00:00 2026-06-01T23:52:44+00:00

I have searched StackOverflow for some time now, but have not been successful so

  • 0

I have searched StackOverflow for some time now, but have not been successful so far.
Thus creating this Question…

I am currently using JPA, but I have come across a problem (at least, for me it is). Here is the situation:
I have created a system in which a user can be removed, though not removed from the database (for the sake of holding on to the orders of this particular user). For this to work, I have simply added a boolean to the Entity User. All good so far, but here comes the tricky part. As the usage of the system does not require any ‘removed’ users, I do not want to retreive them from the Database.

Is there any way to add a statement of some kind to the @Entity annotation? Or shouldn’t I be using @Entity at all, in this case?

Thanks in advance for the help!

PS. I am not looking for a solution in which I would have to create an User_OLD table of some kind.

  • 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-01T23:52:46+00:00Added an answer on June 1, 2026 at 11:52 pm

    First, I suggest renaming column “removed” to “inactive”, because you do not remove user.

    For retrieving entities, there are two choices here:

    • Create USER_ACTIVE VIEW in database based on inactive == false and
      change your @Entity to use USER_ACTIVE view.
    • Add WHERE inactive == false clause on retrieval from USER table.

    If you have Entity, which holds Collection of Users, which is annotated with @FetchType.LAZY:

    • Fetch users when needed with the same where clause as defined above.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I searched StackOverflow but couldn't find the answer to this question. Suppose I have
I've searched StackOverflow and google for quite some time now and haven't been able
I have searched far and wide on the Internet but have not found anything
I have been working with managing agile teams for quite some time. Now I'm
I have searched this question but didn't get / or understood the answer I
I have searched all over the Google and StackOverFlow, but still did not find
I have searched around Google and StackOverflow trying to find a solution to this,
I have searched a lot but not able to find particular solution. There are
I am not sure if StackOverflow is the right service to ask this question
This has been bothering me for quite some time. I'm simply trying to change

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.