-->
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: redundant parameters in generated domain-class constructor
PostPosted: Wed Sep 14, 2011 3:34 am 
Newbie

Joined: Thu Sep 18, 2008 4:53 am
Posts: 5
Hi

(I posted the same message in the Hibernate Users forum yesterday, sorry about that)

I am using Hibernate-Tools to generate a mapping for a SQLServer database. My model contains two tables named Contact and Centre, which both have an int as id. There is also an association-table called Contact_Centre, defined as follows:

Code:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[Contact_Centre](
   [centreId] [int] NOT NULL,
   [contactId] [int] NOT NULL,
   [startdate] [smalldatetime] NULL,
   [enddate] [smalldatetime] NULL,
CONSTRAINT [PK_Contact_Centre] PRIMARY KEY CLUSTERED
(
   [centreId] ASC,
   [contactId] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

GO
ALTER TABLE [dbo].[Contact_Centre]  WITH NOCHECK ADD  CONSTRAINT [FK__Contact_C__centr__4F72AE6C] FOREIGN KEY([centreId])
REFERENCES [dbo].[Centre] ([id])
GO
ALTER TABLE [dbo].[Contact_Centre] NOCHECK CONSTRAINT [FK__Contact_C__centr__4F72AE6C]
GO
ALTER TABLE [dbo].[Contact_Centre]  WITH NOCHECK ADD  CONSTRAINT [FK__Contact_C__conta__5A846E65] FOREIGN KEY([contactId])
REFERENCES [dbo].[Contact] ([id])
GO
ALTER TABLE [dbo].[Contact_Centre] CHECK CONSTRAINT [FK__Contact_C__conta__5A846E65]


What puzzles me is the fact that the generated ContactCentre class has a constructor with this signature:

Code:
public ContactCentre(ContactCentreId id, Contact contact, Centre centre)


rather than

Code:
public ContactCentre(ContactCentreId id)


which I would expect according to my experience with MySQL (this is why I suspect that using SQLServer has something to do with the issue). It doesn't make much sense to ask for a Contact and a Centre object when a ContactCentreId is already required, does it?

Any help much appreciated.


Top
 Profile  
 
 Post subject: Re: redundant parameters in generated domain-class constructor
PostPosted: Thu Sep 22, 2011 3:31 am 
Newbie

Joined: Thu Sep 18, 2008 4:53 am
Posts: 5
... any ideas?


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.