These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: A few random questions...
PostPosted: Fri Sep 25, 2009 11:12 am 
Newbie

Joined: Fri Sep 25, 2009 8:36 am
Posts: 9
Hey,

Im going to be working on a project which uses NHibernate in the next few weeks and ive been having a quick read online about it. I must admit im looking forward to it but im just wondering about a few things, which shouldnt impact the project im going to be working on, but im thinking about maybe porting some old code over from an old personal project to use NHibernate, but if it doesnt support a few things (Which im sure it will even if it is fiddly) then i not be able to do so...

Anyway the questions... first question, and after looking online this scenario may make me look like some crazy guy, but hear me out :)

- Is it possible to have 1 class use more than 1 database


I have an old web based game that was multiplayer and was split into realms, i never finished it but i had 2 or 3 realms up and running. Now looking at it as an application it had a simple abstraction layer to communicate between web page and the database by use of intermediate objects. Each one had a relevent CRUD method assigned which then had some SQL associated, which wasnt that amazing but it did the job (this was over 6 years ago). Anyway each application has 3 databases it points to, one is an account database which all realms shared, then there is a content database which was also shared between all instances and stored information on skills, items, npcs etc. Then finally there was a unique realm database which stored information relating to characters and realm specific things.

Now stay with me im getting to the point... lets take an item class from this game as an example. It had a Fetch(int ID) which looked in the content database and pulled back an items information. However then i had a class that derived from that called CharacterItem which stored a new field (Amount) so when this one called Fetch(int ID) it would first of all go to the realm database and pull back the relevent amount for the current character and the current item ID, it would then do the normal content database lookup to fill in the rest of the data.

The bit which im not sure about, is that from what ive read so far about NHibernate its fine to link a class to a db or table, but in this example i would need to point X fields to 1 db, and X fields to another db, then when updating i would only really want to insert/update the characters amount, as there should never be an instance when a character is adding a new item blueprint to the system, that is done via a different winforms toolkit. Now onto my other question:

- I want to have database abstraction so my users can install onto any DB, however can i optimize for MySQL (i.e using unsigned, as MSSQL doesnt support it)

Basically i was wondering if you knew that you would always be getting unsigned vars back, and you had a mysql database that implemented unsigned ints etc, would this cause a problem if then someone deployed to a MSSQL DB, with EXACTLY the same structure and data, just it wasnt unsigned... This wouldnt be an ideal scenario i know, because if you do run into the unsigned values and you port to MSSQL to keep the value you would need to make it a bigint, therefore changing the data type, so it would technically have a different schema then...

Again sorry for the randomness of the post, just thinking and planning ahead of time before i get stuck in...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.