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.  [ 4 posts ] 
Author Message
 Post subject: How to handle table not having primary key
PostPosted: Mon Jun 23, 2008 1:15 pm 
Newbie

Joined: Sun Jun 22, 2008 11:08 pm
Posts: 2
I have a table which has fileds like
OptionID,CustomAttributeID,DeptID,OptionType,OptionValue,Caption,HelpText

My table does not have a primary key.

Ineed to specify the value for all columns while inserting a new value for the table.

SO please let me know how my xml (mapping file)should look like.

I have written this is it correct?
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="false">

<class name="myVRM.DataLayer.vrmCustomAttributes, vrmDataLayer" table="Dept_CustomAttr_Option_D">

<id name="OptionID" column="OptionID" type="Int32" >
<generator class="assigned" />
</id>
<!-- Map properties I'd like to persist/fetch, assume column = propery name, and type is determined by reflection -->
<property name="CustomAttributeID"/>
<property name="DeptID"/>
<property name="OptionType"/>
<property name="OptionValue"/>
<property name="Caption"/>
<property name="HelpText"/>
</class>
</hibernate-mapping>
[/list]


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 24, 2008 2:25 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Looks good as long as OptionId is unique. Do you have any problems with that mapping ?

_________________
--Wolfgang


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 24, 2008 7:33 am 
Newbie

Joined: Mon Sep 17, 2007 4:39 am
Posts: 5
But in the mapping xml, optionId is defined a primary key...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 24, 2008 7:33 am 
Newbie

Joined: Mon Sep 17, 2007 4:39 am
Posts: 5
But in the mapping xml, optionId is defined a primary key...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.