Redian新闻
>
find all tables used in a hibernate/jdbc project?
avatar
find all tables used in a hibernate/jdbc project?# Java - 爪哇娇娃
c*n
1
I would need to replicate all the tables used in my project to another DB,
which has less background load,
the existing project uses a combination of JDBC and hibernate, with
hibernate being the majority.
I guess I COULD scrape hibernate query logs and find the tables accessed,
but that presents problems since in the test or production, the test data
may omit some access patterns.
is there some code analysis tool to generate all the tables accessed by a
hibernate project?
avatar
e*t
2
why not just export and import your db schema?

【在 c******n 的大作中提到】
: I would need to replicate all the tables used in my project to another DB,
: which has less background load,
: the existing project uses a combination of JDBC and hibernate, with
: hibernate being the majority.
: I guess I COULD scrape hibernate query logs and find the tables accessed,
: but that presents problems since in the test or production, the test data
: may omit some access patterns.
: is there some code analysis tool to generate all the tables accessed by a
: hibernate project?

avatar
c*n
3
for example my DB has 1000 tables,
but my project only uses 100,
theoretically I only need to replicate those 100 tables to the new DB,
which takes much less load on both the new and old db than replicating all
the 1000

【在 e*****t 的大作中提到】
: why not just export and import your db schema?
avatar
g*g
4
Practically replicating DB online doesn't sound a good idea, as you'll
lose some data on the go.

【在 c******n 的大作中提到】
: for example my DB has 1000 tables,
: but my project only uses 100,
: theoretically I only need to replicate those 100 tables to the new DB,
: which takes much less load on both the new and old db than replicating all
: the 1000

avatar
c*n
5
?
oracle db provides replication natively, it's very common.

【在 g*****g 的大作中提到】
: Practically replicating DB online doesn't sound a good idea, as you'll
: lose some data on the go.

avatar
r*s
6
tho I don't like the idea to replicate db in this way,
this is how you can achieve what you want:
Write an interceptor that extends EmptyInterceptor,
overrides all the cases
onLoad/onSave/onDelete/...
and save the table/class names.
Register it as hibernate.ejb.interceptor.

【在 c******n 的大作中提到】
: I would need to replicate all the tables used in my project to another DB,
: which has less background load,
: the existing project uses a combination of JDBC and hibernate, with
: hibernate being the majority.
: I guess I COULD scrape hibernate query logs and find the tables accessed,
: but that presents problems since in the test or production, the test data
: may omit some access patterns.
: is there some code analysis tool to generate all the tables accessed by a
: hibernate project?

avatar
c*n
7
cool thanks

【在 r*****s 的大作中提到】
: tho I don't like the idea to replicate db in this way,
: this is how you can achieve what you want:
: Write an interceptor that extends EmptyInterceptor,
: overrides all the cases
: onLoad/onSave/onDelete/...
: and save the table/class names.
: Register it as hibernate.ejb.interceptor.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。