最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

MongoDB,webflux reactive, Springboot 3.3.4,Java21.0.6,Lombok (superbuilder class abstract of abstract) Hibernate not work mappin

matteradmin7PV0评论

I'm having this exception calling @query in mongoDB reactive in webflux springboot 3.3.4 when a table result of first query is empty calling other repository to search in other table that have the record searched.

return productRepository
    .findBySearchKey(code, channel, touchpoint)
    .doOnNext(AEMProductData -> log.debug("{} product on Products in MongoDB: {}", logHash, AEMProductData.toString()))
    .map(aemProductEntity -> {
    DozerBeanMapper mapper = new DozerBeanMapper();
    BaseProductsResponse response = mapper.map(aemProductEntity, AEMProductResponse.class);
    
                            return response;
                })
                .switchIfEmpty(aemProductRepository
                                .findBySearchKey(code, channel, touchpoint)
                                .doOnNext(aemProductEntity -> log.debug("{} product on AEMProducts on MongoDB: {}", logHash, aemProductEntity.toString()))
                                .map(aemProductEntity -> {
                                    DozerBeanMapper mapper = new DozerBeanMapper();
                                    BaseProductsResponse response = mapper.map(aemProductEntity, AEMProductResponse.class);
                                    
                                    return response;
                                })
                );

In the switchEmpty generate exception in jdk.internal.reflect in method public Object invoke(Object obj, Object[] args) throws InvocationTargetException { we are using JDK21.0.6:

.switchIfEmpty(aemProductRepository
                                .findBySearchKey(code, channel, touchpoint)
                                .doOnNext(aemProductEntity -> log.debug("{} product on AEMProducts on MongoDB: {}", logHash, aemProductEntity.toString()))
                                .map(aemProductEntity -> {
                                    DozerBeanMapper mapper = new DozerBeanMapper();
                                    BaseProductsResponse response = mapper.map(aemProductEntity, AEMProductResponse.class);

Somebody can tell us what happening? We are using lombok hibernate and Mongo Reactive Repository and Springboot 3.3.4 with Webflux.

Post a comment

comment list (0)

  1. No comments so far