I suggest unifying these 2 attributes in one field only, using the type originating from Java 8:
@Getter
@Setter
private LocalDateTime dhOcorrencia;
In addition to various benefits, such as immutability, fluent interface, easy manipulation (basic operations such as summation, subtraction, calculation of periods), processing of invalid dates, you will have more ease to sort by this information.
Some examples of the use of LocalDateTime
:
LocalDateTime hojeAoMeioDia = LocalDate.now().atTime(12,0);
LocalTime agora = LocalTime.now();
LocalDate hoje = LocalDate.now();
LocalDateTime dataEhora = hoje.atTime(agora);
LocalDateTime dateTime = LocalDateTime.of(2014, 12, 25, 10, 30);
This depends on what you want to do with these dates. java 8 has released a new API for dates (java.time) that I found particularly interesting. With it you could use Localdate and Localtime, with the advantage of being thread-safe (java.util.Date is not) and much simpler to use.
– Sérgio Mucciaccia