I have the following problem and would like some opinion to know the best approach:
Let's suppose that you have a system that manages a school and would like to have the option for the administrator of the system in which it can register a modality / lesson that is and link prices according to the days of the week available for that class .
For example:
- JPA class is available for MONDAY, FOURTH and SIXTH for 50 reais, or THIRD and FIFTH for 35 reais;
- JSF class is available from MONDAY to FRIDAY for 80 reais, or TUESDAY, FOURTH and FIFTH for 40 reais.
That is, give the option to the administrator to create a price according to the days of the week. What would be the best option for JPA mapping?
Initially I created a Enum
with every day of the week and thought about creating something like List<Map<List<DiasDaSemana>, Double>> precos
, somewhat confusing right?
Does anyone have any idea how best to solve this, and if that is an acceptable way to map what kind of mapping to do? Through @ElementCollection
? Any help is welcome!