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 7532653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:31:00+00:00 2026-05-30T05:31:00+00:00

Suppose I have an model object Event that contains a Venue . When I

  • 0

Suppose I have an model object Event that contains a Venue. When I query the database to populate the venue, I want to only store the venueid which can be used to lazy load the Venue.

I have data access class Events (plural) with function a function like Event findEventByName(String name). Similar for other model objects. If in my Event class, I have getVenue like:

public Venue getVenue() {
    if (this.venue == null) 
        this.venue = Venues.findVenueById(this.venueid); 
    return this.venue;
}

This will work, but it will couple my model with my data access. I think my design is not really “correct”? So how do I change it. For this academic project I think I won’t be using a 3rd party library like Hibernate to get a feel of how this might be implemented.

  • 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-30T05:31:01+00:00Added an answer on May 30, 2026 at 5:31 am

    I think you’re correct in that its not the best design to couple your object model to you data access.

    Modern object to relational mappers are pretty advanced. EclipseLink, for example, can dynamically modify the bytecode of the classfiles to provide for features like lazy loading. They call it weaving.

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

Sidebar

Related Questions

Suppose that I have the model Foo in GAE and this query: query =
Suppose I have an Orders table in my database and a corresponding model class
Suppose I have the following Event model: from django.db import models import datetime class
In rails 3, I have a database model that has a birthday field, of
Suppose I have class Foo(db.Model): bar = db.ReferenceProperty(Bar) foo = Foo.all().get() Is there a
Suppose I have the following (rather common) model Client invokes web service request ->
Suppose I have the following models: class User(models.Model): pass class A(models.Model): user = models.ForeignKey(User)
Suppose I have 2 models. The 2nd model has a one-to-one relationship with the
Suppose I have my models set up already. class books(models.Model): title = models.CharField... ISBN
Suppose you have two models, User and City, joined by a third model CityPermission:

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.