Posts by jpkrohling • 1,221 points
16 posts
-
1
votes1
answer161
viewsA: Doubts about security in SSL communication of Sockets
It depends on what you call "security". Note that SSL has three security-related principles: confidentiality, integrity, authenticity. What confidence you have in the certificate the server is…
-
1
votes1
answer195
viewsA: Map Hibernate classes with Posit-id and joined-subclass
The problem is not that your class is extending another. The problem is that composite-id implies that you know the values beforehand, so the ID field used in Composite-id is not automatically…
-
22
votes4
answers6985
viewsA: How to add times in Java?
The easiest and most convenient is to use the Duration from Jodatime, but maybe it doesn’t make much sense to add this dependency if you need to calculate dates just in this part. Unfortunately, the…
-
2
votes2
answers1399
viewsA: Configure Hibernate transactions only with Jersey API Annotations
If you’re using an application server like Wildfly, you can make your service also an EJB Stateless (add @Stateless at the top of the class), and all REST methods will automatically be involved in a…
-
0
votes3
answers364
viewsA: How to get the class name where a bean will be injected?
I don’t know what it would be like in Spring, but with the CDI standard it would be like this: @Produces public static Logger produceLog(InjectionPoint injectionPoint) { return…
-
13
votes8
answers26648
viewsA: How to backup Mysql Database Diaries?
I have a script that does just that: a backup of Mariadb/Mysql and the entire Postgresql and rsync the file to another location. #!/bin/bash BASE_DIR=/tmp/backups TMP_DIR="$BASE_DIR/$(date…
-
12
votes2
answers42348
viewsA: How to update/sync my repository master on github with the original master
What I usually do is: First, I do a Github source project sketch (ex.: https://github.com/gatein/gatein-portal) Then, a clone of my Github repository on my machine: $ git clone…
githubanswered jpkrohling 1,221 -
1
votes3
answers1547
viewsA: Save same object multiple times
Unfortunately, I can’t give you a precise explanation of what’s going on. Maybe it’s best to do a debugging session, especially at Jpautil. My guess: Tomcat always returns 10 new sessions, while…
-
7
votes4
answers2188
viewsA: Time spent developing tests
In fact, the comparison should not be made in terms of time spent writing the code versus time spent writing tests for the code. The comparison should be between time spent writing automated test…
-
2
votes4
answers1546
viewsA: How can I optimize a recursive method for finding ancestors?
This is a classic graph problem, and you can use some techniques for this, depending on the size of the problem you have. If your problem is only a few levels, then calculating the whole tree might…
-
3
votes2
answers1058
viewsA: How to configure HTTP authentication with Jboss?
utluiz’s answer is correct, especially because it deals with Jboss AS 6. For Jboss AS 7 (including Jboss EAP 6) and Wildfly, you must create a remake in the standalone.xml and create users within…
-
15
votes4
answers265
viewsA: How to set --no-ri --no-rdoc as default when using Gem install?
You can add a. gemrc file in your home, with the options you want to pass to all "Gem" commands by default: gem: --no-ri --no-rdoc
-
5
votes4
answers12597
viewsA: What are the advantages of Lambda Expressions in Java 8?
I think that this question has a very large scope, and no answer that can be given here will be better than the official documentation. But in a nutshell, Lambdas are constructions that make it…
-
13
votes2
answers321
viewsA: Which tool to use to generate releases in Java?
Generating a release is something very broad and involves many things. But the most basic can be achieved with Maven itself, via "release:prepare" and "release:perform". More details about the…
-
6
votes5
answers2222
viewsA: Which libraries to develop a Restful API in JAVA?
There are several solutions available in the market, but what I can recommend is learning the pattern. Java EE is a set of standards, and among them is the JAX-RS, which is exactly for REST. Read…
-
2
votes3
answers2543
viewsA: Unit test with database
There’s a Hibernate property called hibernate.hbm2ddl.auto. When you’re in create-drop, will erase everything and recreate from scratch, ideal situation for your tests. What I usually do is have a…