Hudson-

The challenge is that they're actually separate materialized views (there's
a LOT of BI that goes into defining a "schedule" so the views are
materialized during the evenings--and even that takes several hours to
churn).  I can't map directly to the tables for this information... almost
every column is calculated for the MV.  That's why our DBA gets paid the big
bucks. ;)

Ideally, I wish I could do something like...

public class StudentMap : ClassMap<Student>
{

  ....

private void CreateMap()
{
  HasMany(x => x.FullSchedule);
  HasMany(x => x.TodaySchedule).SubstituteTableName("schedule");
}

}

Where passing the WithTableName on the map would override the
ClassMap<Course>'s specification for WithTable("abc").  If WithTableName
isn't called on the HasMany, it simply uses the default one provided in the
Map.

So, while that's out there, subclasses might be the next best thing...if I
could get the names into something not so repetative.

Base Class: Course (holding all of the properties/methods)
Subclass : FullCourse inheriting Course
Subclass : DayCourse inheriting Course

FullSchedule = List<FullCourse>
TodaySchedule = List<DayCourse>

That really sits funny with me though... overhead and repetition just for
the sake of mapping.  I'm sure, somehow, I'm making this harder than it
should be. Hah.  Mondays.. ugh.

-dl

On Mon, Jun 1, 2009 at 12:04 PM, Hudson Akridge <[email protected]>wrote:

> Erm, apologies for the syntax, mixed and matched NH and FNH there ;) You
> want:
> On your FullSchedule's mapping: 
> .HasMany().YourFluentMappings().Where("constraint
> statement for roster courses"); On your TodaySchedule's
> mapping: HasMany().YourFluentMappings().Where("constraint statement for
> schedule courses");
>
>
> On Mon, Jun 1, 2009 at 12:00 PM, Hudson Akridge 
> <[email protected]>wrote:
>
>> Well, ideally your scenario would exist with subclassing on the Course,
>> assuming you actually did want them stored in separate tables (instead of
>> views that represent tables).
>> In your scenario though, the answer I'd recommend would be to use the
>> WHERE="<your constraint here>" on the HasMany() collection mapping from
>> Schedule (full/today). This would replace the two views, as the views seem
>> to only have constraints differentiating them, not data. Course would be
>> mapped to the table that the two views are based on.
>>
>>
>> On Mon, Jun 1, 2009 at 11:43 AM, David R. Longnecker <
>> [email protected]> wrote:
>>
>>> There are quite a few examples out there of how to map properties of a
>>> single entity to multiple tables; however, I'm trying to find a way to map
>>> the SAME physical characteristics of an entity to different tables.
>>>
>>> Example:
>>>
>>> A student has two types of "schedule"--their overall schedule and
>>> "today's" schedule (most of our students use a block/rotating schedule on
>>> Monday/Wednesday/Friday and Tuesday/Thursday).
>>>
>>> Student ::
>>>   FullSchedule = List<Course> reads an Oracle materialized view (roster)
>>>   TodaySchedule = List<Course> reads an Oracle materialized view
>>> (schedule)
>>>
>>> However, for the class mappings, I don't see a way to use the same entity
>>> (Course) multiple times.
>>>
>>> What would be the best way to do this?  The two objects will ALWAYS be
>>> identical... it's more of simply placing a time constraint at database side.
>>>
>>> Any suggestions/ideas would be greatly appreciated. :)
>>>
>>> Thanks!
>>>
>>> -dl
>>>
>>> --
>>> David R. Longnecker
>>> blog: http://blog.tiredstudent.com
>>> twitter: dlongnecker
>>>
>>>
>>>
>>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to