有没有在Spring中获取数据库指标的方法?

huangapple go评论64阅读模式
英文:

Are there any methods to get database metrics in spring?

问题

我有一个简单的CRUD应用程序,它与PostgreSQL数据库一起使用。

所以我想知道,是否有收集数据库指标的方法,比如:
首次添加实体的日期,最后添加实体的日期,具有特定值的实体数量等等?

英文:

I have a simple CRUD application that works with PostgreSQL database.

So I would like to know, are there any methods for collecting database metrics such as:
Date of first added entity, date of last added entity, amount of entities with specific value, etc.?

答案1

得分: 0

你可以将这个业务逻辑简单地作为一个服务添加,并创建RESTful接口来传递数据,就像处理其他任何业务用例一样。

当我阅读到类似"具有特定值的实体数量"这样的内容时,这就是一个查询。

你可以使用Spring Data JPA方法来创建这些简单的查询。

类似于:

findByFieldEquals(String value);

这里是你可以使用的JPA关键词来构建查询

英文:

You can simply add this business logic as a service and create the RESTful interface to deliver the data, just as you would any other business use case.

When I read things like "amount of entities with specific value" - this is a query.

You can create these simply queries using Spring Data JPA methods.

Something like:

findByFieldEquals(String value);

Here are the JPA keywords you can craft queries with

huangapple
  • 本文由 发表于 2020年4月3日 20:42:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/61012168.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定