473,396 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

object-relational mapping question

I have these tables:

create table cd_language_saaa
(
saaapk int not null PRIMARY KEY,
code varchar(50) not null
)

create table cd_calendar_saaj
(
saajpk int not null PRIMARY KEY,
code varchar(50) not null
)

create table calendar_translation_saak
(
saakpk int not null PRIMARY KEY,
saaj_cd_calendar int not null,
saaa_cd_language int not null,
short_description varchar(50) not null,
long_description varchar(255) not null,
CONSTRAINT U_calendartranslation
UNIQUE NONCLUSTERED (saaj_cd_calendar, saaa_cd_language),
CONSTRAINT FK_calendartranslation_salaat
FOREIGN KEY (saaj_cd_calendar)
REFERENCES cd_calendar_saaj (saajpk),
CONSTRAINT FK_calendartranslation_language
FOREIGN KEY (saaa_cd_language)
REFERENCES cd_language_saaa (saaapk)
)

This is sample data in these tables:

insert into cd_language_saaa (saaapk, code) values (1, 'English')
insert into cd_language_saaa (saaapk, code) values (2, 'French')

insert into cd_calendar_saaj (saajpk, code) values (1, 'Gregorian')
insert into cd_calendar_saaj (saajpk, code) values (2, 'Hijri')

insert into calendar_translation_saak
(saakpk, saaj_cd_calendar, saaa_cd_language, description)
values (1, 1, 1, 'Gregorian')
insert into calendar_translation_saak
(saakpk, saaj_cd_calendar, saaa_cd_language, description)
values (2, 1, 2, 'Gregorian (fr)')
insert into calendar_translation_saak
(saakpk, saaj_cd_calendar, saaa_cd_language, description)
values (3, 2, 1, 'Hijri')
insert into calendar_translation_saak
(saakpk, saaj_cd_calendar, saaa_cd_language, description)
values (4, 2, 2, 'Hijri (fr)')

Now I am building classes for these tables:

public class CdLanguage
{
private short _languageId;
private string _languageCode;
}

public class CdCalendar
{
private short _calendarId;
private string _calendarCode;
}

public class CalendarTranslation
{
private int _calendarTranslationId;
private CdCalendar _cdCalendar;
private CdLanguage _cdLanguage;
private string _shortDesc;
private string _longDesc;
}

Now question is how can the CdCalendar has reference to its
CalendarTranslation(s)?
I can modify CdCalendar to be
public class CdCalendar
{
private short _calendarId;
private string _calendarCode;
private CalendarTranslation[] _calendarTranslations;
}

But would not it be bad that CdCalendar has a a reference to a class which
depends on CdCalendar creation?

Or may be I am not designing CdCalendar properly. Do I really need
CalendarTranslation?

Thanks
May 3 '07 #1
0 966

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bijay Kumar | last post by:
Hi Guys, I was going through the source code of Object.cs in rotor. What I found is Equals() implemented as follows: public extern virtual bool Equals(Object obj); What I don't...
28
by: Daniel | last post by:
Hello =) I have an object which contains a method that should execute every x ms. I can use setInterval inside the object construct like this - self.setInterval('ObjectName.methodName()',...
9
by: Keith Rowe | last post by:
Hello, I am trying to reference a Shockwave Flash Object on a vb code behind page in an ASP.NET project and I receive the following error: Guid should contain 32 digits with 4 dashes...
11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
44
by: Steven T. Hatton | last post by:
This may seem like such a simple question, I should be embarrassed to ask it. The FAQ says an object is "A region of storage with associated semantics." OK, what exactly is meant by "associated...
16
by: sneill | last post by:
How is it possible to take the value of a variable (in this case, MODE_CREATE, MODE_UPDATE, etc) and use that as an object property name? In the following example I want 'oIcon' object to have...
9
by: Andrew Au | last post by:
Dear all, I am trying to write a piece of software that use Object Oriented design and implement it with C, I did the following == In Object.h == typedef struct ObjectStructure* Object; ...
0
by: Bijay Kumar | last post by:
Hi Guys, I was going through the source code of Object class (Object.cs in rotor). What I found is Equals() implemented as follows: public extern virtual bool Equals(Object obj); What...
5
by: Matthew | last post by:
I have a nice little Sub that saves data in a class "mySettings" to an XML file. I call it like so: Dim mySettings As mySettings = New mySettings mySettings.value1 = "someText" mySettings.value2...
3
by: User1014 | last post by:
A global variable is really just a property of the "Global Object", so what does that make a function defined in the global context? A method of the Global Object? ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.