Posts by nullptr • 3,925 points
142 posts
-
0
votes1
answer21
views -
0
votes1
answer39
viewsA: Id and Product getting null when saving data Many To One
Your method of service is not noted with @Transactional, thus operations are not executed within a Transactional block. @Transactional public Pedido salvarPedido(CriarPedidoRequest request) { ... }…
-
0
votes1
answer36
viewsA: I can’t validate @Embeddable class attributes
To consider validating internal classes, you should use the annotation @Valid of JSR-303 as described at that session of documentation Thus, your class statement Endereco would look this way: @Valid…
-
1
votes1
answer39
viewsA: Where the return is List<List<String>> convert this result into List<String> only by combining the elements
You can use the flatMap to "flatten" the results on a single level, bringing Stream<List<String>> for only the content of streams List<String>: val x = list .stream() .flatMap {…
-
2
votes1
answer529
viewsA: Localstack starts on Docker, but I can’t access
First, I see you are using the following version of Localstack: localstack_demo | LocalStack version: 0.12.1 This way, you are accessing the wrong port for your services, as described in Github, all…
-
0
votes1
answer34
viewsA: Lock problem on the base + Springboot
First of all, is not possible automatically remove the lock. The liquibase lock is a mechanism created precisely to prevent two bank updates from being performed at the same time. Forcing the…
-
0
votes1
answer21
viewsA: Where to put new packages in a Maven project in eclipse?
Before you know where you should put what things within the project, I suggest a brief reading on Getting Started by Maven. This will help you understand various details and conventions used in a…
-
0
votes1
answer742
viewsA: No Qualifying bean of type found for service
You forgot the note @Service in your class ServicoCurso. The annotation will make it detectable by Spring, and therefore be available for injection into your controller: @Service public class…
-
1
votes2
answers187
viewsA: Nullpointerexception JPA with springboot
Lacked a @Autowired in the ClienteService: @Service public class AtualizacaoService { @Autowired private AtualizacaoRepository atualizacaoRep; @Autowired private ClienteService clienteServ;…
-
1
votes1
answer142
viewsA: Springboot does not generate the tables in the bank
Its configuration is not correct. According to documentation, if you want the tables to be created, you must use the option create: spring.jpa.hibernate.ddl-auto=create A point of attention, when…
-
2
votes1
answer203
viewsA: What are the main advantages of the Restful Api?
I will quote some advantages below: Standardization of the API Division of functionalities by resources Standardization of Uris and parameters Better use of HTTP protocol resources Convention and…
-
1
votes1
answer23
views -
1
votes1
answer82
viewsA: Problem passing version on Maven via Property
You could use the release commands Maven to update the versions, the way you’re doing it won’t work. The reason for not compiling and error is that only with the variable it is not possible to…
-
1
votes1
answer63
viewsA: Jsoup does not bring full HTML Document
This is probably happening due to the limitation of the IDE console itself, you can adjust this limitation as follows: After opening the settings you should disable the console output limitation:…
-
4
votes1
answer53
viewsA: Use of only one attribute of an entity
Separate responsibilities between the domains of your controller and database. I answered a question similar to this one here a time ago that encompasses its dilemma, specifically in this passage:…
-
0
votes1
answer100
viewsA: Load modal only once
I would take the following approach: <rich:modalPanel id="modal" autosized="true" width="500" height="200" showWhenRendered="#{homePageMB.showWelcomeModal()}"> <f:facet name="controls">…
-
19
votes2
answers437
viewsA: What is the difference between using @Transient and Transient in an attribute of a JPA entity?
@Transient is a JPA annotation and is directly related to data persistence. Fields marked with this annotation will not be considered in framework generated Inserts, updates... . transient is a java…
-
1
votes1
answer22
viewsA: Find out the number of _search requests made to an Elasticsearch index
You can use endpoint _count to know how many hits occurred in the index, including using criteria: GET /<index>/_count This way you can perform the request as follows: curl -X GET…
-
-1
votes1
answer416
views -
2
votes1
answer146
viewsA: Migration from Java 8 to 13
How are you using Spring Boot, you can control the version of Java used using the variable java.version: <properties> <java.version>13</java.version> </properties> It is also…
-
1
votes1
answer25
viewsA: How to do an UPDATE with Sqel Expression?
Following the syntax of documentation, looks like you forgot one : before the parameter: @Query(value="UPDATE cliente SET nome = :#{#cliente.nome} WHERE id_cliente = 1", nativeQuery=true) Cliente…
-
1
votes1
answer153
views -
2
votes1
answer31
viewsA: Difference between Activitycontext and Applicationcontext
When using getContext(), you are referring to the context of Activity current, and when using getApplicationContext() you are referring to the context of the application as a whole. In short:…
-
11
votes1
answer539
viewsQ: What are the main advantages of using the Java 9+ modularization feature?
From Java 9 we have the possibility to modularize our application using the so-called Java Platform Module System Before Java 9, modularization was done purely through Jars, where we had several…
-
6
votes1
answer100
viewsA: Error - Java Maven Does Not Build - Release Version Not Supported
The problem is in the version of Java you are using for the compilation in Maven. You can fix this in two ways: <plugins> <plugin>…
-
1
votes1
answer705
views -
7
votes1
answer1426
viewsA: On Github, what’s the difference between a project and a repository?
There is confusion with the term project in the definition of the two things, this is because it is usually understood as the project the folder created during the development that contains the…
-
5
votes2
answers803
viewsA: SOAP request showing error
Looks like you’re mixing the WSDL with your request body. I believe the body you want to send to call the operation consulta_cenprot would be like the below: <soapenv:Envelope…
-
0
votes1
answer18
viewsA: How to validate which transaction mode is being used? (Aspectj / Proxy)
After all this time I forgot even to answer. Programmatically I found no way to validate which transaction mode is enabled. The only way we found to validate this was to change the log level for the…
-
3
votes2
answers136
viewsA: SPRING - Count the number of queries made in a request
Using Spring Boot you can enable the following property as described in documentation: spring.jpa.properties.hibernate.generate_statistics=true With this at the end of each session will be printed…
-
0
votes1
answer365
views -
5
votes3
answers314
viewsA: What is "Idempotency Messages", "idempotentive", "idempotency"?
Let’s get into the theory about idempotency before applying it in a practical example, even because after understanding what idempotency is, you may OR may not apply it depending on your situation.…
-
1
votes1
answer1128
viewsA: Error Request method 'GET' not supported while performing update
The problem is calling a method that only accepts POST (method marked as @PostMapping) using GET. If the idea is really to use GET, just note the method as @GetMapping. Link to documentation…
-
1
votes1
answer120
viewsA: Heritage is slowing the startup of my SPRING BOOT application
To prevent a component from initializing during startup (it got weird to write this), you can use the annotation @Lazy as follows: @Lazy @Component @Qualifier("nfs13") public class NFS13 extends…
-
0
votes1
answer721
viewsA: Get IP from the computer that is accessing application via Node.js
You should consider some scenarios to recover IP: var remoteIp = (req.headers['x-forwarded-for'] || '').split(',').pop() || // Recupera o IP de origem, caso a fonte esteja utilizando proxy…
-
0
votes1
answer521
viewsA: Postgresql error with Spring boot - api
The problem is in your connection URL: jdbc:postgresql://localhost:5432/product The exception below your stacktrace (in your image) makes this clear: product database does not exist Check whether…
-
0
votes1
answer117
viewsA: Doubt about reading text files in C
As described in documentation, you need to pass a buffer to be used while reading: Parameters str Pointer to an array of chars Where the string read is copied. in a Maximum number of characters to…
-
0
votes1
answer77
viewsA: How do I "share" a request between threads?
A thread cannot access data from another thread because each thread has its own individual context. There are several reasons for this to happen: Maintain isolation between threads while avoiding…
-
1
votes1
answer71
viewsA: Is it possible to simulate the C++ 'Friend' keyword in Java?
From the description of your question it looks like a XY problem, you don’t need to use a complex resource of another language just to instantiate a private constructor class in Java. Following this…
-
3
votes1
answer357
viewsA: Pass parameters in the Retrofit2 GET method for Android
You must specify the name of the parameter only in the annotation @Query, in your case the URL mount will be incorrect: user/?userEmail&email=xpto Changing the path as follows shall have effect…
-
0
votes1
answer44
viewsA: Maven does not work with proxy
The only way to use Maven with proxy is to configure your settings.xml agreement, such as for example: <settings> . . <proxies> <proxy> <id>example-proxy</id>…
-
1
votes1
answer309
viewsA: Error when using the @Slf4j annotation "log" using the Spring Boot tutorial
As suggested in the comment, perform the installation of Lombok in your IDE should solve the problem. But out of curiosity, to find out why performing this action actually solves the problem I took…
-
0
votes1
answer269
viewsA: Bindingresult is not working properly with Validation
I suggest making the Validator to be used for Spring: 1) Using XML <mvc:annotation-driven /> <bean id="validator"…
-
1
votes1
answer67
views -
1
votes1
answer1565
viewsA: Spring Boot - Changing object property names when returning JSON from the API
It is possible to change the properties at the time of serialization of the object. What I think is important is to point out that this transformation is more related to your class than to the data…
-
2
votes1
answer1429
viewsA: Spring Boot - Error java.lang.Illegalargumentexception: Not an Managed type
For his stacktrace: Caused by: java.lang.IllegalArgumentException: Not an managed type: class br.com.itau.ev9.fuse.model.VeiculoCotacao What happens is that your class VeiculoCotacao is not being…
-
1
votes2
answers125
viewsA: Merge two features
You can simply sync your branch feature2 with the branch master using the following commands: $ git checkout feature2 $ git pull origin master The fact that you perform the pull of your branch…
-
0
votes2
answers332
viewsA: User change does not work, is doubling given in bank
I believe the problem is occurring due to your object Usuario no longer in the Hibernate session, so the standard behavior of the JPARepository is applied: Saving an Entity can be performed via the…
-
2
votes3
answers124
viewsA: Mysql Inner Join... Column error 'Id_occurrence' in field list is ambiguous
The column exists in two tables, the database does not know which one to show, the ambiguity occurs. Add the alias of the table you want to present the data: select ocorrencia.id_ocorrencia,…
-
1
votes1
answer522
viewsA: How do I search for logged-in user information other than by the controller?
You can recover the authentication data through the SecurityContextHolder and SecurityContext: Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); With the object…