Use the whole row as the primary key (or just the significant set of columns). Remember that not having a actual primary key defined in the table does not mean their is not a set of columns that can be used as key. In fact their HAS to be something since without you can not see the difference between 2 rows - and then you could just delete one of them ;)

/max

Fredrik Larsson wrote:

Hello.

I would like to use hibernate and especially the criteria interface for
an application that my company will be building. The problem is that the
application will work against a legacy database (udb on mainframe) and
that the tables contains no column marked as a primary key. Essentially
the database seems to be a replacement for a flat file and it is
structured as a csv-file without any normalization or any other feature
one usually finds in a relational datamodel.

My proof of concept showed some problems when I have no reliable primary
key column.
1) Xdoclet throws an exception and refuses to generate hbm.xml files for
classes that do not have an @hibernate.id getter/setter.
2) Manually fixing a correct hbm.xml without an id column will result in
a list filled with null values (it does have a correct length though :-)
) when i use the Criteria.list() method to get an answer to a query.

Is there a solution to this problem? I could not find any documentation
that described how to handle tables without primary keys.

Thanks in advance
Fredrik



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel



------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ hibernate-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to