So I'd say - map the tables you need to update, then use the DTO from the
view to retrieve and update those tables.
As for retrieving, if you have many tables in the "read" that you do not
need mapped for the "update" then keep to the SQL. otherwise it might be a
good idea to map those too and use hql, and maybe with time you'll end up
with an incrementally fully mapped domain model, which might be useful later
on.

On Tue, Sep 9, 2008 at 9:03 AM, erikash <[EMAIL PROTECTED]> wrote:

>
> Yes, but not all of them...
> Thank you very much for your help Ken! =)
>
> On Sep 8, 4:56 pm, "Ken Egozi" <[EMAIL PROTECTED]> wrote:
> > but you do need to update the data on these non-mapped tables?
> >
> >
> >
> > On Mon, Sep 8, 2008 at 5:54 PM, erikash <[EMAIL PROTECTED]> wrote:
> >
> > > ok, i have an app (a different one in production) which uses an oracle
> > > database, i'm currently writing on another app, used to monitor the
> > > previous one, parts of the monitoring involves querying the database,
> > > therefore i don't need to map all the tables, only the tables that are
> > > relevant for the monitoring...
> >
> > > for example i need to map the "users" table, to later disconnect them
> > > if i wish from the monitoring app, but i don't need to map other 10
> > > tables that have foreign keys to the users table... (i use a sql query
> > > and projection to get that data)
> >
> > > any suggestions?
> >
> > > On Sep 8, 5:45 pm, "Ken Egozi" <[EMAIL PROTECTED]> wrote:
> > > > I don't get it.
> > > > is your classes not mapped to the db tables? how (or rather why) are
> you
> > > > using NH/AR at all then?
> >
> > > > On Mon, Sep 8, 2008 at 5:39 PM, erikash <[EMAIL PROTECTED]> wrote:
> >
> > > > > Thanks, i agree that it is important, but i can't change my scheme,
> > > > > i'm working on a monitoring app, and the database is being used by
> the
> > > > > real app...
> >
> > > > > i wish that using hql (and thus mapping all the tables to classes),
> > > > > would be sufficient to persist the projection... (i wish i could
> > > > > implement that feature!!!)
> >
> > > > > Erik.
> >
> > > > > On Sep 8, 4:35 pm, "Ken Egozi" <[EMAIL PROTECTED]> wrote:
> > > > > > > is there a benefit for using HqlBasedQuery instead
> > > "CreateSQLQuery"?
> >
> > > > > > well HQL is working on the object driven domain model, while SQL
> is
> > > > > working
> > > > > > on the E/R model
> >
> > > > > > I'd try and use NamedQueries anyway, as they give you the nice
> effect
> > > of
> > > > > the
> > > > > > ability to switch from hql to sql without affecting the calling
> call
> > > at
> > > > > all
> >
> > > > > > On Mon, Sep 8, 2008 at 4:26 PM, erikash <[EMAIL PROTECTED]>
> wrote:
> >
> > > > > > > Thank you very much Ken, that's exactly the case...
> > > > > > > in my code i'm using the instance method "CreateSQLQuery()", in
> > > your
> > > > > > > blog post:
> >
> > >http://www.kenegozi.com/Blog/2006/10/08/projection-using-activerecord.
> > > > > ..
> >
> > > > > > > you used "HqlBasedQuery", i didn't use it because i didn't map
> all
> > > the
> > > > > > > tables used in the my sql query to objects. (there are too many
> of
> > > > > > > them)
> > > > > > > is there a benefit for using HqlBasedQuery instead
> > > "CreateSQLQuery"?
> > > > > > > AFAIK they both return typed objects...
> >
> > > > > > > On Sep 8, 2:05 pm, "Ken Egozi" <[EMAIL PROTECTED]> wrote:
> > > > > > > > my two pence:
> >
> > > > > > > > should i use projection to bind the grid to the data?
> >
> > > > > > > > yes.
> > > > > > > > Unless your persistable domain objects fits perfectly within
> the
> > > > > view,
> > > > > > > which
> > > > > > > > is not likely as you describe it as a complex thing, it's
> > > advisable
> > > > > to
> > > > > > > have
> > > > > > > > a single query building up the necessary projection for the
> view.
> >
> > > > > > > > > if so then how will i unbind the data, update my models and
> > > save
> > > > > the
> > > > > > > > > changes to the db?
> >
> > > > > > > > manually. That is - you load, populate and save the domain
> > > objects
> > > > > > > according
> > > > > > > > to the given DTO received from the view
> >
> > > > > > > > On Mon, Sep 8, 2008 at 9:39 AM, erikash <[EMAIL PROTECTED]>
> > > wrote:
> >
> > > > > > > > > Hi, I've asked this question on the activerecord forums,
> but i
> > > fill
> > > > > > > > > that this question may be more relevant here...
> > > > > > > > > i'm working on a new project that accesses a legacy
> database,
> > > which
> > > > > i
> > > > > > > > > cannot change/refactor.
> > > > > > > > > anyway, i have a view which contains a grid that has many
> > > columns
> > > > > > > > > coming from different tables in th db (and mapped to
> different
> > > > > objects
> > > > > > > > > in my domain layer), and that grid is open for
> modifications...
> > > > > should
> > > > > > > > > i use projection to bind the grid to the data? if so then
> how
> > > will
> > > > > i
> > > > > > > > > unbind the data, update my models and save the changes to
> the
> > > db?
> >
> > > > > > > > > Thanks in advance,
> > > > > > > > > Erik.
> >
> > > > > > > > --
> > > > > > > > Ken Egozi.
> >
> > >http://www.kenegozi.com/bloghttp://www.musicglue.comhttp://www.castle.
> > > > > ..
> >
> > > > > > --
> > > > > > Ken Egozi.
> > > > >
> http://www.kenegozi.com/bloghttp://www.musicglue.comhttp://www.castle.
> > > ..
> >
> > > > --
> > > > Ken Egozi.
> > >http://www.kenegozi.com/bloghttp://www.musicglue.comhttp://www.castle.
> ..
> >
> > --
> > Ken Egozi.
> http://www.kenegozi.com/bloghttp://www.musicglue.comhttp://www.castleproject.orghttp://www.gotfriends.co.il
> >
>


-- 
Ken Egozi.
http://www.kenegozi.com/blog
http://www.musicglue.com
http://www.castleproject.org
http://www.gotfriends.co.il

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to