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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:04:12+00:00 2026-06-07T17:04:12+00:00

We are generating Sales Report using Hibernate. Scenario When user clicks on generate report

  • 0

We are generating Sales Report using Hibernate.

Scenario

When user clicks on generate report button after entering some criteria, I am fetching data from database using hibernate, then we are doing some data manipulation to generate actual report data. Report data is stored in ArrayList, which then persisted into database in CommissionSummary table, which is mapped with hibernate entity as below

CommussionSummary.java

@Column(length=100)
private String advisorName;
private String advisorCodeParent;
@Column(length=100)
private String advisorNameParent;
@Column(length=100)
private String advisorPost;
@Column
private Double percentage;
@Column
private Double diffPercentage;
@Column
private Double saleAmount;
@Column
private Long saleCount;
@Column
private Double commissionAmount;
@Column
private Integer month;
@Column
private Integer year;

Report is generated for every month.
My Question is: For 05 July 2012 user has generated data so i am storing this information in CommissionSummary table. Now user has generating the same report on 15 July 2012, then it should override earlier month data.

Override criteria should be month and year.

  • 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-07T17:04:15+00:00Added an answer on June 7, 2026 at 5:04 pm

    I believe what you need is a simple data checking.
    Solution One:
    1. Load data from DB and check those data for possible duplication.
    2. If you find them equal, delete the older version.

    Solution Two:
    One other possible solution is to define your columns unique, so if a user wants to put the same data, he will be receiving some exceptions. Something like this:

    @Table(name="TABLE_NAME", uniqueConstraints = {
    @UniqueConstraint(columnNames={"advisorName", "advisorNameParent", "advisorPost", "percentage", "diffPercentage" , "saleAmount", "saleCount", "commissionAmount" })
    
    @Column(name = "ADVISOR_NAME", length=100)
    private String advisorName;
    private String advisorCodeParent;
    @Column(name = "ADVISOR_PARENT_NAME", length=100)
    private String advisorNameParent;
    @Column(name = "ADVISOR_POST" , length=100)
    private String advisorPost;
    @Column(name = "PERCENTAGE")
    private Double percentage;
    @Column (name = "DIFF_PERCENTAGE")
    private Double diffPercentage;
    @Column (name = "SALE_AMOUNT")
    private Double saleAmount;
    @Column (name = "SALE_COUNT")
    private Long saleCount;
    @Column (name = "COMMISSION_AMOUNT")
    private Double commissionAmount;
    

    Using this, you can check if there were some errors you can do your desired action.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Generating a scaffold like this: rails generate scaffold User name:string email:string creates bits of
I am generating an invoice for various clients. Some clients have a sales allowance.
As I understand it, the best practice for generating salts is to use some
Im generating a file to present to the user for download, but the server
I'm generating json from a Rails app, and am filtering fields using the format.json
I have a example for dynamic jasper report. I am using NetBeans IDE. I
This is a simple and common scenario at work, and I'd appreciate some input.
I’m generating PDF files from my C# 4.0 windows application using iTextSharp API. I’ll
After generating / writing / running a Rails database migration, should the migration file
We have a Crystal Report that lets the user pick which of several fields

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.