Hi Sandeep,
was this a question or just a statement
Anyway, I think I understand the problem and I had recently the same. A simple solution to integrate this with O/R mapping based on JPA or Hibernate is to use named queries with which you can exactly define this kind of "filter" to get a specific version of an entity by defining a EJBQL query corresponding to the SQL statement you have given.
This is not exactly as nice to use as getting an entity simply by its primary key but it's surely better than using native SQL queries.
Marco