Posts by Isaias Tavares • 291 points
21 posts
-
0
votes1
answer61
viewsA: SQL code problem in the @Query java annotation
Try to query like this: @Query(value = "select p.id, p.marca, p.nome " + "from tb_produto as p " + "inner join tb_tipo_eletro as te on p.tipoeletro_id = te.id " + "where p.tipoeletro_id = :id and…
-
1
votes2
answers41
viewsA: Kotlin+Springboot [Beginner] I can’t create Post method
Complementing @Brenno Serrato’s reply, if you want to use a POST to add new books, eventually you’ll need to receive this book you need to add to Body from your request. It can be done that way:…
-
0
votes1
answer104
viewsA: (JAVA) How to treat Exception with spring?
You can create an Exceptionhandler with the @Controlleradvice annotation, as in this example here:…
-
0
votes1
answer45
viewsA: Resttemplate error
Strange, this error gives the impression that your URL is wrong, but as you said you are not, try using Uricomponentsbuilder. It would look something like this: UriComponentsBuilder builder =…
-
0
votes1
answer57
viewsA: Timeout configuration for a single call in Spring Boot
You can use the following annotation: @Transactional(timeout = 200) It can be either in the Controller as a whole or in a specific endpoint.
-
0
votes1
answer214
viewsQ: How to wait for the result of a Firestore query?
My problem is this: I have a component that will list some categories, example: categories: Observable<any[]>; ngOnInit() { this.categories = this.categoryService.getAll(); } In the service I…
-
0
votes2
answers1132
viewsA: Insert sequence Oracle
If you have created a Quence that will do auto increment, at the time of doing Insert no need to inform id, the database will automatically add. So just make your Insert that way: INSERT INTO…
-
1
votes3
answers181
viewsA: Sum of a column is not giving the expected value
This your SQL does not make much sense, I believe that what you wanted to do was the following: SELECT sum(coluna1) FROM dados WHERE ((coluna1/coluna2) >= 1) See if it works that way. What this…
-
3
votes2
answers1100
viewsQ: How to update or Insert in Mysql in the same query?
In Postgresql you can use the upsert. It checks if the line already exists, if yes it does update, otherwise it does Insert. In Mysql I’m not able to do this, I saw some talking to use INSERT ... ON…
-
0
votes2
answers300
viewsA: How to add custom methods in all spring data services
Just looking at it like that is kind of complicated, but I believe it would work. Did you try to run the project and made a mistake? If yes, put here the error that we can help you better.…
-
0
votes1
answer200
viewsA: Spring returning NULL in only one of the form fields
In his Model Usuario, change the method setUsuario for setLogin
-
1
votes3
answers35
viewsA: Doubt Spring MVC Controller
In your system, the user will ask a question and you will return the answer in the same request, right? If that is so, you will only have one Controller, it will receive the request from the user…
spring-mvcanswered Isaias Tavares 291 -
7
votes3
answers3355
viewsA: What is the difference between LOCATE and INSTR functions?
The difference is that in LOCATE you can tell from which position you want to find the substring in the string. Example: INSTR('she sells seashells', 's') -> RETORNA 1 LOCATE('s', 'she sells…
-
0
votes1
answer576
viewsA: Pass native query by parameter to Jparepository Interface
In this case there is no way, you have to use the EntityManager, follows an example: @PersistenceContext protected EntityManager manager; public List<MeuEntity> findCustomNativeQuery(String…
-
1
votes2
answers2382
viewsA: Query with dynamic spring data column
I believe that in this case there is no way to do this using Spring Data. But you can create a class for example: Customrepository In this class you can use the Entitymanager and run the query as…
-
1
votes2
answers145
viewsA: Problems trying to save data from the form
In your HTML, try to insert the tag name, following example: <div class="col-sm-2"> <input type="text" class="from-control" id="nome" name="nome" th:value="*{nome}"/> </div>…
-
0
votes1
answer40
viewsA: Spring XML localization in a Maven project
You should put inside src/main/Resources
-
0
votes4
answers1376
viewsA: Application with Tomcat and Spring Boot
You probably have the Spring Security dependency on your pom.xml Just remove this dependency and run the project again.
-
0
votes1
answer196
viewsA: Access the service layer from the controller
This is what I usually do: The Controller accesses the Service and the Service accesses the Repository. Example: Controller: @RestController public class TesteController { @Autowired private…
-
1
votes1
answer1770
viewsA: What settings are required to make spring boot generate tables automatically?
You must create the file application.properties and configure your database on it. Example: spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.username=root…
-
2
votes0
answers158
viewsQ: How to return a MAP using JPA’s native Query?
I need to consult a bank that is already established, populated and maintained by another application. So I don’t have the entities in my project and I didn’t want to create. I am using Spring Boot…