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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:25:22+00:00 2026-05-13T05:25:22+00:00

I have problem in creating tinyint field in MySQL database using Hibernate. I used

  • 0

I have problem in creating tinyint field in MySQL database using Hibernate.

I used to write the Entity class like this

@Entity

@Table(name=”tablename”)

public class MyEntity {

private int id;

@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="id")
public int getId() {
    return id;
}

public void setId(int id) {
    this.id = id;
}

}

And when I check MySQL, id field always end up with Integer(11) , how do I make it as TinyInt ?

Any answer would be appreciated

  • 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-05-13T05:25:22+00:00Added an answer on May 13, 2026 at 5:25 am

    I think there are a few ways of doing this. The first is to use the columnDefinition attribute on the @Column annotation to read something like this:

    @Column(name = "id", columnDefinition = "TINYINT")
    

    This is not portable across databases and does not align well with the variable itself being an int. A byte or short may be needed here

    Another way is to use the @Type annotation, probably with org.hibernate.type.ByteType since it seems to represent a TINYINT (link to javadoc).

    I hope this helps.

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

Sidebar

Related Questions

I have problem with creating a simple MySQL trigger in C#. I'm using StringBuilder
I have problem creating new instance of excel 2007 using VBA (from Access 2002).
I have an irritating problem, I'm creating an asp.net web service; this service should
Why I have problem creating a class inheriting from str (or also from int)
I am relatively new to using jQuery and I have a problem with creating
have a problem creating my new table in SqlLite3 I have created this migration
I have a problem creating a for-loop using Javascript. It seems everyting is fine
I'm using Matlab 7 and have a problem in creating a monoflop which shall
I have a problem creating my own librairie to send email. This is my
I have a problem creating a database schema for the following scenario: (I’m not

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.