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

  • Home
  • SEARCH
  • 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

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.

  • 0 0 Answers
  • 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 66k
  • Answers 67k
  • 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 Since SHA1 is a common, standard algorithm, it is implemented… May 11, 2026 at 11:43 am
  • added an answer You can do SELECT * INTO #MyTable_tmp FROM MyTable Then… May 11, 2026 at 11:43 am
  • added an answer Try this Dim duplicateSSN = From p in persons _… May 11, 2026 at 11:43 am

Related Questions

In SQL it is easy to do a join and only return the columns
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
It is my understanding that the default behavior when creating a table in SQL
In SQL Server (2000 or 2005) is it possible to set the database or
In SQL Server 2000/2005, Is it possible to force the default value to be
Is it possible to order results in SQL Server 2005 by the relevance of
In SQL Server 2008 and given TableA(A_ID, A_Data) TableB(B_ID, B_Data) ViewC(A_or_B_ID, A_or_B_Data) is it

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.