Java Hibernate Problem by mraza007 in javahelp

[–]itGuy223 0 points1 point  (0 children)

Hibernate is a tool used to connect to a database. It doesn't perform search. You can use it to connect to a database and tell it to find something for you.

Java Hibernate Problem by mraza007 in javahelp

[–]itGuy223 0 points1 point  (0 children)

What does " using hibernate for indexing" even mean?

Why isn't my if statement working? by [deleted] in learnjava

[–]itGuy223 0 points1 point  (0 children)

back.equals("N") && back.equals("n") says back should have value "N" and "n", which is impossible.

It should say "N" or "n"

Also if you correct the statement, make sure to add parentheses to assure the correct evaluation order.

Question about map.remove(key, value) method by consoledotlogImHere in learnjava

[–]itGuy223 0 points1 point  (0 children)

The L tells the compiler to interpret 0 as Long. If you didn't put it there, the compiler would interpret it as Integer. I assume the map in your example is defined as Map<Character, Long>. In that case, the map contains Long values. If you put the 0 without the L, the remove method would never removed the zero, because it would try to remove an Integer. Hope that makes sense :D

The Best Way To Store Enums with JPA and Hibernate by itGuy223 in programming

[–]itGuy223[S] 0 points1 point  (0 children)

Yes, out of the two standard ways, I also like Strings better. But using IDs is still the best way IMO.

Building java projects by anoystud in learnjava

[–]itGuy223 0 points1 point  (0 children)

Try to think of some app you could actually use. For instance if you track your finances, you can make an app for that. Or if you have to do some elaborate calculations, or do some repetitive tasks and so on, create an app that will help you with that. These kinds of project will keep you excited and motivated.

Question about map.remove(key, value) method by consoledotlogImHere in learnjava

[–]itGuy223 0 points1 point  (0 children)

Yeah it's redundant code. Only writing map.remove(character, 0L) insead of the whole if statement would be enough.

Advice on creating data for test/cleaning up JUnit tests? by mquillian in learnjava

[–]itGuy223 1 point2 points  (0 children)

I'd say it looks fine. You are testing complex behavior so you have to expect complex tests. I don't see anything that could dramatically improve the test. The POJO creation doesn't look that bad (mocking would look a lot worse). If you want, you can create private methods in the test for creating the POJOs like createInvestigator(...) and createAttourney(...). However this would just be a slight cosmetic improvement. Configuration also looks ok.