I have an interface called 'Category' and 4 enum implementing this interface. Those enums are decided in categories and have different types in it. Example:
#Interface
interface BillCategory
#Enum 1
public enum GroceryPurchase implements BillCategory {
VEGAN,
VEGETARIAN,
PESCITARIAN,
FLEXITARIAN,
OMNIVORE
#Enum 2
enum ElectronicPurchase implements BillCategory{
SMARTPHONE, HARDWARE, SOFTWARE }
I aded the field to an entity class.
private BillCategory billCategory;
And when I start the Spring Environemnt I get the following Hibernate/JPA error:
Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not determine type for: net.wizypay.wizypay.bill.model.BillCategory, at table: bill_entity, for columns: [org.hibernate.mapping.Column(bill_category)]
How can I solve this problem? I do not want to summarise the enums to one. Is there a better approach? Or just impossible to persist such data.