File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Hibernate compsite key timestamp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate compsite key timestamp" Watch "Hibernate compsite key timestamp" New topic
Author

Hibernate compsite key timestamp

Brian Mulholland
Ranch Hand

Joined: Mar 12, 2009
Posts: 61
I'm a bit of a Hibernate noob trying to maintain and modify a hibernate app. The situation is that we have a log/audit table that doesn't really need an autogenerated key. It is unique over a composite key. It was asked that we eliminate the unnecessary field.

However, it seems to us that Hibernate really stinks at composite keys. We argued for retaining the autogen key, but it was decided to remove it by powers greater than I. So I tried setting up my file using a composite of two keys.



This results in an exception:



I've tried a few derivations of this approach with similar issues. I think this is what some other developers have also hit and is why they are all trying to convert all our tables to use autogen numerical sequence keys. I keep feeling that Hibernate can't be as popular as it is and not have good support of composite keys...we must just not understand it well.

So can someone both help me with this current issue and maybe point me to a better understanding of whether Hibernate in fact is just not good at composite keys? And if it is good at it, how that works?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate compsite key timestamp