Jan
26

Java Sorting Objects at Runtime using Comparator

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 …

Continue reading »

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 …

Continue reading »

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, …

Continue reading »

Permanent link to this article: http://www.javaplex.com/blog/hibernate-persist-vs-save/

Nov
25

For JSF 2.0, How to Enable EL 2.2 on Tomcat 6

How to Enable EL 2 for Java Server Faces 2.x on server running older EL version EXCEPTION: com.sun.faces.config.ConfigurationException: It appears the JSP version of the container is older than 2.1 and unable to locate the EL RI expression factory, com.sun.el.ExpressionFactoryImpl.  If not using JSP or the EL RI, make sure the context initialization parameter, com.sun.faces.expressionFactory, …

Continue reading »

Permanent link to this article: http://www.javaplex.com/blog/for-jsf-2-how-to-enable-el-2-2-on-tomcat-6/

Nov
24

Generic DAO with Hibernate and Spring

If you are using Hibernate with Spring, then you will be dealing with huge set of DAOs. In such case best way to minimize the DAO work with Generic DAO patter, which encapsulate CRUD + basic finder method and then write only very required methods. I’m inspired by the IBM Generic DAO pattern and rewrite …

Continue reading »

Permanent link to this article: http://www.javaplex.com/blog/generic-dao-with-hibernate-and-spring/

Nov
22

Spring Caching with Simple-Spring-Memcached (SSM)

Simple Spring Memcached (http://www NULL.slideshare NULL.net/nelz9999/simple-spring-memcached)

Permanent link to this article: http://www.javaplex.com/blog/spring-caching-with-simple-spring-memcached-ssm/

Nov
20

How to achieve Database Auto ID Generation Portability in Hibernate

Hibernate meant to be Database independent ORM solution, but while migrating to another database vendor some key issues arrives. One of them is Auto ID generation of underlying database. MySQL, Oracle & MS SQL Server all uses different techniques to generate auto ID for primary keys. So, when we start migrating we face lot of …

Continue reading »

Permanent link to this article: http://www.javaplex.com/blog/how-to-achieve-database-auto-id-generation-portability-in-hibernate/

Nov
17

MyEclipse Customizing Hibernate Reverse Engineering

Customize Myeclipse Hibernate Reverse Engineering

Most of the time you want to perform hibernate reverse engineering to generate Pojos from underlying database using hibernate-tools or directly from My Eclipse which also uses hibernate-tools. But some times we want to control the mechanism by which hibernate  tools generate pojos, like we want to have prefix or suffix in our class name …

Continue reading »

Permanent link to this article: http://www.javaplex.com/blog/myeclipse-customizing-hibernate-reverse-engineering/

Nov
03

Myfaces 2 Exception: could not find Factory: javax.faces.application.ApplicationFactory

Myfaces Exception: could not find Factory: javax.faces.application.ApplicationFactory This exception comes when you have Mojara jars on your server/tomcat etc and your are shipping MyFaces with your application, this will eventually comes out. So try to delete the Mojara from class path. Another problem while developing with MyEclipse, if you create a web project and set …

Continue reading »

Permanent link to this article: http://www.javaplex.com/blog/myfaces-2-exception-could-not-find-factory-javax-faces-application-applicationfactory/

Oct
10

Eclipse Error: A cycle was detected in the build path

We were just facing very tedious error  by eclipse “A cycle was detected in the build path” and it take some time what the problem was. Actually we You can instruct the Eclipse to ignore this error. Follow the instructions at. Preferences > Java > Compiler > Building > Build path problems > Circular dependencies …

Continue reading »

Permanent link to this article: http://www.javaplex.com/blog/eclipse-error-cycle-was-detected-the-build-path/

Page 1 of 912345...Last »