I am using Spring+HibernateDAO and want to access a table which does not have a primary key. Because Hibernate requires that entity tables have primary keys. ,I need to create some virtual primary key(perhaps), just to fool hibernate (it satisfies with @Id only) Or doing any efforts on database side without touching existing table is also fine. Please suggest any workaround which does NOT require ALTER EXISTING TABLE , any other table inheritance/structure changes are welcome.
PS. Already using JDBC template with manual mapping of columns to custom object.DB is Sybase ASE15 if it matters.
q.setResultTransformer(Transformers.aliasToBean(Y.class));but this fails with: org.hibernate.PropertyNotFoundException: Could not find setter for some_property. X has a field called someProperty with the appropriate getter and setter but in this case it doesn't seem like Hibernate maps the column name (some_property) to the correct field name. Agree its a good idea but ,I will let the question still open as perhaps we may get more featured solution.