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 ?
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.