I have an entity called Note which has an attribute text, and I implemented a JpaRepository as follow:
@Entity
@Data
public class Note {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String title;
private String text;
}
public interface NoteRepository extends JpaRepository<Note, Long> {
}
in my view I want to show just a chunk of the column text, in SQL it would be substr(text, 1, 200), I could use java substring but I'd like to retrieve the text from database already chunked and inject the result into the Note.text attribute, is it possible?