开发者

Hibernate Unable to Start On Large-Scale Database

开发者 https://www.devze.com 2022-12-08 16:46 出处:网络
I have been using Hibernate + HSQLDB on my desktop for developing a database adapter for my application. For legacy reasons, the IDs are generated by the application as strings. All was working fine t

I have been using Hibernate + HSQLDB on my desktop for developing a database adapter for my application. For legacy reasons, the IDs are generated by the application as strings. All was working fine then.

Now, we have a pre-prod database, with a bit more than a million records. I had to do some changes (e.g. identifier too long) on the Hibernate side, but nothing major.

That is, until I got to this problem. When I try to start my application on the pre-prod server, Hibernate starts making a gazilli开发者_如何学编程on queries, which eventually end up in a OutOfMemoryError: Java heap space. Increasing the heap max is not helping.

I have disabled C3PO cache settings and disabled hibernate.hbm2ddl.auto. I don't know why it is making these queries, and I don't know how to disable them.

Can anyone help me??????


You told Hibernate to fetch eagerly. So when you load the first object, Hibernate starts to fetch all related objects, too.

You must set all unnecessary relations to fetch=LAZY.

0

精彩评论

暂无评论...
验证码 换一张
取 消