How to get the postgresql column names in java springboot

Viewed 685

I'm trying to get the postgresql table column name. I've tried using information_schema but it doesn't work on my java mvc project. What should I do ?

This is actually my first question on StackOverflow, so I'm sorry if my question is difficult to understand. Thank you!

public interface MyFileRepository extends JpaRepository<MyEntityModel, Long> {
    @Query("select column_name,data_type from information_schema.columns where table_name = 'MyEntityModel';")
    List<MyEntityModel> myList();
}
1 Answers
Related