-
Notifications
You must be signed in to change notification settings - Fork 124
Description
Description
A missing constructor in the AmppDto class will cause a runtime exception when JPQL queries attempt to instantiate the DTO.
Problem
The JPQL query in AmppController.java (lines 157-159) attempts to create an AmppDto object with 8 arguments:
new com.divudi.core.data.dto.AmppDto(a.id, a.name, a.code, a.retired, a.inactive, a.dblValue, a.amp.id, a.amp.name)This constructor with signature (Long, String, String, Boolean, Boolean, Double, Long, String) does not currently exist in the AmppDto class.
Current Constructors
The AmppDto class currently has:
- 5-arg constructor:
(Long id, String name, String code, Boolean retired, Boolean inactive) - 7-arg constructor (with pack info):
(..., Double dblValue, String packUnitName) - 7-arg constructor (with AMP):
(..., Long ampId, String ampName) - 9-arg constructor:
(..., Double dblValue, String packUnitName, Long ampId, String ampName)
Solution
Add a new 8-argument constructor to src/main/java/com/divudi/core/data/dto/AmppDto.java with the following signature:
public AmppDto(Long id, String name, String code, Boolean retired, Boolean inactive,
Double dblValue, Long ampId, String ampName) {
this(id, name, code, retired, inactive);
this.dblValue = dblValue;
this.ampId = ampId;
this.ampName = ampName;
}This constructor should be added after the existing 7-arg constructors (around line 69-93) for logical organization.
Expected Behavior
After adding this constructor, the JPQL query will successfully instantiate AmppDto objects with pack size and AMP relationship data.
File Location
src/main/java/com/divudi/core/data/dto/AmppDto.java
References
- Original issue identified in PR 18419 amp #18444
- Review comment: 18419 amp #18444 (comment)
Tips for Contributors
- This is a straightforward constructor addition
- Follow the existing constructor patterns in the file
- The constructor should call the base 5-arg constructor and set the additional fields
- Make sure to add appropriate JavaDoc comments similar to the existing constructors
- Build the project after making changes to ensure no compilation errors
Good first issue: This is a great task for first-time contributors! The fix is well-defined and follows existing patterns in the codebase.