Posts by Adriano Gomes • 711 points
58 posts
-
0
votes1
answer37
viewsA: Update table via Precedent/Rigger
I discovered the problem, had declared the wrong variable, follows correct script: CREATE OR REPLACE FUNCTION PUBLIC.FNI_FORNECEDOR_HOMOLOGADO() RETURNS TRIGGER AS $test$ BEGIN IF EXISTS (SELECT…
postgresqlanswered Adriano Gomes 711 -
0
votes1
answer37
viewsQ: Update table via Precedent/Rigger
I have the following table structure: CREATE TABLE FORNECEDOR( ID INT PRIMARY KEY, CNPJ varchar(255), ID_FOUR INT ); CREATE TABLE PRE_FORNECEDOR( ID INT PRIMARY KEY, CNPJ varchar(255), ID_FOUR INT…
postgresqlasked Adriano Gomes 711 -
1
votes1
answer142
viewsA: Connect BD sql server to sql
As stated in the comments above, just enable the SA user. An example of how to do this is in this link.
-
0
votes1
answer37
viewsA: Using Map<K,V> to access Object
You have to cast, note that you created the address map as Object, so the get of this map returns an Object and not the street map. I believe that solves your problem: ((Map<String, String>)…
javaanswered Adriano Gomes 711 -
5
votes2
answers219
viewsQ: Regex to search for word inside tag with CDATA
I have a file that contains the following string possibilities: 1st Case: <text><![CDATA[Casa]]></text> 2nd Case: <text><![CDATA[Qualquer texto que tenha Casa no…
-
-1
votes1
answer84
viewsQ: Join with criteria
I have the following entities: public class Mapa { //many to one private ItemMapa itemMapa; } public class ItemMapa { //many to one private Classe classe; } public class Classe { private Long id; }…
-
3
votes3
answers333
viewsQ: Return text between keys, without returning the keys themselves
I used the following java regular expression to return strings that are between keys: \\{[^\\}]+?\\} My program worked almost correctly, but it even returns the key. Algorithm: public static void…
-
-1
votes1
answer57
viewsQ: Conditional to execute sql statement
In SQL Server I can use a 'if' to check if a table has a column and depending on the return of that logical function, execute or not an instruction, as an example below: IF…
postgresqlasked Adriano Gomes 711 -
1
votes1
answer626
viewsQ: Sort string containing letters and numbers
I have a list of objects that has an integer and a String (composed of letters and numbers). I would like to sort by that integer and as a second clause the alphabetical/numerical order of the…
-
1
votes1
answer241
viewsQ: Remove comments from HTML
I have a TXT taken from an HTML file. It is full of comments that I need to remove and so I thought to use the method replaceAll class String, doing the following: public static void main(String[]…
-
1
votes1
answer106
viewsQ: Count repetition amount of an item
I have a table where were inserted several repeated items, I need to return all these items that have more than one register. So I made the following query: SELECT COUNT(ID), CODIGO, DESCRICAO,…
-
0
votes2
answers148
viewsA: Item selected in p:selectOneMenu reaches null in Systener
I believe in your f:selectItemslack the itemValue, it is the attribute that will be assigned in the variable livroOrdemController.tipoRelatoSelecionado, replace with this and I believe it will work:…
-
1
votes1
answer58
viewsA: Create Foreign Key Hibernate
You are doing a wrong mapping, when you say that a customer can have multiple tax bills so the correct one is the invoice having only one customer and not one customer list, instead of using…
javaanswered Adriano Gomes 711 -
0
votes1
answer50
viewsA: Hide and Render component in p:dialog
Replace your dialog with this, I’ve included a h:panelGroup to control the rendering: <p:dialog id="dialogRelato" showEffect="fade" hideEffect="fade" modal="true" header="Novo Relato"…
-
1
votes2
answers63
viewsA: SQL query leaving a custom column data
You can make a Union, for example: SELECT a.aplicacao, a.quantidade FROM tabelaA a WHERE a.aplicacao = 'appA' UNION SELECT b.aplicacao, b.quantidade FROM tabelaB b WHERE b.aplicacao = 'appB' OR…
-
1
votes3
answers2058
viewsA: Always pick the last three characters without knowing the size of the string
If you don’t want to worry about doing string size validation, you can use the class StringUtils package import org.apache.commons.lang3.StringUtils; (library link), would look like this: String x =…
-
1
votes1
answer146
viewsA: Difference between commit done on the github website and on the command line
This can happen for two reasons: 1º You didn’t set your email in git If that’s the case, you need to set your email in your local git configuration. Check what your current email is with $ git…
-
1
votes1
answer35
viewsA: Auxiliary tablet with composite PK
You can use the notation @Embeddable and create a class just to be PK, also remove id attributes and transfer supplier and product attributes to the new class "PK", would look something like this:…
-
0
votes1
answer334
viewsA: Bug in simple example JSF + Primefaces
Include the CDI dependency on the project: <dependency> <groupId>javax.enterprise</groupId> <artifactId>cdi-api</artifactId> <version>1.2</version>…
-
0
votes1
answer95
viewsQ: update with self relationship
I have a table called Category, in it I have the attributes ID, DESCRICAO e ORIGEM, I needed to include one more attribute ID_CATEGORIA_PAI, this attribute is an autorelationation with the same…
sqlasked Adriano Gomes 711 -
0
votes1
answer124
viewsA: How to pass a parameter between two views with @Viewscoped
Work and a legacy system that 99% of the screens are request scoped and whenever I need to share information between two views, I do as follows: View 1 //Seta seu atributo na view 1 através de um…
-
0
votes2
answers767
viewsA: how to create a vector vector?
You can create a list of vectors using the List interface (read more about the interface and its methods by clicking here), implementing the Arraylist class. Following your example, it would look…
-
4
votes3
answers4481
viewsA: Difference from: "git commit -am" and "-m"
Instead of you needing to make one git add <meu arquivo> (which adds the file to carry out your commit) and then do a git commit -m <minha mensagem de commit> (commits its change by…
-
0
votes1
answer79
viewsA: Save console output from an excel to a txt file
I could not understand how you open the spreadsheet, but I made an example using the library apache poi: import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException;…
-
0
votes1
answer41
viewsA: Counting months from a date
You can use the Calendar class that greatly facilitates date operations on the system, follow a simple example to add a number of months to a date: public static Date somaMesesAData(int qtdeMeses,…
javaanswered Adriano Gomes 711 -
1
votes2
answers692
viewsA: Hibernate, JPA, does not save the new data in the database
Your code is very confusing, let’s start with the service "change", in it you make a if (objeto.equals(objeto)), That doesn’t make any sense, you’re comparing something to itself, so I recommend…
-
0
votes1
answer529
viewsA: How to create a table in Oracle using Foreign key
Is to put a Constraint referencing a foreign key in this way: CREATE TABLE TB_FONTE_FINANCIAMENTO ( FF_ID NUMBER(10) PRIMARY KEY NOT NULL, FF_DESCRICAO VARCHAR2(100) NOT NULL, FF_SITUACAO…
oracleanswered Adriano Gomes 711 -
1
votes1
answer104
viewsA: Do not allow date 50 years back in the database
I would make a method to take the minimum date and set the component, staying that way: public Date getMinDate(){ Date minDate = new Date(); Calendar calendarData = Calendar.getInstance();…
-
1
votes4
answers66
viewsA: Add 0 to the left in an Arraylist <Integer>
You can create a string array just to handle this return and use the string format method, this way: private static String sortear() { Set<Integer> numberset = new HashSet<>(); Random…
javaanswered Adriano Gomes 711 -
0
votes3
answers97
viewsA: Primefaces Autocomplete Component "disappears from the screen" after update in Managedbean
The autocomplete is getting this way because the return of it is always an empty array, see that there you make a produtosFiltrado = new ArrayList<Produto>();, thus the return array of the…
-
1
votes1
answer733
viewsA: How to update a View?
Cause: An attempt was made to use an UPDATE, INSERT or DELETE statement in a view that contains expressions or functions or was derived from more than one table. If a merge operation has been used…
-
0
votes1
answer33
viewsA: I need to make the igName() method return if they are the same or different. I made the comparison with double and function, but with String the if does not compare
String has a different treatment, experiment using the equals method, this way: //// compara nomes=== public boolean igNome(Computador c2) { return this.getNome().equals(c2.getNome()); }…
-
0
votes2
answers3618
viewsQ: Grab specific column csv with python
I have a method that opens a CSV file but would like to go straight into a specific column, I tried to do it this way list2 = [row.split()[3] for row in f], but returns a piece of the file and not…
-
1
votes3
answers83
viewsA: Raspberry for monitoring system
Raspberry is actually a normal computer that comes installed a version of linux, so you can use whatever language you can compile on that operating system. About the image recognition patterns,…
-
4
votes1
answer309
viewsA: How to handle a JSON format string?
you can use the Gson from google, it’s super simple, just create a class that has exactly the same attributes of json and parse, look at the example I did with your json, just using the method…
-
0
votes4
answers126
viewsA: Can I put a WHERE for each column?
Yes, just use the logical SQL operators such as AND, for example: SELECT nm_casa, count(id_casa) FROM tb_casa WHERE nm_casa = 'minhacondição' AND id_casa = 'minhacondição' More about logical sql…
-
0
votes2
answers237
viewsA: Why isn’t jsf recognizing Istener in the Bean?
Save young, also work with this suffering of JSF 1.2, when I need to do some event with a selectOneMenu, do an onchange="Submit()" in the component itself, follows example: <h:selectOneMenu…
-
1
votes1
answer576
viewsA: Compare lines between. txt files
You can use the split method of the String class to clean the file (read more about the method). With the split I was able to isolate only the answers of the proof and jig, so I compared char to…
javaanswered Adriano Gomes 711 -
1
votes1
answer1232
viewsA: How to create a Chained and Double Chained List?
Here is a very quiet example of implementing a double-chained java list: Class No: package teste; public class No { private No ant, prox; private Filme filme; public No(No ant, No prox, Filme filme)…
-
0
votes1
answer19
viewsA: Inputtex with 2 Managedbean
There is no such option, inputtext value only accepts an object, as stated in the documentation: https://www.primefaces.org/docs/guide/primefaces_user_guide_6_2.pdf. I believe you are making a…
-
1
votes1
answer227
viewsA: How to create a business rule by JPA?
In your repository, if you are using Spring data JPA you can do the following: public interface ProjectRepository extends CrudRepository<Emp_Proj, Long> { @Query("SELECT COUNT(e) FROM Emp_Proj…
-
0
votes3
answers864
viewsA: Font Awesome icons do not take Primeng
If you install by NPM, I believe the correct import is like this: "styles": [ "../node_modules/font-awesome/css/font-awesome.css" ],
-
2
votes1
answer1096
viewsQ: Apply Mask to Java back-end
Does anyone know how to include a mask from a regex in a string? For example, I own the following regexString pattern = "\\d{2}[/]\\d{3}.\\d{3}[/]\\d{4}";and a variable with the following value…
-
0
votes1
answer35
viewsA: JAVA Nullpointexception
You made the Submit of the form that is this selectOneButton? Just the act of clicking on selectOneButton does not commit the form, unless you put some ajax function in it. Here is an example of the…
-
1
votes3
answers475
viewsA: Reverse SQL ordering
If you have a table that stores 3 dozens in each row, just put the fields in order by, for example: SELECT d.dezena3, d.dezena2, d.dezena1 FROM dezena d ORDER BY d.dezena3, d.dezena2, d.dezena1…
sqlanswered Adriano Gomes 711 -
1
votes2
answers856
viewsA: How to use p:fileDownload to download a specific file
In your table you will have a list of objects, these objects must have the pdf or provide a way to get to it. In your view you create an attribute and a method as below: private StreamedContent…
-
0
votes1
answer79
viewsA: Difficulty Working with Thread in Spring Boot
The uploadAnexo method sends a parameter of type Multipartfile[] to the constructor of class Fotostoragerunnable, apparently this parameter is going null, since the Exception launched is that there…
-
0
votes2
answers338
viewsA: How to save an upload file to the database with Primefaces
It gives yes, you have to save a byte array of the file. I used in the example below the component of the primefaces (http://primefaces.org/showcase/ui/file/upload/single.xhtml) as a reference:…
-
0
votes1
answer3872
viewsQ: Importing an existing project with angular-cli
Hello, I downloaded an angular 4 project with css bootstrap, now I would like to work on this project, making some changes for study effect. It turns out that I don’t know how to import an existing…
-
0
votes1
answer28
viewsA: datable jsf collection
Make two table to print the professional list and another to print the service Collection. In the professional table put a command button, which when pressed passes the object to bean and renders…