English 中文(简体)
如何改善爪哇的休眠表现?
原标题:How to improve Hibernate performance in Java?

我有上千个记录,需要用一个用户点击来检索。目前,它给我的结果非常缓慢,我必须等待很长时间。是否有办法用冬眠来改进这些结果的检索?

我有一个案例, 一个有选择查询的方法 将每分钟运行一次。 这是Hibernate给我的慢结果。 我使用与 MySQL 的休眠 。

最佳回答

通常的做法是启用二级缓存和查询缓存。 您的数据不会从 db 中读取, 而不是从记忆中读取 。

http://www.javalobby.org/java/forums/t48846.html" rel="noreferrer" >这里

其他事情可以有所帮助:

1 索引化 - 如果有位置和顺序, 您需要为您正在搜索/ 排序的字段建立索引 - 这样可以提高搜索速度10 次

2 非正规化――如果你有很多人加入的话, 某些非正规化(将全部列在单张表格中)可以起到帮助作用。 但是,当其他一切失败时,这应该是最终的解决办法。

问题回答

我建议你使用Puginating ,如果你必须在网页上显示记录并同时检索部分记录(100)的话。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签