B> It is also something that is very easy to forget about. So use with caution.
C> They get two tables inserted.* deleted.*, which you can work with as you wish.
Wow Wow Wow!!!! I have never heard of or used that capability, but that sounds very powerful. So the reads would be normally NHibernate mapped to a view, but the views would be configured to do other stuff on inserts/updates. Do these triggers get the full insert/update command as generated by NHib.apologies for my ignorance in this area.craig
On 6/13/06, Ayende Rahien < [EMAIL PROTECTED]> wrote:For the views, I'm using INSTEAD OF TRIGGERS, which allows me to override the DB behavior, and let NHib think that the views are actually tables.
On 6/13/06, Craig Neuwirt < [EMAIL PROTECTED]> wrote:
On 6/12/06, Ayende Rahien < [EMAIL PROTECTED] > wrote:There are two ways to do this, I am currently using the second one for the writable tables.
- Views – Triggers instead of update/delete/insert that maps the view data to the appropriate table structure.
So for this, you would map NHibernate Entities to your views. What happens when NHibernate tries to insert/update into a view? Didn't quite understand where triggers come into play.
- Writable tables that are updated from by NHibernate, with DB jobs that sync the database if needed.
So for this you create your desired Domain Model and use Nhibernate to persist in the Application. You then have DB jobs to periodically sync to the db
The first approach is the one I would prefer, since this is much cleaner interface.
The second approach is better if you want to migrate from one schema to another, and you have got other applications that talk to that db.
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Craig Neuwirt
Sent: Monday, June 12, 2006 9:07 PM
To: [email protected]
Subject: Re: [Castle-users] Using ActiveRecord with Legacy Database
I would like to use NHib on top of Views, but how will NHibernate work when the data needs to be inserted or updated?
On 6/12/06, Ayende Rahien <[EMAIL PROTECTED]> wrote:
I'm currently doing some work on a database that originated from a main frame, with some of the craziest stuff there that I ever hope to see. Think about all the possible entities, shoved into random tables, with random names. (Oh, and in Hebrew, too).
What I did there is to break entities out of the tables using view, so instead of working against that schema, we have a much nicer model to work against.
Saving is tricky, but most of the data is read only. It is triggers and cheating when it is not possible.
The end result is three tiers of the data:
- Real database - really ugly and not easy to work with
- Views database - makes sense if you look at it from afar
- OR/M (NHib) - Gives a reasonable way to work with the system.
The problem in this is that sometimes I need to cheat on all three levels to get something to work.
But it is working, and we get very good results out of it.On 6/12/06, hammett <[EMAIL PROTECTED] > wrote:
I'm in a kind similar situation. I didn't use AR nor NHibernate at
all. Anyway, you might want to spike it for a while before making a
decision.
On 6/12/06, Craig Neuwirt < [EMAIL PROTECTED]> wrote:
> However, the existing app uses a set
> of tables that do not represent the domain AT ALL. Stored Procedures are
> used to access and update the tables. Eventually, I will replace the
> database schema, but for now I need to live with it. As such, I would like
> to use ActiveRecord in my controllers. Is this possible? Can ActiveRecord
> interact with the database in a custom way?
--
Cheers,
hammett
http://hammett.castleproject.org/
_______________________________________________
CastleProject-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/castleproject-users
_______________________________________________
CastleProject-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/castleproject-users
_______________________________________________
CastleProject-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/castleproject-users_______________________________________________
CastleProject-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/castleproject-users
_______________________________________________
CastleProject-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/castleproject-users
_______________________________________________
CastleProject-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/castleproject-users
_______________________________________________ CastleProject-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/castleproject-users
