I am reading my SQL queries from property file and the same I am passing to @Query(value=xyz) but getting consistent error "Attribute value must be constant". Is there any solution available for this?
public class QueryUtils {
public static Properties properties;
static {
try {
FileReader reader = new FileReader("sql.properties");
properties = new Properties();
properties.load(reader);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public static String findAllTags2 = properties.getProperty("ResourceTagRepository.find_all_tags");
}
I am trying to use it in blow code.
@Component
@Repository
public interface QueryRepo extends JpaRepository<XYZ, Long>, JpaSpecificationExecutor<XYZ> {
@Query(value = findAllTags2)
public List<ResourceTagMapping> findAllTags(@Param("list") Set<String> names);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…