Java gives very convenient way for sorting collection types by Collections.sort method. It have two flavors Collections.sort( collection, new Comparator < T>( )){} This is runtime sorting, & you will create an anonymous class implementation and will override Comparator’s compare method and return value -1, 0 , 1. Collections.sort( collection) You provide collection whose objects implemented Comparable or Comparator interface …
Tag Archive: java
Permanent link to this article: http://www.javaplex.com/blog/java-sorting-objects-at-runtime-using-comparator/
Jan
26
Hibernate Enum Datatype Mapping
If you want to map a enum in JPA/Hibernate POJO class, so that only specific values can be saved for underlying database column, it is possible now very easily. The sample POJO File is given below, have an idea. @Enumerated( javax.persistence.EnumType.STRING ) tells what values you want into database from provided enum type, & hibernate will …
Permanent link to this article: http://www.javaplex.com/blog/hibernate-enum-datatype-mapping/
Jan
17
Hibernate persist() vs. save()
In case anybody finds this thread… For persist() The semantics of this method are defined by JSR-220. persist() is well defined. It makes a transient instance persistent. However, it doesn’t guarantee that the identifier value will be assigned to the persistent instance immediately, the assignment might happen at flush time. The spec doesn’t say that, …
Permanent link to this article: http://www.javaplex.com/blog/hibernate-persist-vs-save/
Sep
14
What’s New in JDK7
JDK7 offers whole set of new exciting features…….. Following is the compact list of JDK7 new feature Swing The JLayer class has been added, which is a flexible and powerful decorator for Swing components; see How to Decorate Components with JLayer. The Nimbus Look and Feel has been moved from the com.sun.java.swing package to the …
Permanent link to this article: http://www.javaplex.com/blog/what-new-in-jdk7/
Sep
05
Hibernate – How to use database’s reserved keywords in HQL and Pojos?
1. Enclose the column name with square brackets [] will solve your problem. @Column(name = “[ORDER]“, nullable = false) public String getOrder() { return order; } And for Hibernate XML Mapping <property name=”Order” type=”string” > <column name=”[ORDER]” length=”128″ /> </property>
Permanent link to this article: http://www.javaplex.com/blog/hibernate-how-to-use-databases-reserved-keywords-in-hql-and-pojos/
Jul
19
Vaadin: The GWT Development Framework
Vaadin is GWT development framework which facilitate the RIA rapid development. Vaadin is a web application framework for Rich Internet Applications. Vaadin is a large collection of UI components. Vaadin is a robust architecture for rapid application development. Vaadin’s recent release 6.6 with GWT 2.3 adds “touch support” which means you can add touch support …
Permanent link to this article: http://www.javaplex.com/blog/vaadin-the-gwt-development-framework/
