Posts by igventurelli • 4,441 points
166 posts
-
1
votes5
answers135
viewsA: Problems with arrays in a Python password generator
If you want to join these characters into a single string, you can use the str.Join(iterable): # os valores que você deu como exemplo senha = ['G', 'd', 'B', 'h', 'D', 'f', 'D', 'd', 'C', 'c', 'A',…
-
0
votes1
answer1296
viewsA: How to use bootstrap in spring boot correctly
If you want to access the route rota/{id} then you need to map this route in your controller. Something like: @RequestMapping("rota/{id}") public String rota(@PathVariable("id") int id) { //corpo }…
-
1
votes1
answer87
viewsA: OCA Java 8 certification, does it exist in Portuguese? Where should I pay for the test and at what institution?
Responding to your questions: It is not possible to take the exam in Portuguese. It is possible to do it in English, Japanese or Spanish only You cannot use any tool at the time of testing. Neither…
-
0
votes3
answers159
viewsA: Scanner gives error if inverting the order in which data is read
As quoted in the other answers, there are a few points that can be improved in your code, but to be direct in your problem: You cannot simply change the order of the parameters once you specify the…
-
0
votes1
answer451
viewsA: How do I resume the amount of Spring JPA records?
That answer is the same as the other question similar created by the same contributor. However, since it was not marked as duplicate yet, I answered here as well. I am suggesting as duplicate now.…
-
0
votes1
answer202
viewsA: Searching more than 1 field with Findby in spring mvc
The two parameters of the method findById_seletivoAndId_usuario are of the type Long. However, in the call you are passing to the second parameter the result of…
-
2
votes4
answers4853
viewsA: What kind of return of a select Count(*) in Spring JPA?
The interface JpaRepository (who inherits from CrudRepository) already comes with a ready method for this action. He calls himself count() and returns a long. Instead of declaring a new method, you…
-
1
votes1
answer139
viewsA: How to pass environment variables to Maven on command line?
My fault. The command mvn liquibase:update -Dliquibase.url=$DB_URL works. I thought it did not work because Liquibase was not receiving the parameters, but it is for another problem.…
mavenanswered igventurelli 4,441 -
0
votes1
answer139
viewsQ: How to pass environment variables to Maven on command line?
I want to pass values of environment variables to Maven via command line. How to do? Attempts: mvn liquibase:update -Dliquibase.url=$DB_URL: Maven executes, but the value is not passed mvn…
mavenasked igventurelli 4,441 -
2
votes1
answer145
viewsA: Entities marked as FETCH LAZY are returning "null" even after a call to the GET method
This happens, basically, why the Hibernate "does not let" you access the atibuto directly. When using FetchType.LAZY in its attributes, it creates proxies for them. That way, when you call the…
-
4
votes2
answers186
viewsA: Remove item from a collection
why the launch of the exception ConcurrentModificationException? This exception is launched because it is a mechanism of fail-fast for cases where there is any modification in the collection that we…
-
0
votes3
answers148
viewsA: Transform Jsonarray into Class Object
You can use the library GSON to facilitate the work. With it, from the JSON string you receive, you can create an instance of the desired class. Take an example: Gson gson = new Gson(); SuaClasse…
-
2
votes0
answers150
viewsQ: Pipeline change environment variable
I have an environment variable of project level defined with the value X. During the execution of the pipeline, given a certain condition, I need to change the value of this variable to Y. The value…
-
1
votes1
answer80
viewsA: Copy content only from the superclass in java
As far as I know, it’s not possible to do that with object-oriented "pure". However, you can use some libs that do this job. A good example is the Modelmapper. With it you can copy the values of the…
-
1
votes1
answer779
viewsA: JAVA - Creating an instance of an object in a class?
The problem is not the lack of instance. So that the line String label = annotation.label(); throw a NullPointerException, the return of the method called in Campo annotation =…
-
2
votes2
answers121
viewsA: Doubt about consuming backend with Spring
Heroku has no influence on back-end services. It’s just a way to host your Java/Spring application. For the mobile app, what matters are the routes of the services provided by the back-end. If you…
-
1
votes1
answer39
viewsA: Exceptions and database connection
should use a Try-Finally for even with exception pass through connection lock code? Yes. If you are using Java 7 or higher you can use Try-with-Resources.…
-
1
votes1
answer241
viewsA: Import github code for eclipse Oxygen
This is not a git repository or a Java project. It’s just a Java class isolated in a Gist. The Github Gist is a simple way to share code, notes, text, etc. It’s something like Pastebin. It’s not a…
-
1
votes3
answers3989
viewsA: How to Generate random numbers without repeating in Random?
Directly by the class Random is not possible. What you can do is use the data structure Set, which has the characteristics of not repeating values and not maintaining any order of the values…
-
0
votes1
answer89
viewsA: How to view Tomcat log on screen
Unfortunately, there is no "ready" way to do this. What can be done is: Log information into a file Program the view so that at each X time, it reads the file (or ask the back end to read and return…
-
1
votes1
answer51
viewsA: Terminal values for a program
Only with this information it’s hard to be 100% assertive, but come on: To pass arguments via command line (terminal), you can pass them separated by space. Something like: java -jar sua-app.jar 00…
javaanswered igventurelli 4,441 -
0
votes1
answer82
viewsA: how to take a substring of size n that repeats
You can use the indexOf("") to match the entire sentence: public class Teste { private static final String CONST = "aaisndiaunwioun test|test saiudb8iuyb aiwbu diby tab fiubaw…
-
1
votes2
answers364
viewsA: Datatable of the first faces does not update selection variable
You are not initiating the attribute linhaSelec. That way his value is null and then the Target Unreachable (sometimes called NullPointerException of the JSF) is launched. Initialize the attribute…
-
1
votes2
answers493
viewsA: Error Converting String to Numbers in Java
This happens because nextDouble() (or nextInt(), nextFloat() etc) do not function in the same way as nextLine(). The nextLine() rescues the next line of your input, now nextDouble() rescues the next…
-
3
votes3
answers597
viewsA: How does the equals() method work in Java?
Works because any instance/object of type Person (or any other class) is also a Object. Implicitly, all Java classes inherit from Object. That’s why when you just create a class it already "comes…
-
1
votes1
answer111
viewsA: Error in persistence.xml when connecting oracle database
As mentioned in the comments, your settings use Mysql and not Oracle. To use Oracle do: <?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence"…
-
2
votes1
answer75
viewsA: Is it possible to create a hybrid application with Angularjs as front, and java as backend?
As stated in the comments: yes, it is possible. You can create the so-called REST services in the back end whatever it is (Java, . NET and etc) and consume them in the front end whatever framework…
-
0
votes3
answers1175
viewsA: JPA + Wildfly + Hibernate
Is there any way to dynamically change the database connection by changing the Wildfly 8 standalone.xml file (or 10)? If I understand correctly, you want to work with more than one database, right?…
-
1
votes1
answer300
viewsA: Java test cases
Conta instance = null; instance.sacar(valor); /* ou instance.depositar(valor); */ You haven’t quoted what the test failure is so there’s no way to be 100% assertive, but it will surely result in…
-
2
votes2
answers393
viewsA: Error storing data from a Select with Java
The reply from @Victorstafusa is very good and well complete, but being a little more direct... You can use the ResultSet: try{ //Class.forName("com.mysql.jdbc.Driver"); conexao =…
-
2
votes2
answers484
viewsA: Is there a way to create an IDE based on Intellij?
I wonder, there’s a way, Does it give. and if so, to create an IDE based on it as well. You just make one Fork of the version repository communit of the IDE and create your own implementation.…
-
1
votes2
answers764
viewsA: Updating Progressbar in JSF
You can place your bootstrap component inside a JSF component and update the JSF component by Managedbean: <h:form id="meuForm"> <h:panelGrid id="meuPanel"> <div class="progress…
-
0
votes1
answer63
viewsA: render button according to status
Instead of assigning directly like this: rendered="#{solicitacaoImpressaoBean.peg.status.descricao eq 'Aguardando Aprovação'}" Create a Managed Bean method that returns exactly that. For example:…
-
0
votes1
answer145
viewsA: Java and JSON API
I particularly like the lib very much Google GSON. With it you can, from a Java class, mount your JSON and vice versa. In the project’s own repository (link above) there is a mini tutorial on how to…
-
2
votes1
answer1131
viewsQ: Is there a difference between "Test Team" and "QA Team"?
I don’t know much about tests. Sometimes I heard people talking ...the QA team (Quality Assurance)... As far as I know, QA is an environment and not a team. That’s why I didn’t understand. Doubts…
testingasked igventurelli 4,441 -
4
votes1
answer160
viewsA: Framework to read json google maps api
You can use the Google Gson. With it, you define a class and it populates all attributes for you. For example: public class Pessoa { private String nome; private int idade; public String getNome() {…
-
3
votes1
answer2436
viewsQ: What is the (real) usefulness of the javax.persistence.Transient annotation?
The annotation @Transient serves to inform JPA that that attribute is not mapped in the table and/or should not be persisted. In addition, after the entity that has attributes annotated with…
-
1
votes1
answer1053
viewsA: Adding arrays (vectors) with methods
The first problem is on this line: int [] resultado = somaValores(vetorA, vetorB); The method somaValores() returns int and not int[]. Change the return type to int[] and instead of doing return…
-
3
votes3
answers1141
viewsA: How to create an element search method in an Arraylist?
You can do something like: public class Pessoa { private int id; private String nome; private int idade; public Pessoa(int id, String nome, int idade) { this.id = id; this.nome = nome; this.idade =…
-
1
votes1
answer82
viewsA: Hibernate/SQL Average of a table with multiple relationships
whereas: Tables are correctly mapped into classes; The classes are called respectively, Tabela1, Tabela2 and Tabela3; Class attributes are called tabela2 and tabela3: So you can do: select…
-
0
votes1
answer394
viewsA: Resultset is not positioned correctly, you may need to call next
The error message is saying exactly what the problem is. See: In the method lerImagem() you do: try (ResultSet rs = ps.executeQuery()) { return lerImagemRetorno(rs); } The in the method…
-
5
votes1
answer2246
viewsA: How to redirect page in JSF?
Redirect is a specific term. You can redirect or forward: Forward Forwarding means taking the user to another page within the same context without a new request being made. This way, the URL in the…
-
1
votes2
answers1469
viewsA: Target Unreachable error, Identifier 'Clientebean' resolved to null
Make XHTML reference only clienteBean and not ClienteBean Remove the annotation @Named Enter the annotation @ManagedBean Change the scope of @SessionScoped for @ViewScoped…
-
1
votes0
answers14
viewsQ: Extremely slow application after implementing Dozer lib
I have a JSF application. I have just included a layer of Dtos and I need to transfer the values from Entities to Dtos and vice versa. Searching Google, found lib recommendations Dozer in the Soen.…
javaasked igventurelli 4,441 -
1
votes3
answers430
viewsA: Replace part of a Java String
The previous answers are good, but I’ll leave a possible solution too: You can use the class StringBuilder, which serves precisely to work with dynamic strings. StringBuilder mailContent = new…
javaanswered igventurelli 4,441 -
1
votes3
answers91
viewsA: Registration error "Does not recognize the property"
Java is case sensitive, that is, it differs between upper and lower case. Exchange all XHTML references from Livro for livro and it will work: Of: <h:form> <div> <h:outputLabel…
-
0
votes1
answer13
viewsA: Error in javaEE context-root using Jboss
The context-root should not include the bar. It should be only: <jboss-web> <context-root>matriz</context-root> </jboss-web> To take effect, remove the project from the…
javaanswered igventurelli 4,441 -
1
votes1
answer495
viewsA: Target Unreachable, Identifier [usuarioMBean] resolved to null
Managedbean has the session scope. You may not be logged in the moment you try to access it. In fact, because it is a login screen is likely not even have. Soon, your Managed Bean becomes…
-
1
votes1
answer377
viewsA: Use set with scanner and array
private and set are distinct concepts: private To keyword private is what we call Access Modifier. There are basically three access modifiers: public, protected and private: public: this is the most…
javaanswered igventurelli 4,441 -
3
votes2
answers870
viewsA: What are the differences between a PL/SQL programmer and an Oracle DBA?
In simple terms: DBA (Database Administrator) It is the person (or team) responsible for administering the database. Some of your main responsibilities are: Ensuring the bank’s performance; Ensure…