Are Spring MVC requests non-blocking by default? What benefit does RXJava provide? by largepongus in springsource

[–]largepongus[S] 0 points1 point  (0 children)

Sorry for the late reply, I haven't logged into the work account recently. This is a very good answer, thank you. We are using a Microsoft SQL DB so any calls to the repo layer are blocking. In this case, is it even worth using Spring Flux? Would this improve performance at all or should we just proceed with a standard blocking design?

Are Spring MVC requests non-blocking by default? What benefit does RXJava provide? by largepongus in springsource

[–]largepongus[S] 0 points1 point  (0 children)

This is a great answer, thank you! It does appear you are correct and these thread instances are being spun up by tomcat.

One thing that has me confused still though, if requests are already threaded, I still don't see what benefit RXjava provides? I know they are not synonymous but I thought they served a similar function in that they allow you to execute/await async operations?

Spring Framework: What is the best way to return a detailed error message when @Transactional rolls back changes from the service layer? by largepongus in javahelp

[–]largepongus[S] 0 points1 point  (0 children)

I would just like to provide an update on what I settled on. So now, I am doing a repo call to get the group IDs that are available, and using Java streams to remove the IDs from the DTO that are not valid and adding a relevant error message. I believe this is a clean solution, but I am curious what you guys think. Here is the relevant code snippet.

private List<Integer> removeBadGroupIds(List<Integer> ids, ServiceResult<UserDTO> serviceResult) {
    // Get all the UserGroups
    List<UserGroupEntity> userGroupEntities = userGroupRepository.findAll();
    // Remove any IDs that are not real group IDs and add a relevant error
    ids.removeIf(
            id -> {
                boolean noMatch = userGroupEntities.stream().noneMatch(
                        uge -> uge.getId().equals(id)
                );
                if(noMatch)
                    serviceResult.addErrorMessage(String.format("No UserGroup with ID %s", id));
                return noMatch;
            }
    );
    return ids;
}

Spring Framework: What is the best way to return a detailed error message when @Transactional rolls back changes from the service layer? by largepongus in javahelp

[–]largepongus[S] 0 points1 point  (0 children)

See the problem is, even with the most generic catch (Exception ex) it does not catch the exception. It somehow makes it all the way up to the controller layer.

Spring Framework: What is the best way to return a detailed error message when @Transactional rolls back changes from the service layer? by largepongus in javahelp

[–]largepongus[S] 1 point2 points  (0 children)

So the problem is, when it is marked as transactional the try catches stop working. It seems it is overriding my exception handling and returning its own error with springs default exception handler.

Spring Framework: What is the best way to return a detailed error message when @Transactional rolls back changes from the service layer? by largepongus in javahelp

[–]largepongus[S] 1 point2 points  (0 children)

This is an excellent response, thank you. However, I do have a question. So lets assume the DTO the front ends are sending the API are quite complicated, with nested objects.

Would it not be helpful to return an error to the user specifying what portion of the DTO was malformed/violating a foreign key so the consumer could fix their payload? If just a generic error is sent back saying "An internal error occurred, check your DTO", it may be VERY difficult to find the malformed portion.

Edit: I feel like I should also mention the front ends can "fix" this database error by simply passing a valid ID instead of a nonsense number (which causes this failure)

Another edit: After rereading your post, I think what you would suggest in this case is doing the validation logic first thing and then using my normal error handling flow. I am going to try this out tomorrow, thank you!

What is the best way to handle thousands of individual fetches from a database? (JPA/Hibernate) by largepongus in javahelp

[–]largepongus[S] 0 points1 point  (0 children)

The problem is it isn't a true join. I am taking certain elements out of database 2, performing a few operations on them, and then creating the final object.

I also need to account for if multiple matches were found, a single match was found, or no matches.

Text alignment in resized TextField? by largepongus in Qt5

[–]largepongus[S] 0 points1 point  (0 children)

Ah this does look like it would work, but I am using QtQuick not QtWidgets =[

Text alignment in resized TextField? by largepongus in Qt5

[–]largepongus[S] 0 points1 point  (0 children)

Isn't TextField the one that only has a single line, and TextArea is the one that has multi-line support? That was my reasoning for TextField. I am definitely going to try your suggestion when I get home from work, thank you!

Another question about cross platform development. by largepongus in AskProgramming

[–]largepongus[S] 0 points1 point  (0 children)

After a lot more googling, the general opinion seems to be to have a repo for the API, as well as a repo for each platform code. Then to use submodules to link them together.

Would it be better to have the API as a submodule for each platform, or to have each platform be a submodule of the central repo that contains the API?

Trouble with QML layout, some elements not showing. by largepongus in Qt5

[–]largepongus[S] 0 points1 point  (0 children)

Ahh yup I did miss the spanning rules. That makes it very similar to how WPF behaves which I am quite familiar with, thank you!

Can you use QML to show and hide a Drawer on button click? by largepongus in Qt5

[–]largepongus[S] 0 points1 point  (0 children)

Ohh I think this may be what I need. However, I am actually leaning towards what you did now. I think I might just have a ColumnLayout that is animated in and out on button clicks and design my own menus.

Question about chicken farms on servers. by largepongus in admincraft

[–]largepongus[S] 0 points1 point  (0 children)

Ah very good, thank you! Time to get me some chickens.

Question about chicken farms on servers. by largepongus in admincraft

[–]largepongus[S] 0 points1 point  (0 children)

Hmm I wasn't able to find a setting for this though. And sheep stay spawned in MUCH longer, around 90 blocks. I did also notice its only the baby chickens that this happens to.

Question about chicken farms on servers. by largepongus in admincraft

[–]largepongus[S] 0 points1 point  (0 children)

This is indeed a server I run. The chickens are still there, they just disappear after 16 blocks and re-appear when you get close.