Skip to content

Files

Latest commit

 

History

History

HibernateSpringBootEnumStringInt

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Quickest Mapping Of Java Enums

Description: This application uses EnumType.ORDINAL and EnumType.STRING for mapping Java enum type to database. As a rule of thumb, strive to keep the data types as small as possible (e.g., for EnumType.ORDINAL use TINYINT/SMALLINT, while for EnumType.STRING use VARCHAR(max_needed_bytes)). Relying on EnumType.ORDINAL should be more efficient but is less expressive than EnumType.STRING.

Key points:

  • strive for smallest data types (e.g., for EnumType.ORDINAL set @Column(columnDefinition = "TINYINT"))

If you need a deep dive into the performance recipes exposed in this repository then I am sure that you will love my book "Spring Boot Persistence Best Practices"If you need a hand of tips and illustrations of 100+ Java persistence performance issues then "Java Persistence Performance Illustrated Guide" is for you.