Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3792130
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:34:30+00:00 2026-05-19T12:34:30+00:00

@ManyToOne @JoinColumn(name = play_template_id, table = team_play_mapping ) public Play getPlay() { return play;

  • 0
@ManyToOne
@JoinColumn(name = "play_template_id", table = "team_play_mapping" )
public Play getPlay() {
    return play;
}

public void setPlay( Play play ) {
    this.play = play;
}

By default, this is eager loading. Can I get it so that it will read the play object from a cache without making it lazy loading? Am I correct that eager loading will force it to do a join query and hence no caching?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T12:34:31+00:00Added an answer on May 19, 2026 at 12:34 pm

    Eager loading and lazy loading are fetch strategies. Meaning that if you specify “eager” loading, it will do as few queries as possible, while if you specify “lazy” it will post pone the query for that object as much as possible (risking performing more queries). So, if you want something to be retrieved from the cache, you want a lazy loading strategy, ie: do not retrieve from the database unless necessary.

    What you can try, however, is to apply a certain fetch profile based on which code is doing the query. For instance, at some point of the code, your query knows that it’s better to eager load Play, while later you know it’d be better to lazy load Play.

    http://docs.jboss.org/hibernate/core/3.5/reference/en/html/performance.html#performance-fetching-profiles

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All what Hibernate reverse engineering generates is something like this @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name
Here's my entity: @Entity @Table( name = tbl_license ) public class License implements Serializable
I have the 2 following entities: @Entity @Table(name = brand) public class Brand {
@Entity public class Store {} @Entity @Table(name = storeitem) public class StoreItem { @Id
i have this POJO mapped to my MySQL database: @Entity @Table(name = participantespresentes, catalog
My TableX has reference to TableY. @JoinColumn(name = idTableY, referencedColumnName = idTableY) @ManyToOne(optional =
I have foreign key inside my Customer table. @JoinColumn(name = DISCOUNT_CODE, referencedColumnName = DISCOUNT_CODE)
I have a parent-child relationship: @Entity @Table(name = user) public final class User {
I have two entities: Event and Comment. @Entity @Table(name = events) public class Event
Imagine, an Event entity references a Status Entity: @Entity @Table(name = event) public class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.