I am trying to build an item -> details page on my application involving entities EcmOrder ->> EcmOrderItem -> Product as described below:
JDL model fragment:
By using side by side techniques, I extended the repository, service and resource classes on back end. The extended EcmOrder repository has a new "find" method which eagerly fetches the associated EcmOrderItem and Product data:
@Repository
public interface EcmOrderRepositoryEx extends EcmOrderRepository {
@Query("select ecmOrder "
+ "from EcmOrder ecmOrder "
+ "join fetch ecmOrder.ordOits ecmOrderItem "
+ "left outer join fetch ecmOrderItem.oitPro product where ecmOrder.id =:id")
Optional<EcmOrder> findOneWithEagerRelationships(@Param("id") Long id);
}
On the front end, I extended various elements and changed the html template to accommodate the additional data that now comes embedded into the incoming order data.
The page has the following aspect:
The problem is that the repository query gets all the data, including the EcmOrder, all EcmOrderItems and Product for each EcmOrderItem but json serialized data that arrives in the browser does not include the Product data, thus leaving the "Oit Pro" column blank, as evidenced by the browser snapshot below:
So my question has two parts:
I guess this is probably related to @JsonIgnoreProperties used by JHipster on the entities java classes but tampering with that is the correct way to go?
Is there a way to solve this problem while avoiding changes to JHipster generated files, i.e., only adding my code?