-->
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.  [ 1 post ] 
Author Message
 Post subject: ManyToMany with extra field in mapping table
PostPosted: Thu Jun 26, 2008 9:37 am 
Newbie

Joined: Thu Jun 26, 2008 9:21 am
Posts: 2
Hi all.

Here the following situation:

Code:
    [NHibernate.Mapping.Attributes.Class]
    public class Appointment : AbstractData, IComparable
    {
        private ISet<Employee> employees = new SortedSet<Employee>();
        [NHibernate.Mapping.Attributes.Set(0, Table = "appointment_employee")]
        [NHibernate.Mapping.Attributes.Key(1, Column = "appointment_id")]
        [NHibernate.Mapping.Attributes.ManyToMany(2, Column = "employee_id", Class = "VetMedLib.Common.Employee, VetMedLib")]
        public virtual ISet<Employee> Employees
        {
            get { return employees; }
            set { employees = value; }
        }


Generates following table via NHibernate.Tool.hbm2ddl.SchemaExport:

Code:
create table appointment_employee (
   appointment_id int4 not null,
   employee_id int4 not null,
   primary key (appointment_id, employee_id)
);


I am quite happy with it, but I want to have an extra field in the mapping table ala

Code:
create table appointment_employee (
  id int4 not null,
  appointment_id int4 not null,
  employee_id int4 not null,
  primary key id
);


The problem is that the current used db-replication system can not handle pks ala (appointment_id, employee_id).

What are my possible ways to archive this requirement?

Thanks,
ac


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

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.