-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Mapping Table with No Key
PostPosted: Wed Mar 22, 2006 10:29 am 
Newbie

Joined: Fri Jun 24, 2005 3:57 pm
Posts: 11
I have a table that has no primary key value. The table is used to simply perform insert only operations and serves as an audit log.

How do I map this without an ID?

The application currently uses Hibernate for the other DB functions. I would hate to break from that and now use native SQL for this one operation.

Thanks,
Ken


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 22, 2006 10:41 am 
Newbie

Joined: Tue Mar 21, 2006 1:42 pm
Posts: 14
I would really suggest altering the table and adding an artificial primary key. With that said, there must be some set of fields in said table that are considered unique (otherwise the table is pretty useless), so you could use that set of fields as a composite-id. However, all members of the composite-id need to non-nullable.

Code:
<composite-id>
   <key-property name="foo" column="foo" type="string"/>
   <key-property name="bar" column="bar" type="string"/>
   ...
</composite-id>

_________________
Mike Ringrose


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.