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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:49:06+00:00 2026-06-17T06:49:06+00:00

I am having troubles loading an entity that contains an optional one-to-one relationship with

  • 0

I am having troubles loading an entity that contains an optional one-to-one relationship with another entity.

When I try to load an entity with the corresponding mapping everything seems to be ok, but sometimes (I guess it is when I try to load a CitationInformation without the corresponding VenueTopic) I get the following exception:

org.hibernate.PropertyAccessException: could not set a field value by reflection setter of

These are my classes:

@Entity
public class CitationInformation {
    @Id
    @GeneratedValue
    private long identifier;

    private String doi;

    @OneToOne(optional = true, targetEntity = VenueTopic.class)
    @JoinColumn(name = "venue")
    @NotFound(action=NotFoundAction.IGNORE)
    private String venue;
    ...
}

@Entity
public class VenueTopic {
    @Id
    private String venueName;
    private String topic;
    ...
}

Unfortunately I need to deal with this dirty situation because I had to integrate my hibernate entities with data from another table that was not generated through hibernate.

I think I messed something up in the @OneToOne relationship. I am not sure I defined correctly the fact that it is optional and how I want missing values to me handled.

The behavior I want is that CitationInformation should always contain a venue, but the relationship should exist only if there is a VenueTopic entity with the same venueName.

  • 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-17T06:49:07+00:00Added an answer on June 17, 2026 at 6:49 am

    I think changing private String venue in your class CitationInformation from type String to type VenuTopic might solve the problem. I do not understand why you are using type string when you are already mapping it to another entity.

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

Sidebar

Related Questions

I'm having trouble loading JQueryUI from Google's CDN. I've got an ASP.NET application that
i`m having troubles with the function each, i want to load a highcharts in
i am having trouble loading one of my text files into my GUI. I
I'm having troubles loading a numpy matrix. I successfully saved it to disk through:
I'm trying to load up XML/SWF Charts with Yii and having some troubles. As
I'm using .NET 3.5 and I'm having trouble loading the Entity References automatically. Ideally,
I'm having troubles using Knockout Mapping. I have a FormBuilderViewModel, containing a bunch of
I'm having trouble loading a textured model with alpha blending from blender to xna.
I'm having trouble loading a custom font. .m file: - (void)viewDidLoad { [label setFont:[UIFont
I'm having trouble loading image data into a draggable window using EXT JS. The

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.