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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:28:51+00:00 2026-06-04T03:28:51+00:00

I have multiple tables with a lot of data in it. I’m only mentioning

  • 0

I have multiple tables with a lot of data in it. I’m only mentioning things pertinent to the question. For rendering data on the jsp, I only need selective data from different tables.

In reference to travel-vacation, lets say I have to retrieve and render holiday package name, itinerary duration and total price per defaults.

  • Holiday package name is in table HolidayPackage (id, name)
  • Itinerary duration in table Itinerary Itinerary (idPkg, idItinerary, dayNum) = (SUM aggregate of itinerary rows for a given package )
  • Price is defined in two different tables base price and total price

    = (Sum( base(idPkg) + total(idPkg) ))

How can I retrieve selective data from these database tables to render the name, itinerary duration and total price for a given holiday package ?

I am using Hibernate with mysql as my database.

Thoughts:

Can I use a view to fetch data into my custom java object Result where Result is defined as:

class Result{
 String name;
 Intger itineraryDuration;
 BigDecimal totalPrice;
}

Also, can I use functions as the definition of column values in views ?

  • 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-04T03:28:53+00:00Added an answer on June 4, 2026 at 3:28 am

    What I do with views is I create an immutable hibernate model class and associated DAO to query the model class.

    I annotate the model class as follows:

    @Entity
    @Immutable
    @Table(name = "CLASSIFICATION_LABELS_V", schema = "CORPORATE")
    

    I also set the setters to protected, but this is optional.

    If the view is structured similar to an existing model class, you can use a named query and map it to your model using the resultClass attribute. The following is for Oracle so if using anything else, the query parameter would be different.

    @NamedNativeQueries({
        @NamedNativeQuery(name = "create_product_from_template", query = "call pkg_authoring.sp_create_prod_from_template(?, :productId, :templateId)", resultClass = TblProduct.class, callable = true)
    })
    

    In hibernate, you can use functions as follows:

    @Formula(value = "(select fnHasProducts(customerId) from dual)")
        @AccessType("property")
        private Integer products = 0;
    
    @Formula(value = "(select fnAssigneeForProduct(productId) from dual)")
        private Integer assignee = 0;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple tables that need to be merged into one. SELECT name, SUM(money)
Often I need to combine data from multiple tables and display the result in
I have multiple data tables per page, ranging from 4 to 8 ish. All
I have multiple tables in a MySQL database. Lets say they look like this:
I have multiple tables in a mysql database and I am trying to put
I will have multiple tables used by different projects on the same mySql server.
I have created Windows Application. In this, I have multiple tables in dataset, now
I have database with multiple tables in Microsoft SQL Server with schema in tables
I have multiple level parent-child tables(GrandParent, Parent and Child, all many to one relation,
I have a dataset with multiple tables. One table in particular has one record

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.