Posts by Dherik • 10,372 points
299 posts
-
0
votes1
answer30
viewsA: Plugin to create runtime variable instance builder
For example, just dragging the Watch variable into the code, I would like you to bring the valued objects Intellij IDEA itself does not provide such a resource, and in my view it would not make much…
-
0
votes1
answer172
viewsA: How do I inject Ejbs that call other Ejbs into a Junit test class?
The way I recommend to do a unit test on an EJB is to instantiate the EJB to be tested and mock the Ejbs it calls (i.e., its dependencies). Depending on the form as the EJB is built, you may need to…
-
0
votes2
answers688
viewsA: Are the Unitarian tests correct?
From what I’ve observed, what you’ve done is integration tests and not unit tests. Unit tests cover a small part of the code, are simple and test internal logic of the application commonly related…
-
1
votes1
answer415
viewsA: Unit test of an SQL query in Junit
Tests involving database query are not called unit tests. These types of tests are called integration tests, although not necessarily only integration tests test the database (functional tests, for…
-
1
votes1
answer815
views -
3
votes3
answers131
viewsA: How to relate questions to a question
Already the (2) again enters the problem of performance, because to know what the correct option would be to always go through the questions to know the correct option, a questionnaire with 200…
-
0
votes4
answers401
viewsA: Skipping route due to poorly formatted parameter is a syntax error?
I would consider a syntax error: 400 - Bad Request. If you are searching for users with a certain identifier number, the number null is not a valid number. Therefore, this is considered a "bad…
-
1
votes1
answer603
viewsA: How to apply unit test when the main class is an interface?
The first thing to understand is to know what you want to test. In your code, you can test the following items: Return of String.format in the TEXT_OF_A_QUESTION Condition within the if To first…
-
1
votes2
answers2034
viewsA: Why doesn’t Spring boot use Entitymanager?
It is not mandatory? The EntityManager remains mandatory and is also available in Spring, but use straightforward of it by the developer will depend on how he needs to query the information he…
-
1
votes2
answers560
viewsA: Why shouldn’t I change the "getter" s and "Setter"s?
There’s nothing wrong with changing the get and set. The get and set are just a default name adopted in Java to access the internal information of an object. For example, when setting a apelido in a…
-
1
votes1
answer125
viewsA: query model.vo a solution with jpql and subqueryes
Query is incorrect, missing a comma right at the point where the error occurs: a2.descricao, a2.quantidadeRecente, Soma), (select p. ^ JPQL in Hibernate accepts SELECT, WHERE and in the HAVING.…
-
0
votes1
answer98
viewsA: Group_concat in JPQL
You can use the FUNCTION JPQL to call native functions or functions created in the database. To call it, you must provide the name of the function in the first parameter and in the other parameters…
-
0
votes1
answer67
viewsA: Precedence in Query JPA
query will overwrite or use my Where clause inserted in the entity also in the repository The clause of @Where inserted into the entity will also be used in the repository. Therefore, I recommend…
-
1
votes1
answer49
viewsA: How to implement the DAO standard in subclasses?
The DAO pattern is a way to separate your data persistence layer from the other layers. I understand that organization can be done the way you think best. I would not worry about making any kind of…
-
0
votes3
answers1359
viewsA: How to resolve ERROR: HHH000346: Error During Managed flush [org.hibernate.Exception.Sqlgrammarexception: could not execute statement]
The mistake you’re making is this: ORA-00904: "FOLDERAUTOUPDATE": invalid identifier Looking at your code, the problem is that you did not create a column with this name in the database. You created…
-
2
votes2
answers148
viewsA: Is it possible to extend a class via java Reflection?
From what I understand of your problem, you want to extend a class at runtime (Runtime). I believe you can use the Cglib for this: cglib is a Powerful, high performance and quality Code Generation…
-
2
votes1
answer1993
viewsA: What is the reason for the error "Unable to auto-Detect email address (got 'email@dominio.(None)')"?
You need to set the email that will be used by git to apply the commits, via the variable user.email. You can use the following command to set: git config --global user.email "[email protected]" And,…
-
0
votes1
answer870
viewsA: I made changes to the wrong branch, how do I reverse the changes in this branch without deleting what was done?
If you: It had modified files in a task-1 branch and Went straight to the task-2 and kept changing these (and other) files thinking it was in the task-1 Wishes to maintain these changes in task-1…
-
1
votes1
answer63
viewsA: Information of a specific tag
You can use the command grep after the output of the command to filter by branch name. See an example to filter by name branch v1.0.1: $ git tag --format="%(refname) %(taggerdate)" | grep v1.0.1 Or,…
-
0
votes1
answer59
viewsA: Migrating from svn to git: tags get a@with a number at the end of the tag. What can it be?
I believe that the explanation for this occur with tags be the same with branches: Git Svn was unable to find a "parent" commit for the first commit of the SVN branch so that it can connect the…
-
2
votes1
answer174
views -
1
votes4
answers4853
viewsA: What kind of return of a select Count(*) in Spring JPA?
You can use the Spring JPA Repository notation to do the count, as igventurelli said: public interface PlaylistDao extends JpaRepository<Playlist, Long> { long count(); } If you want to count…
-
1
votes1
answer36
viewsA: Entity attribute based on a field from another table - Hibernate
You need more flexibility to do what you want. And you’re having this problem by using the JPA entity as well to represent Json. In general, it is best to avoid mixing these two responsibilities.…
-
1
votes1
answer115
views -
13
votes3
answers4481
viewsA: Difference from: "git commit -am" and "-m"
The command: git commit -m "Teste" Commit only the modified and added files in the area of Stage (Changes to be committed) Git. That is, it’s just the files you added using a command like this: git…
-
3
votes1
answer1447
viewsA: Design Patterns in Spring Boot projects
This structure I’m using can be considered a design standard ? What would be ? Yes. This pattern you’re using is very close to what they call Transaction Script Pattern. It’s a simple question, but…
-
-1
votes1
answer62
viewsA: Print contents of an object belonging to a Treeset (Collection)
You need to implement the method toString() of your class Produto. Take an example: public class Produto { private int codProduto; private String descProduto; private float precoProduto; @Override…
-
0
votes1
answer210
viewsA: Operations in JPA
I must create a new class to maintain/map this relationship between unitLaboratory and exam so I can manipulate the data in it Yes, I think you will need to do this. As the relationship between them…
-
0
votes2
answers782
viewsA: How to use JUNIT to test void methods of my DAO class
On the test: create an instance of Example and pass to the method Inserir; then select the table where the object should have been inserted and compare the record found in the database with the…
-
5
votes1
answer5110
viewsA: What is Flyway and when to use it?
what is Flyway? Flyway is one of several tools that propose to bring order and organization to SQL scripts that run in the database, functioning as a version control of the same. what problems he…
-
0
votes1
answer61
views -
0
votes1
answer396
viewsA: How to expose a bean method to use spring dependency injection
Your mistake shows that the class RestClient failed to obtain the Spring Bean to inject the dependency of csrfTokenRepository. How you didn’t show how you’re using the class RestClient and she’s not…
-
2
votes1
answer116
viewsA: Convert Cell to String type in Apache POI
You accurate of a org.apache.poi.ss.usermodel.DataFormatter for this. Example: Cell cell = row.getCell(5); DataFormatter formatter = new DataFormatter(); String datateste =…
-
1
votes1
answer348
viewsA: Validation of quantity of sessions with spring boot and spring security
Its configuration, according to the documentation, seems correct. But this could be a problem outside of this configuration. Spring, to understand that the same user is authenticated more than once,…
-
0
votes1
answer55
viewsA: Merge POJO and Entity
Has better approaches yes. First, the entities are responsible for mapping their tables in the database. Making them also assume the part of representing the information in JSON format seems to hurt…
-
2
votes1
answer359
viewsA: Visitor counter using Spring Boot
One solution is simply to count the moment the GET the image is accessed. GET /user/manga/113 To know the number of views, you can have an endpoint for this: GET /user/manga/113/views Each access…
-
0
votes1
answer28
viewsA: I18n Springboot from an external library
How the base is source.setBasename("classpath:i18n/core/messages");, you need to put the file messages.properties within the following directory: src/main/resources/i18n/core/message.properties…
-
0
votes1
answer219
viewsA: Spring - Thread Dependency Injection
You can use the @Async and set up via Bean, can thus use dependency injection smoothly. Would look like this: @Configuration @EnableAsync public class SpringAsyncConfig { @Bean(name =…
-
1
votes1
answer717
viewsA: How effective is the message of success in Spring Boot?
You need to return an object that represents the fields you want to return, in case only a success message. Therefore, you need to create a kind of Dto, fill it with the message and return in…
spring-bootanswered Dherik 10,372 -
1
votes1
answer193
viewsA: How to reduce JSF application CPU consumption
Looking at the graphics presented, I believe you misinterpreted the problem. I have not seen CPU consumption as the problem, because this information is not shown. The amount of % you are seeing is…
-
1
votes4
answers121
viewsA: Should I use two IF’s or an operator?
In general, I believe it is easier to read a single if instead of one or more of them. Here are some scenarios to compare the two options. Many conditions Thinking of cases with more ifYou’ll see…
-
0
votes1
answer521
viewsA: Onetomany mapping with HIBERNATE associative table - JPA
I think it would be something like this: @Entity class Servico { @OneToMany(mappedBy = "servico") private List<ServicoItem> listaServicoItem; } @Entity class Item { @OneToOne(mappedBy =…
-
0
votes1
answer116
viewsA: Doubt in JPQL/HQL query
She is almost right. To the SQL: SELECT * FROM FEP.TB_TIPO_DOCT WHERE NR_SEQU_TIPO_DOCT = 259; The equivalent HQL/JPQL, given its entity, would be: Query query = session.createQuery("SELECT tb FROM…
-
0
votes1
answer536
viewsA: No Persistence Provider for Entitymanager named
Some possibilities to avoid this error: Check to see if the persistence.xml file is in the directory <webroot>/WEB-INF/classes/META-INF Within the <persistence-unit name="testePU"…
-
1
votes4
answers3512
viewsA: What do reticence in the parameters of a method mean?
The notation ... (three points, which in Portuguese is known as "ellipsis") is known in Java as varargs. It allows a method to accept an indefinite number of parameters of a given type. In your…
-
3
votes1
answer99
viewsA: How do I work with github when A2F is enabled?
You don’t have to. Using "A2F" (or 2FA or Two-factor Authentication), you can work using RSA key (SSH key) or via HTTPS. If you want to use HTTPS, you need to create a personal access token which…
-
12
votes2
answers10525
viewsA: Difference between "git add --all", "git add ." and "git add -u"
There are differences between these commands, but it will depend on the version of Git you are using. As an example, in version 1.x of Git, the commands git add --all and git add . are different,…
-
3
votes1
answer10088
viewsA: How do I update the master branch from another branch?
You can pull from another branch (in your case, the master), provided the remote branch do not present conflicts with your local branch, thus making it possible to merge fast-forward. So just give…
-
2
votes1
answer649
viewsA: Diff between two commits
Use the .. between the commits: git diff 1a1a1a..4d4d4d Or: git diff 1a1a1a^..4d4d4d Whether to include initial commit differences 1a1a1a. Without the .., you take only the differences between only…
-
1
votes1
answer872
viewsA: Git error, can’t push
Possible causes for this error: The branch in question there is no. This can occur if you misspell the branch name and try to give a push for her. The branch in question exists but does not exist…