New Posts New Posts RSS Feed: Many Models per Manager
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Forum LockedMany Models per Manager

 Post Reply Post Reply
Author
Vonzkie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 01-Aug-2011
Location: PH
Posts: 133
Post Options Post Options   Quote Vonzkie Quote  Post ReplyReply Direct Link To This Post Topic: Many Models per Manager
    Posted: 25-Apr-2012 at 1:34am
Hi,

I've seen this topic and I find it cool:
http://drc.ideablade.com/xwiki/bin/view/Documentation/many-models-per-manager

Example, I have two Models:

Model A
Customer

Model B
Employee

Then using the approach given on the post, I'll use EntityManager to query:

so.. 

EntityManager context = new EntityManager();
var query1 = context.GetQuery<Customer>().Execute();
var query2 = context.GetQuery<Employee>().Execute();

the question would be, how about if Model A connects to DB A and Model B connects to DB B, how do we handle that?

Thanks,
Von
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 25-Apr-2012 at 3:28pm
Von,
 
There's no special handling if you want one EntityManager with multiple models from different datasources.
 
You simply create your models pointing to their respective datasources and in the model properties assign the mutual EntityManager name:
 
 
The only restriction is that you would not be able to have entities from different models, but with the same names. (i.e. Employee and Employee)
 
I'm attaching a simple solution showing one EM with multiple models from different datasources: uploads/892/T11806.zip
 
Regards,
   Silvio.


Edited by sbelini - 25-Apr-2012 at 3:30pm
Back to Top
Vonzkie View Drop Down
Senior Member
Senior Member
Avatar

Joined: 01-Aug-2011
Location: PH
Posts: 133
Post Options Post Options   Quote Vonzkie Quote  Post ReplyReply Direct Link To This Post Posted: 01-May-2012 at 10:56pm
Hi Silvio,

How about the IDataSourceKeyResolver, is it still possible here in different models?

Thanks,
Von
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down