As stated in a comment, this problem is database modeling. After modeling the bank, you create JPA entities (although some tutorials of JPA and other Orms suggest otherwise...).
(Option 1)
In this case a way would be to create a table called Precopordia with columns/attributes ID_CURSO, DIA_SEMANA, VALUE. If DIA_SEMANA is not enough, you can create more complex items in this Enum, such as Terqui (Tuesday and Thursday), Segquasex (Monday, Wednesday and Friday) and Desegasex (Monday to Friday).
(Option 2)
But I have a more complete suggestion:
Create two separate concepts: one is the Course and the other is, shall we say, the Application or Instantiating or something (the name you can perfect).
The Course table/class would contain only immutable course data such as name, category, programmatic content, prerequisites.
On the other hand, the Application table/class would have a reference to the course (ID_CURSO) and add specific data for that instance of the course: start and end date, room number, teacher, days of the week, price. Look at it this way: the same course can be taught by different teachers, in different rooms and can have different prices depending on the period (summer or winter, Tuesday+Thursday or Monday+Wednesday, Saturdays only, etc.) and still be the same course!
You can stop here or, if necessary, we can now resume the initial idea and create Precopordia (or Precoporperiodo) that I suggested at the beginning. In this case Applicationsocurso would not have the price directly, but would reference a value corresponding to one of the existing options, making some joins.
There are some details that need to be refined. Ex.: Will the pre-term contain the date of application of the course? If it does not contain, how will the adjustments be made in the coming years? If so, is the Precoporperiodo table not quite the same as the existing Application table? In this case it would be enough for the Application itself... That’s the problem for us to think about :-)
Creating and naming concepts separately from the beginning, you will not have a structure List<Map<List<DiasDaSemana>, Double>> precos
and yes List<AplicacaoCurso> cursos
. Then you can create search methods like findByDiaDaSemana using SQL as required.
And if you encapsulate in a new object something like: List<Early Then you map each object normally without much confusion.
– Dener
@Bruno, this seems to me more a question of database modeling than of JPA itself. We need to define first the set of tables that will store this information and then think about mapping with JPA.
– Dherik