Posts by karanalpe • 547 points
39 posts
-
1
votes1
answer97
viewsA: Object getting null in the middle of the process
Make life easier for those who are trying to help you and put the full source code, along with xhtml. In the save method you are merging the rainfall object. This object must be declared in the…
-
1
votes1
answer201
viewsA: Error while deleting data in Mysql by Java
As you’re starting out, let’s go in pieces as Jack would say... 1. Do not plural entity name: Ex: Relatives >> Relative 2. Do not put attribute name in java with underline (_): Ex: id_person…
-
1
votes1
answer257
viewsQ: Persistence in JPA Cascade
I’m trying to perform a cascade persistence using JPA. I have the entity: Course and Module 1 Course can have several Module @Entity(name = "course") public class Course extends BaseEntity { private…
-
0
votes4
answers10456
viewsA: Workbench for Postgresql
I use linux and used Navicat with Wine... But it gave constant query errors, where it was necessary to open and close the program. Today a colleague pointed out to me the Dbeaver and I’m enjoying it…
postgresqlanswered karanalpe 547 -
0
votes1
answer890
viewsA: Best way for a bean to call another bean passing itself as a parameter in JSF
In implementations using JSF I don’t usually pass the entire object to the next page. What I normally do is pass the id to the destination page, and in this I do a query by loading the entire…
-
1
votes1
answer148
viewsA: Selectonemenu (Primefaces) field not saved in the seat
1 - You are using @Manytomany mapping for a component that allows you to select only 1 record. Solution: Switch component to selectCheckboxnu 2 - In the datatable it only shows an attribute, I want…
-
0
votes2
answers200
viewsA: Spatial + Postgis + Geotools Hibernate - Persistence Failure
Where I work we perform the persistence of theGeom using sql Native. See an example: INSERT INTO st_teste (the_geom) VALUES (ST_GeomFromText(#conteudoTheGeo)); And in the bank the field guy is…
-
0
votes0
answers58
viewsQ: Division into chartjs categories
Situation: I have a chart that presents the performance of the user and the group according to some questions that were answered by them. Each question belongs to 1 module and has an identifier…
-
0
votes1
answer201
viewsA: Error while using Simpleemail
1. Add the following dependencies in pom.xml: <dependencies> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-email</artifactId>…
-
1
votes1
answer633
viewsA: Group List with java 8
Basically you’ll have to read the incoming json, traverse it and create a new object from it. For this operation I advise the use of POJOS with the GSON library. Creating the pojo public class…
-
0
votes2
answers366
viewsA: Problems using Selectonemenu primefaces
Maybe your ajax update is not finding the component panelAU. This is because when rendering on the screen the primefaces add the name of the form next to the name that was defined. That is. Possibly…
-
2
votes2
answers5419
viewsA: Format Date yyyy-mm-ddTHH:mm:ssZ to dd/MM/yyyy HH:mm
Follows solution below: String dataJson = "2013-01-08T20:11:48Z".replaceAll("T", " ").replaceAll("Z", ""); SimpleDateFormat format = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss"); Date dataFormatada =…
-
0
votes3
answers373
viewsA: Array overriding elements
In the method: registraReclamacaothere is that line: Atributos atributos = new Atributos(); That is. Whenever you go through it, a new Attributes object will be created. For this reason, only the…
-
1
votes1
answer65
viewsA: How to define a data structure in Json, with the name of the object at the top of the structure?
The way to solve this problem is to use POJOS with the library GSON. Let’s take the example below: Pojo Subidentidade public class SubIdentidade implements Serializable { private static final long…
-
1
votes3
answers80
viewsA: Doubt about instructions that can be implemented in Hibernate
Considering "instructions" as instructions for handling and data persistence the correct answer is: C-SQL
-
0
votes1
answer100
viewsA: Create Java EE 7 Algaworks Workbook
There is a connection problem with the base financeiro. To try to solve this problem, follow the steps below: Check the connection data passed by parameter. I noticed that you passed the password as…
-
1
votes2
answers252
viewsA: Scope equivalent to @Stateless on CDI
What better fits to replace the @Stateless using the ICD is the @RequestScoped. The concept of stateless is consider each request as an independent transaction that is not related to any previous…
-
1
votes1
answer125
viewsQ: Return of the clean catch code
I am reading the book Clean Code of the series of Robert C. Martin. And it was presented a very common situation in my day to day. public static void main(String[] args) { String nome = null; try {…
-
3
votes2
answers244
viewsA: Which framework or tool can I use to generate reports?
What is commonly used for java reporting is Jasper. I’ve also worked with Crystal (do not recommend). Both tools have the option to print or export files.…
-
1
votes1
answer44
viewsA: Hence, trademark rights
Interesting your concern. Your question escapes a little from the purpose of the site, because it is something about the Brazilian legislation. Anyway, I’ll give my opinion. As the logo is from your…
-
1
votes1
answer33
viewsA: Login transaction log MSSQL 2012
I just answered a similar question here. You can work with triggers. Each table in the database will have a Trigger for a certain operation (INSERT, DELETE AND UPDATE). Through this you can get the…
-
0
votes2
answers512
viewsA: JSON to XLS in java
It is possible yes! Follow an example below: Use Stringbuilder to generate the file: StringBuilder xls = new StringBuilder(); xls.append("usuario"); xls.append(",");//Caracter "," significa próxima…
-
2
votes1
answer153
views -
3
votes2
answers1303
viewsA: How to transform an Object into XML in the specified format?
I use Jaxbcontext to generate Xmls. Below is an example of conversion to XML; public static String toXml(Object object) throws JAXBException { JAXBContext context =…
-
1
votes1
answer271
viewsA: How to access a specific field of a JSON object using JAVA
To make it easier to get the value "message". Create a pojo with all fields returned from json. Once this is done, use the GSON library to convert your json to the pojo created. That way you can get…
-
0
votes2
answers270
viewsA: Send email by java
I have an example that works perfectly, below: public static void sendEmail() throws EmailException { SimpleEmail email = new SimpleEmail(); // Utilize o hostname do seu provedor de email…
-
2
votes1
answer188
viewsA: Refactoring for Spring Data returning List<Object[]>
I believe that the best way for you to work for this situation is with pojos and not with Objects. Answering your question whether you should prioritize the use of JPQL or use Nativequery the answer…
-
0
votes2
answers1483
viewsA: Compress image size
Try something similar to this: /** * Redimensiona a imagem. * * @return array de bytes com imagem redimensionada */ private static byte[] resizeImage(byte[] imageByte, int width, int height) throws…
-
0
votes2
answers762
viewsA: How to put ISNULL in Subselect with case?
Renan, I used sqlServer’s ISNULL function. Example: SELECT ISNULL(STATUS, 0) AS STATUS FROM T_TESTE In this situation, if the status field comes null it will be replaced by 0. If you can’t, take a…
-
4
votes1
answer119
viewsQ: Categories of Google query
I have a site with wordpress karanalpe.com.br. When I perform a search for it in google is returned the following information: When I perform a query for another site (earth for example) the same is…
-
0
votes1
answer374
viewsA: How to change the blue/red color of an edited field
It will be necessary to place a ternary operator in the Prevision1. Something similar to this: <h:outputText value="#{produto.quantidadeRecente} style="#{produto.estoqueInsuficiente ? 'color:…
-
2
votes1
answer136
viewsA: How to save a csv using Hibernate and mysql
After several queries on the internet. I managed to find a solution... Generate csv using Stringbuilder. Example: StringBuilder csv = new StringBuilder(); csv.append("USER"); Save csv to your mapped…
-
0
votes1
answer136
viewsQ: How to save a csv using Hibernate and mysql
I need the following routine to be done: Read some information from the database; Generate a csv based on this data; Write this csv to the database; Start downloading this file to the user. I was…
-
0
votes1
answer153
viewsA: help with nativeQuery
The problem occurs because the entity Filter is waiting for the code field. As this field is not located in the query result is presenting this message. If this query cannot be changed, I suggest…
-
0
votes0
answers105
viewsQ: Database manager (Postgres - Linux)
Anyone knows a good FREE database manager for Postgres on linux? It used EMS SQL Manager for windows. However, it did not work for linux. I’m currently using Navicat, but the license expires in 14…
-
0
votes2
answers365
viewsA: How to change the format of a query result?
I don’t know this function of generating the Insert by SQL. However Mysql Workbench after script execution has export option for various formats: CSV, HTML, JSON, SQL INSERT and etc.…
-
0
votes2
answers1050
viewsA: Annotation problem for mapping
Speaks William, all good? Try this way: Classe Conta: import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id;…
-
3
votes1
answer175
viewsA: p:primefaces editor tabindex does not work
The tabidex attribute is not valid for p:editor, as seen in the documentation: http://www.primefaces.org/docs/guide/primefaces_user_guide_6_0.pdf.…
-
2
votes1
answer150
viewsA: Doubt how to make Insert in this model
Yes. First you enter the parent table (tbPessoa) and then the daughter table (tbPessoaFisica or tbPessoaJuridica). INSERT INTO tbPessoa ('nmPessoa', 'dsEmail') VALUES ('João', '[email protected]');…