Compare Enums


compareTo method is declared as final in Enums so you cannot override it. The default compareTo method is comparing the ordinals ( the order they are defined ) in the Enum. If you want to compare your enums based on name what you can do is, writing your own comparator and use it. For example:

public enum Category {



public class CategoryComparator implements Comparator<Category> {

public int compare(Category o1, Category o2) {
Collator collator = Collator.getInstance(new Locale("tr"));

and use it in your sort method like :

Collections.sort(categories,new CategoryComparator());

and that is it.

if you want to know why I used Collator to compare check here

Hibernate PersistentSet remove not working


if you have trouble removing an object from a persistent set in hibernate, there is a bug in equals and hashcode

see it here

If you have this problem you can do things like creating a new set and adding the current set excluding the one that you want to remove etc.

I hope it is fixed quickly.