Re: [nhusers] Regarding using Nhibernate to backup databases

313 views
Skip to first unread message

Oskar Berggren

unread,
Sep 6, 2012, 8:15:53 AM9/6/12
to nhu...@googlegroups.com
Why not use the backup tools of the database engine?

/Oskar


2012/9/6 EmptyNull <timothy.ma...@gmail.com>
Is there any functionality for this?
Or am I forced to get the mapping and fetching the data myself?

The database my app connects to might not necessarily be the same type.

--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/nhusers/-/8Kpcd63bxecJ.
To post to this group, send email to nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.

Ramon Smits

unread,
Sep 6, 2012, 8:38:06 AM9/6/12
to nhu...@googlegroups.com

You are referring to a generic way to export/import a complete data set I think. For example, doing an export of your app running against mysql and importing that data into an instance running agains mssql.

Correct?

sbohlen

unread,
Sep 6, 2012, 8:54:23 AM9/6/12
to nhu...@googlegroups.com
There's not any special capability to do this in NH (beyond the obvious of "you can query everything, persist it to disk, then insert it all over again").

You probably need to distinguish your own needs here betw "backup" and "data import-export".  NH will never be a replacement for a 'backup' but you *could* use it for bulk import-export tasks.  But the scope of what you'd get would meet only the very simplest of needs anyway since you'd not be "backing up" anything other than the contents of tables (i.e., no sprocs or anything else other than just the data itself).

You *might* be able to twist NH into doing a comprehensive import-export (obviously the scope of the import-export would be limited to what you bothered to map in xml or otherwise) but you'll never get NH to do the work that the database's own intrinsic 'backup' system offers.  Even if you get NH to do mass import-export, and even if you use techniques like stateless sessions, etc. I'd suggest that this probably isn't a good use-case for NH.

Just my 2-cents.

-Steve B.

On Thursday, September 6, 2012 8:43:10 AM UTC-4, EmptyNull wrote:
That is what I'm currently using.

mysqldump.exe to get a dump of the database and mysql.exe to restore the dump.
But that only works on mysql databases.

My boss wants that the code works for any databases hooked to nhibernate. Ie not only mysql but also mssql/etc

David Schmitt

unread,
Sep 6, 2012, 8:59:11 AM9/6/12
to nhu...@googlegroups.com

NHibernate is not designed for this kind of work, the same way a baby
buggy is not built for hauling bricks: it's annoying for the first load
and it will break down long before the house is finished.

Even using stateless sessions, such a scheme will be horribly slow
compared to a true backup solution and will lack many important features
like incrementals, compression and schema management.

Best Regards, David

On 06.09.2012 14:43, EmptyNull wrote:
> That is what I'm currently using.
>
> mysqldump.exe to get a dump of the database and mysql.exe to restore the
> dump.
> But that only works on mysql databases.
>
> My boss wants that the code works for any databases hooked to
> nhibernate. Ie not only mysql but also mssql/etc
>
> On Thursday, September 6, 2012 2:38:11 PM UTC+2, Ramon Smits wrote:
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "nhusers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/nhusers/-/tWDwmifgOLkJ.

David Schmitt

unread,
Sep 11, 2012, 9:32:33 AM9/11/12
to nhu...@googlegroups.com


Use the right tool for each job. Flexible object-based access to a(ny)
SQL database? Use NHibernate! Efficient, secure, incremental backups?
use your database's tools!

Tangential: The sad truth is that in bigger organizations (that is,
where the money comes from), the people coding and the people running
databases are not the same and there is often no incentive for
convergence. Google "devops" for a totally different approach.

Best Regards, David

On 11.09.2012 09:30, EmptyNull wrote:
> Might anyone know of an alternative perhaps then?
> Or is using a custom function for every different database the only
> viable option?
> <https://groups.google.com/d/msg/nhusers/-/tWDwmifgOLkJ>.
> > To post to this group, send email to nhu...@googlegroups.com
> <javascript:>.
> > To unsubscribe from this group, send email to
> > nhusers+u...@googlegroups.com <javascript:>.
> > For more options, visit this group at
> > http://groups.google.com/group/nhusers?hl=en
> <http://groups.google.com/group/nhusers?hl=en>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "nhusers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/nhusers/-/Zo6DVTaOWCUJ.
Reply all
Reply to author
Forward
0 new messages