Skip to main content

Posts

Thymeleaf function on button click with multiple parameter

how you can write the onclick attribute using Thymeleaf syntax: <button type = "button" th:onclick= "|rejectSalaryPayment(' ${response.uuid} ', ${dto.id} )|" >Reject Salary Payment</button> This assumes that the response.uuid and dto.id variables are available in the current Thymeleaf context. If they are not, you will need to provide the appropriate values or expressions to evaluate them. Also note that the onclick attribute is written using the Thymeleaf expression syntax ( |...| ), which allows you to include string literals and variable expressions within the same attribute value. 

Why jar file or application takes lot of time to execute

There could be several reasons why your system is taking a lot of time to execute a jar file or application. Here are a few possible causes and solutions: Insufficient hardware resources: If your system does not have enough hardware resources such as RAM, CPU or storage, it can take longer for the jar file or application to execute. To resolve this issue, you can upgrade your hardware or try closing any unnecessary applications that are running in the background. Network issues: If the jar file or application relies on network resources, slow network connectivity can lead to delays in execution. To resolve this issue, you can try checking your network connectivity, ensure that your internet connection is stable and that the network is not congested. Large file size: If the jar file or application is large, it can take longer to load and execute. To resolve this issue, you can try compressing the file or splitting it into smaller files. Compatibility issues: If the jar file or applicati...

Java Reflection Example

Document Filter an array by comparing another array @PatchMapping("/{id}") public Product updateProductFields(@PathVariable int id, @RequestBody Map fields){ retun updateProductByFileds(id, fields); } public Product updateProductByFileds(int id, Map fields){ Product existingProduct = repository.findById(id).get(); fields.forEach((key, value) -> { Field field = ReflectionUtils.findField(Product.class, key); field.setAccessible(true); ReflectionUtils.setFiled(field, existingProduct, value); }); retun repository.save(existingProduct); }

Create Composite Key in SQL

What is a composite key? A composite key in SQL can be defined as  a combination of multiple columns , which are used to identify all the rows involved uniquely. Even though a single column can't identify any row uniquely, a combination of over one column can uniquely specify any record. How to create a composite key? EG: 

Access remote branch git

  $ git branch -v -a main                     99557ef source code remotes/origin/HEAD      -> origin/main remotes/origin/NewDesign ced7cac New Design remotes/origin/main      99557ef source code $ git switch -c NewDesign origin/NewDesign This will create NewDesign branch in your local machine