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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:10:35+00:00 2026-06-12T05:10:35+00:00

I have an Entity like this: public class User { @Column(name = password) @Element(name

  • 0

I have an Entity like this:

public class User {
    @Column(name = "password")
    @Element(name = "pass", data = true)
    private String password;
}

What I would like is that the field password is not read/populated in Queries by default. But in some cases I of course want to check the PWD and in this special case the PWD should be read and filled by openJPA in the User object.

What kind of Fetch strategy or JPQL queries might I use to implement this?
I think FetchType.Lazy only applies to join’ed tables not single fields.
Also I can’t imagine a JPQL query where I can tell openJPA to overwrite this FetchType and to load this field in case I do really need it for a PWD check.

Many Thanks!
Sebastian

  • 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-12T05:10:36+00:00Added an answer on June 12, 2026 at 5:10 am

    Actually, it is possible to set a single field to be lazy loaded. Simply add a @Basic annotation with the lazy fetch strategy as follows:

    public class User {
        @Basic(fetch = FetchType.LAZY)
        @Column(name = "password")
        @Element(name = "pass", data = true)
        private String password;
    }
    

    More details are available here: http://openjpa.apache.org/builds/1.1.0/docs/jpa_overview_meta_field.html#jpa_overview_meta_fetch

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

Sidebar

Related Questions

I have a Person and an Organisation Entity: Person looks like this: public class
I have a Customer class defined like this: @Entity public class Customer { //...
In our application, I have seen code written like this: User.java (User entity) public
Let's say there is a entity class like this @Entity public class User {
I have an entity like this: public class Employment { public virtual Company Company
I´ve got this Model on my Play application. @Entity @Table(name=SHOPPER) public class User extends
I have a JPA object which has a many-to-many relationship like this: @Entity public
I have entity model like this (using EclipseLink and JPA 2.0): @Entity class A
I have a variable declared like this in a class: Entity *array[BOARD_SIZE][BOARD_SIZE]; I need
I have a domain object annotated like this for hibernate support. @Entity @Table(name =

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.