Posts Tagged - hibernate

How to link an intermediary table

(This was done with MySQL, Hibernate and Lombok)

Setting: We have two Entities, Category and Code. Some categories must contain x codes, others cannot contain y codes and we want to leave open the possibility to “must contain z but not p” at the same time.

How: At database level we’ll have 4 tables with the following structure

client_category

FIELD_NAME FIELD_TYPE CONSTRAINTS
id bigint(19) PK (primary key)
example_string varchar(255)  
example_bool tinyint(1)  

Read More