Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • data is retrieved correctly only when I select a specific field, use a native query, or perform mapping via a constructor That's because you're telling the framework how to construct your data when using finer fields. The class IndicatorValue should also exhibit a constructor that accepts an instance of IndicatorValueId. So, public IndicatorValue(IndicatorValueId id, BigDecimal value). Commented Nov 30, 2025 at 14:33
  • I added such a constructor (and it’s still present), but it doesn’t change the result at all. Commented Nov 30, 2025 at 14:47
  • From what I see in your question, you have an @AllArgsConstructor only in IndicatorValueId not in IndicatorValue. Commented Nov 30, 2025 at 16:13
  • Yes, sorry—I was experimenting, and the class actually has multiple constructors. Initially, I used the annotations: @AllArgsConstructor and @NoArgsConstructor. Later, I replaced them with explicitly written constructors. When drafting the post, I simply omitted listing all of them (including @AllArgsConstructor) because, as far as I understand, @AllArgsConstructor isn’t strictly required in this context. But please believe me—it is present. I’ve even tried making the fields public to rule out visibility issues, and that didn’t help either. Commented Nov 30, 2025 at 16:58
  • Oh ok, I see. In that case, update your post to reflect your actual code. This will help us to provide better answers or comments. Btw yes, the Jakarta Persistence specs doesn't say anything about a compulsory all-arg constructor, but since you were trying to build an IndicatorValue with IndicatorValueId's fields rather than an actual instance, I thought that could be the cause :/ I'll keep scratching my head though. Maybe somebody else might be able to help you with the updated version of your code. Commented Nov 30, 2025 at 17:07