joinus-java

How to disable weak cipher suites in Java

If you want to set up used cipher suites in your Java application, you can do it by property jdk.tls.disabledAlgorithms for TLS ciphers and jdk.certpath.disabledAlgorithms for SSL certificates, in security policy file java.security. This file is located in {APP_HOME}/jre/lib/security folder. If you want to set which TLS will be used, you can do it in the same […]

Read More

hibernate

Hibernate – CASE WHEN in HQL – ParameterNode cannot be cast to SelectExpression

If you want to use SQL USE … WHEN … ELSE expression in HQL (Hibernate Query Language), you may faced to this: java.lang.ClassCastException: org.hibernate.hql.internal.ast.tree.ParameterNode cannot be cast to org.hibernate.hql.internal.ast.tree.SelectExpression This exception is raised during parsing SQL to HQL. If you will check method getFirstThenNode() from class CaseNode.java in package org.hibernate.hql.internal.ast.tree, you are able to see casting to SelectExpression. And there is […]

Read More

joinus-java

Enum – Create groups for values

If you need to create groups for your Enum class, there are few options which you can choose. Here is examples of two ways. Inner Enum class public class EnumGroups { public enum Fields{ USER_NAME(Group.USER_BASIC), USER_SURNAME(Group.USER_BASIC), USER_EMAIL(Group.USER_BASIC), USER_PHONE(Group.USER_BASIC), USER_STREET(Group.USER_ADDRESS), USER_ZIP(Group.USER_ADDRESS), USER_COUNTRY(Group.USER_ADDRESS), USER_NEWS(Group.USER_SETTINGS), USER_PRODUCT(Group.USER_SETTINGS); Fields(Group group) { this.group = group; } private final Group group; public […]

Read More