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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:44:58+00:00 2026-05-10T18:44:58+00:00

In SQL it is easy to do a join and only return the columns

  • 0

In SQL it is easy to do a join and only return the columns you want from the joined table. What is the best way to map this in JPA / Hibernate?

For example, there is a Folder entity mapped to the EMAIL_FOLDER and an Email entity mapped to the EMAIL table. There is a one-to-many relationship from Folder to Email. The Email entity is rather heavy because it contains CLOBs of the text, attachments, etc. There are some cases where we need to get the whole Email back and there are other cases when we just want to bring back senderName, subject, and sentDate and do not want the memory overhead of bringing in the CLOB data. Accomplishing this in SQL is straightforward, but I’m not sure what the best approach would be in JPA / Hibernate.

I’m thinking about creating a LightEmail that only maps to senderName, subject, and sentDate. Is this the best way to handle something like this?

Update: At this point I’d like to avoid byte code instrumentation if possible.

  • 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. 2026-05-10T18:44:59+00:00Added an answer on May 10, 2026 at 6:44 pm

    Annotate the property (the CLOB) as @Basic(fetch=FetchType.LAZY)

    See Declaring basic property mappings in the Hibernate Reference

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

Sidebar

Ask A Question

Stats

  • Questions 70k
  • Answers 70k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer So I guess you are not looking into using MSBuild?… May 11, 2026 at 12:56 pm
  • added an answer It sounds like you probably need to #import <SystemConfiguration/SystemConfiguration.h> May 11, 2026 at 12:56 pm
  • added an answer You are using IDs as Classes. Check out all these… May 11, 2026 at 12:56 pm

Related Questions

In Microsoft Sql it is possible to encrypted stored procedures with CREATE PROCEDURE dbo.foo
I see that in PL/SQL it is possible to set the session state of
Is there any facility of transposing rows to columns in SQL Server (it is
In Linq to SQL it is possible to generate the database from the dbml
I've got a strange problem with SQL Server 2000, and I just can't think
I can do it in sybase and I can do it in oracle, but
We have a link table that can handle multiple types of object on one
I have a following model: class Car(models.Model): make = models.CharField(max_length=40) mileage_limit = models.IntegerField() mileage

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.