Search code examples
oracle-databasehibernatejpacriteriarowid

How to get the physical location(row id) of a record from DB using JPA+Hibernate


I want to fetch the rowID of a table that does not have a primary key. I could get the rowId using sql query.But i think RowID is database specific.So it is not going to work if the database changes.

Could someone help me to get the rowID either using hql or criteria ?


Solution

  • ROWID is virtual column like any other. Try to search for VIRTUAL column support in Hibernate.

    For example: http://johnpremjeetpage.blogspot.cz/2009/06/mapping-hibernate-to-computed-columns.html

    Last time I tried to use it in EclipseLink it failed. @ReadOnly annotation is ignored when combined with other annotations, and there was no way how to exclude a virtual column from generated insert statements.