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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:26:20+00:00 2026-06-18T02:26:20+00:00

I have a very complicated entity which I wish to load in two phases:

  • 0

I have a very complicated entity which I wish to load in two phases:

  1. Load all business data
  2. Load all metadata

I want to separate the loading.

Can I declare fields as @Transient on runtime only using reflection API?
I tried to use preLoad event but couldn’t find how to set a field transient.

Thanks
Idob

  • 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-06-18T02:26:21+00:00Added an answer on June 18, 2026 at 2:26 am

    1) Annotation information is part of java class information. You cannot change in runtime.
    Of course, you can generate some byte code generation tool: javaassist or cglib to generate class and load appropriate entity implementation in runtime. But it is looks like ugly hack. Also this solution is pretty complex and not stable.

    2) Try do not hack and add complexity in your application. Better to refactor existing domain model. Consider wy you need several fixed representation for you domain.

    3) Also if you really need weak structure of the entity you may serialize Entity into XML or Binary format and store in DB as Text(or maybe your db support XMLType) or as Blob.


    If your have a problem with LazyInitializationException and you develop Web application try to consider OpenSessionInView pattern. Hibernate will create one Hibernate session per each request. So you can manipulate with Hibernate objects in one request without thinkin about LazyInitializationException.

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

Sidebar

Related Questions

I have a very complicated form which has multiple stages in it. Each stage
I have a very long script R that plots very complicated data. I only
I have a very complicated windows application which has 8 forms. There are Previous
I have a very complicated site built on CSS3 that has html elements 3d-transformed,
I have a rather complicated (and very inefficient) way of getting utilisation from a
Im having a very strange problem, i have a complicated view that returns incorrect
I have very very big html page/data. I need to fetch data under h1
We have a not very complicated but big (i.e. lots of files) Visual Studio
Our website has some very complicated styling and we want to ensure that the
I have a ListView which has custom elements inside of it. I want to

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.