Satish
Satish

Reputation: 127

Hibernate Fetching large number of records

I am working on a project which needs to fetch a large number of records, as I know that hibernate is limiting the session cache. I am also aware about the basic pagination.

Is there a more elegant solution for this issue?

Upvotes: 0

Views: 267

Answers (1)

Vinay Veluri
Vinay Veluri

Reputation: 6865

Large number of data !! Depends on the type of data being retrieved.

Scenario 1:

Data being retrieved from a single table means single domain class.
i.e. Only a table having no foreign key relationships with any of the other table.

In this case,

either limit the data retrieved by the query or pagination.

Scenario 2:

Data is related to many classes or table, having foreign key relations.

Use something like this --> @OneToMany(fetch = FetchType.LAZY)
Annotation depends on the type of relation that you have.
i.e., OneToMany, ManyToOne...

Hope this helps

Upvotes: 0

Related Questions