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

  • Home
  • SEARCH
  • 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 9211421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:17:30+00:00 2026-06-18T01:17:30+00:00

Question about performance which will ultimately result in how I have my table structure

  • 0

Question about performance which will ultimately result in how I have my table structure set up.

I have Tables A, B, C and D.

Tables B, C and D are mapped to enumerations where all I’m doing is mapping the ordinal value to the enumeration value.

Table B:
ID: 1  String: ENUM_STR_VALUE
ID: 2  String: ENUM_STR_VALUE

Table A has the following schema

Name           Null       Type
------------------------------
ID         Not Null   Number(32)
Timestamp  Not Null   Date
Item_Type  Not Null   Number (32)
Item2_Type Not Null   Number (32)
Item3_Type Not Null   Number (32)

In table A…Item_Type, Item2_Type and Item3_Type are the ordinal values of Tables B, C and D respectively.

My problem comes down to how to display things to the user.

In my A.java I have the following code:

@Entity
@Table(name = "a")
public classs A{
  private int item_type;
  private int item2_type;
  private int item3_type;


  @Column(name="Item_type")
  public nit getItem_type(){
      return item_type; 
  }

Should I just ditch this normalization and make the item_types varchars and leverage the @Enumerated property of Hibernate? Or is there a way I can map back and display the values to the user. The reason being is I want to eventually query on those item types & searching by an int should be faster than a varchar.

  • 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-18T01:17:31+00:00Added an answer on June 18, 2026 at 1:17 am

    Use @Enumerated(EnumType.ORDINAL), and you’ll have the enum in your entities, mapped as the ordinal int value in the database table. That’s the default mapping for enums, if I’m not mistaken, so you can even remove the @Enumerated annotation, and Hibernate will persist the enum as an int automatically.

    PS: you should also respect the Java naming conventions: item_type should be itemType, and getItem_type() should be getItemType().

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

Sidebar

Related Questions

I have a question about a performance of stored procedures in the ADS. I
I am making a webapp. I have a fairly basic question about javascript performance.
I have read many question about improving the performance of C++ and C code
I am new to SQL and I have a basic question about performance. I
I have question about site performance. I have 4 large images (1920*500px) that need
I have question about database optimizing, indexing. I have table that called projects and
I have a system which will return all users from the database and order
Yesterday I've posted question about SQLite performance issues ( Terrible performance in Zend Db
Hey guys just a quick question about the performance of drawRect: as I've noticed
I have some questions about the performance of this simple python script: import sys,

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.