Questions tagged as 'java'

1
answer

Hierarchical selects. Parent-child relationship in the same table

I have a Product Entity with @ManyToOne. And I need to bring the last child record of each parent. I made a select in the table and it is bringing what I need but I am not sure to do the same query with hql. This is my select in mysql: SELE...
asked by 16.03.2017 / 17:28
1
answer

How to use CDI in WebService?

I am trying to inject a @Injection ed bean into a WebService , but the bean is always null. Dependency injection is working on my project. When I use @Injection inside a Managebean for a jsp page everything is ok. @WebService p...
asked by 15.03.2017 / 20:30
1
answer

Buble Sort ArrayList - Java

I need to sort an array based on the Date field of it, so I made this code. SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy"); for(int i = 0; i < arrayCapacitacaoAux.size(); i++){ String dadosA = (String)arrayCapac...
asked by 11.03.2017 / 17:34
0
answers

When and why should a static method be used? [duplicate]

I have always had this doubt in the matter of OOP, I see many codes with static methods and now starting in C # is no different. Being straightforward, when to use this type of method, why use it and its main function! Thanks!     
asked by 11.03.2017 / 06:06
0
answers

Format Java Number

I'm studying java and doing some exercises. I am doing an exercise where I passed 2 values to be formatted, but when I run the program the following error, if I only pass 1 value it works but with 2 it gives the error.    Exception in thread...
asked by 11.03.2017 / 17:51
1
answer

Edit Record Using Jpa

Good morning Personal, I'm trying to edit registry. Well the scenario is the following I have my edit screen that is bringing me the data Correctly. However when I do the editing it updates on the screen more in the non bank. I ha...
asked by 23.02.2017 / 14:53
0
answers

Instantiate Object dynamically

Hello, I need to instantiate a class according to the parameter received by a webhook , does anyone have any idea how to do it? It would be more or less this (some scenarios): Customer I get JSON {"id":"1"} I need to create a...
asked by 23.02.2017 / 14:26
0
answers

Java - Canvas blinks when redrawing screen

I'm doing a graphical application with the Component class, but every time I delete the canvas to draw a new frame, Canvas flickers! The clearBackground function: public void clearBackground() { Graphics g = bs.getDrawGraphics();...
asked by 23.02.2017 / 14:43
1
answer

Problem using Gson on Wildfly

I'm trying to use GSON in a Maven EJB project but it gives the following error:    java.lang.NoClassDefFoundError: com/google/gson/Gson When I test in the main class without going up the server lib works normally. Has anyone...
asked by 24.02.2017 / 15:46
1
answer

Problem to persist data in bank

follows the error I'm having at the moment of persisting the data: 09:19:29,437 ERROR [io.undertow.request] (default task-7) UT005023: Exception handling request to /sic/usuario/salvar: org.springframework.web.util.NestedServletException: Han...
asked by 07.03.2017 / 14:14