In my database, I have 2 table is Categories and Products.
The Products table has a reference key references to CategoryId in the Categories table.
And in my Java Project, I have 2 entities: Category and Product.
So I wonder does the Product class have to extends Category class?
In your case you need to add Category like a attribut in your Product Class.
You can add a list of Product in your Category class for biderctionnal relation.