Hey Fernando. Thanks for response.
I forgot to mention one thing, Event class has "UserId" prop which is
mapped to "UserId" column of "Event" table.
As for absence of many-to-one relation between Event and User.. Yes,
it's the most obvious way to resolve my problem, but I'm curious if
there is another solution which will work without n:1 association. I'd
like to know if it's possilbe to write smth like:
var criteria = Session.CreateCriteria<Event>()
.{here it mappes UserTimeZone prop,
so everything is done in single SQL call}
.AddOrder(Order.Asc("Title"))
.SetMaxResults(50);
Event class has simple mapping where every prop is mapped to column as
property (except UserTimeZone), no associations.
On Oct 4, 4:10 am, Fernando Zago <[email protected]> wrote:
> Why don't u use many-to-one to user on Event class ?
>
> class Event{
> public int Id {get;set;}
> pubic string Title {get;set;}
> public User User {get;set;}
>
> }
>
> ---
> Vision without action is a waking dream.
> Action without vision is a nightmare.
>
> On Sat, Oct 3, 2009 at 2:21 PM, Tim Kolesnik
> <[email protected]>wrote:
>
>
>
> > Hello, I have such problem. There are 2 tables: User and Event.
> > User
> > ----------------
> > Id
> > Username
> > TimeZone
>
> > Event
> > ----------------
> > Id
> > Title
> > UserId
>
> > Event has FK to User table (UserId column). Here are corresponding
> > domain classes:
> > class User{
> > public int Id {get;set;}
> > public string TimeZone {get;set;}
> > }
>
> > class Event{
> > public int Id {get;set;}
> > pubic string Title {get;set;}
> > public string UserTimeZone {get;set;}
> > }
>
> > As you can see Event.UserTimeZone property doesn't have column in db.
> > I'd like to retrieve it's value dynamically. Is it possible to
> > implement such via Criterion API in single db call (e.g. retrieve all
> > events, with filled UserTimeZone prop) ? Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" 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/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---