Posts

sort by Descending &Ascending order

 List<DistributorAllot> distributorAllots=distributorAllotRepo.findAll(Sort.by(Sort.Direction.DESC,"id"));

update and delete query

Update Query  @Modifying @Transactional @Query("update CreateCustomer u set u.paid=:paid where u.id=:id") public void UpdatePaidInCreateCustomer(@Param("paid") float paid,@Param("id") long id) ; ------------------------------------------------------------------------------ @Modifying @Transactional @Query("update CreateCustomer u set u.cgst=:cgst, u.sgst=:sgst,u.igst=:igst, u.otherCharges=:otherCharges, u.totalAmount=:totalAmount,u.paid=:paid,u.discount=:discount,u.remark=:remark,u.pmtMode=:pmtMode,u.recipt=:recipt  where u.CusRefid = :CusRefid") public void updateTaxCGST(@Param("cgst") float cgst , @Param("sgst") float sgst , @Param("igst") float igst ,@Param("otherCharges") float otherCharges , @Param("totalAmount") float totalAmount,@Param("paid") float paid,@Param("discount") float discount,@Param("remark") String remark, @Param("pmtMode"...

contains unique element, restrict apply on Entity or Bean class

 on Bean Class @Table(name="signup",uniqueConstraints = {@UniqueConstraint(name="UniqueNumberAndStatus" ,columnNames = {"email"})}) public class SignUpUser { @Id @GeneratedValue(strategy = GenerationType.AUTO ) @Column(name = "user_id") private long id; @NotBlank(message = "(Name should be not blank ..!!)") private String name; @NotBlank(message = "(mobile should be not blank ..!!)") private String mobile; @NotBlank(message = "(Email should be not blank ..!!)") @Pattern(regexp = "^[a-zA-Z0-9+_.-]+@[a-zA-Z0-9.-]+$",message = "(email format example : abc@example.com)") private String email; @NotBlank(message = "(Password Number should be not blank ..!!)") private String password; @NotBlank(message = "(mobile should be not blank ..!!)") private String address; on controller @PostMapping("/HolidayName") public String PostPackageName(@Valid @M...

thymeleaf security

 <html lang="en" xmlns:th="http://www.thymeleaf.org" th:fragment="layout(content)"  xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity5"> 1. it used when, loggin successfully <div sec:authorize="isAuthenticated()"> </div> 2.  after login, shown for particular user access... <span sec:authorize="hasAnyAuthority('ROLE_USER')"><b>USER</b> </span> 3.  when autorised user not login then showing <div sec:authorize="isAnonymous()"> </div>

How to change max_allowed_packet size in SQL

  SQL query is : SET GLOBAL max_allowed_packet = 6250000; this is for 50MB How to Convert 6.25e+6 to Real Number? 6.25e+6 = 6.25 x 10 6  = 6,250,000

file upload button without input field

< html > < head >     < script type = "text/javascript" src = "https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" ></ script >     < style > input {         display : block ;         visibility : hidden ;         width : 0 ;         height : 0 ;     }     </ style > </ head > < body > <h1>upload to using button</h1>     < input type = "file" name = "somename" size = "chars" > < button > Choose File </ button > < script > $ ( 'button' ). click ( function (){     $ ( 'input' ). click (); }); </ script > <h1>upload to using text</h1> < p >< input type = "file"   accept = "image/*" name = "image" id = "file"   onchange = " loadFile ( event )" style = " display: none;" ></ p > < p >< lab...

How to submit a form using ajax in jQuery ?

  type:  It is used to specify the type of request. url:  It is used to specify the URL to send the request to. data:  It is used to specify data to be sent to the server. <!Doctype html> < html >     < head >      < title >JQuery AJAX Call</ title >              <!--Include JQuery Library -->      < script src = " https://code.jquery.com/jquery-3.5.0.js " >      </ script >      < script >              // When DOM is loaded this       // function will get executed      $(() => {          // function will get executed           // on click of submit button       ...