I've used a specific DTO, when i have an empty enum with no elements and inner public static classes with interfaces for fields:
public enum AccountDTO {
;
private interface Id {
@Positive Long getId();
}
private interface Name {
@NotBlank String getName();
}
private interface Email {
@NotBlank String getEmail();
}
private interface DateOfBirth {
@Past LocalDate getDateOfBirth();
}
@Data
public static class Update implements Id, Name, DateOfBirth {
Long id;
String name;
LocalDate dateOfBirth;
public Update(Account account) {
this.id = account.getId();
this.name = account.getName();
this.dateOfBirth = account.getDateOfBirth();
}
}
}
So, now i need to use this DTO in repository with @Query
@Query("select new ci.ashamaz.auth.dto.AccountDTO.Update"
+ "(a, true)"
+ " from Account a "
+ " group by a ")
Page<AccountDTO.Update> getAllAccountsUpdate(Pageable pageable, boolean needBlameInfo);
Now the word Update is underwritten with message "Can't resolve symbol 'ForAdmin'" As far as i understand, when we write in quotes the class name with package, all dots are interpret as package folders. So, is there any way to use inner static class with JPA @Query ?