In my Spring boot application I have a query which should return a distinct List of Focus’ (works perfectly in MySQL) However this does not return distinct values, duplicates are contained in the resulting list. Another issue is that I can’t return a whole entity using @Query annotation – changing my query to SELECT DISTINCT(F) FROM Focus F gives the
Category: Questions
Add database authentication to Spring Data Rest application
I’m creating an application using Spring Data REST with Thymeleaf. Initially I created my models, controllers, dao and services. All worked fine. I’m now trying to add security to my application. Right now I’m just focused on the login/logout. I’ve been able to create an in memory authentication as below: I want to change this to database authentication though. I’m
Java JSON String problem encoding Multipart
Iâm developing a REST API that receives a MultipartFormDataInput object (org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput), this comes from a form-data Vue.js app. On the data field comes a json string that contains latin accent characters (á, é, Ã, ó, ú, ñ). When print the json data in Java I get this: Original Json string Json string received in Java What can i do to
How do I put two Jpanels/Jbuttons in the borderlayout north section?
How do I display two JPanels in the ‘North’ in borderlayout? Here’s and example code that outputs a GUI with three distinct rows, Top, Middle, Bottom. There’s one button covering the first row, 3 buttons covering the second row, and one covering the bottom row. Output of above code: output of above code However, I’d like there to be two
Intellij Junit causes java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
I am trying to integrate sendgrid into one of our repo’s that handles emails. But my Junit tests keep throwing the mentioned Exception. I’ve skimmed through most of the posts on here talking about running the jar and issues around cglib and I do have the latest Mockito-all (1.10.19) pulled down. I’m able to build the jar and get it
Display all the items I have ordered
How to display all the items I have ordered in “Sales Report File”? Like whenever I ordered 2 cookies, It will display on the Sale Report file. I have this code currently.. Answer If you want like a text list of what you have ordered, you can simply create an ArrayList<String> and every time you click on a product you
Is there a way for a program to create a new int dynamically?
Is there a way to have a program generate a random string and then create an int using that string? I need an indefinite number of int, so I can’t exactly define them all in the code and then write in …
Sort A List of an Object with other object’s method
In the bellow code, with such classes, how can I sort an ArrayList of Students by the score the got from Courses List? I mean how can I sort a List of a specific class by an attribute of this class which is a child of another class. Answer Your “Student” class is confusing. Based on the name, it sounds
How can I guarantee a thread is safely unlocking a lock upon termination, while all methods already handle it?
A server project, might run for very long time and create many threads. In the following code I ask myself do i have to protect the lock somehow in addition to an overall try catch in method setData(MyData data): note: assuming its thread-safe, i am not really familiar with other reasons or natural disasters that may cause thread termination, like
How to add multiline Strings in Java?
How to make long queries more readable? For example I have this one: And it’s completely unreadable, are there any ways to beautify it? Answer Since Java 15, you can use text blocks: