-->
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: Cross table with data
PostPosted: Thu Jun 02, 2005 7:27 pm 
I fear that I already know the answer to this, but wanted to see if someone out there smarter than me knows of a way to accomplish this. :)

Because of some requirements on our database, which I have no power to change, every table in our database has three mandatory columns: ID (a Guid), DateCreated, and DateModified. This includes all the cross tables that make up the many-to-many relationships.

For the sake of an explanation, assume that I have a many-to-many relationship between a Person table and a Club table, with a cross table named Person_Club. I fully expect that this forces me to create a persistable class for the Person_Club table. Is it possible to also provide a way to skip the inner table and do something like:

Code:
Person somePerson;
Club someClub;

// set these up appropriately

somePerson.Clubs.Add(someClub);

and somehow intercept and appropriately set the mandatory values on the cross table before persisting to the database? I'm assuming this isn't possible, but would be absolutely thrilled if anyone knows a way to do this, as it would really help to further abstract our object model from our database model. Thanks in advance for any help on this!


Top
  
 
 Post subject:
PostPosted: Fri Jun 03, 2005 6:09 am 
Senior
Senior

Joined: Sat May 14, 2005 8:40 am
Posts: 130
Can't you use triggers on your database to fill the ID, DateCreated and DateModified columns? I really hate them but in this case they make sense, I think.

_________________
Cuyahoga


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.