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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:27:15+00:00 2026-05-26T13:27:15+00:00

I have an application which has to handle a list of objects (retrieved from

  • 0

I have an application which has to handle a list of objects (retrieved from the database using JPA) which contain an image serialized.

The issue is that when I get around 50 instances of this object stored on the database, it becomes quite slow to load 50 pictures from the database (~5 seconds), which becomes annoying to the user.

Is there a way to set this column from the database to a lazy initialization? Or should I create a separate object to carry the image, and reference it using an ID?

Thanks for your help.

  • 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-26T13:27:15+00:00Added an answer on May 26, 2026 at 1:27 pm

    Yes there is a layz loading attriubte for properties.

     @Basic(fetch = FetchType.LAZY)
     private String myBigString;
    

    From the JPA 2.0 Specification

    11.1.6 Basic Annotation The Basic annotation is the simplest type of mapping to a database column. The Basic annotation can be applied to a
    persistent property or instance variable of any of the following
    types: Java primitive types, wrappers of the primitive types,
    java.lang.String, java.math.BigInteger, java.math.BigDecimal,
    java.util.Date, java.util.Calendar, java.sql.Date, java.sql.Time,
    java.sql.Timestamp, byte[], Byte[], char[], Character[], enums, and
    any other type that implements Serializable.

    …

    The FetchType enum defines strategies for fetching data from the
    database: public enum FetchType { LAZY, EAGER };

    …

    The LAZY strategy is a hint to the persistence provider runtime that
    data should be fetched lazily when it is first accessed. The
    implementation is permitted to eagerly fetch data for which the LAZY
    strategy hint has been specified. In particular, lazy fetching might
    only be available for Basic mappings for which property-based access
    is used.


    One other technique would to have a second mapping of the same table, but only with the attributes you need.

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

Sidebar

Related Questions

I am using VS2005 C#, and I have an application which has a few
I have an application which has a similar interface to Visual Studio, in that
I have an application which has a Projects table and a Users table. In
We have an application which has about 15000 pages. For better SEO reasons we
I have an MVC application which has a set of fields for contact details
I have an iphone application which has about 4 tabs. How do I force
I have a Windows application which has a browser in it. The Windows application
I have a Java Application which has to load an DLL with a few
We have a Flex application which has several 'pages' worth of content. Each time
I have a console application which has target .NET 2.0 It is very short

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.