OK, I just checked in code that should allow this to work. Could you please test and make sure that it's functioning correctly?
Thanks, Derek On 6/16/09, Derek Chen-Becker <dchenbec...@gmail.com> wrote: > > Using multiple EMs was not something I had considered when I wrote this. I > think that I can modify the code to provide a __nameSalt def to > differentiate instances. Let me work on it and I'll have something soon. > > Derek > > On 6/16/09, Jean-Luc <jlcane...@gmail.com> wrote: >> >> For your information, here is an extract of source code of RequestVarEM : >> >> Trait RequestVarEM extends ScalaEntityManager with ScalaEMFactory { >> object emVar extends RequestVar[EntityManager](openEM()) { ... } >> } >> >> EntityManager is stored in the singleton emVar; so, all db access of Model >> objects are made using the singleton emVar. >> => trait RequestVarEM allow only one connection to a database within the >> same HttpRequest context. >> >> >> Jean-Luc >> >> 2009/6/15 Jean-Luc <jlcane...@gmail.com> >> >>> Hello, >>> >>> I have two databases, db1 (a.k.a. Motorbike) and db2 (a.k.a. Motorway) >>> defined with RequestVarEM : >>> - object ModelDb1 extends LocalEMF("db1") with RequestVarEM // Motorbike >>> database >>> - object ModelDb2 extends LocalEMF("db2") with RequestVarEM // Motorway >>> database >>> >>> I thought one could access to any databases independently from any >>> snippet as long as the correct Model object were used (ModelDb1 or ModelDb2 >>> for exemple) ; but when I access both databases from the same page, the >>> second database access issues a "Named query not found" exception. >>> >>> I have two snippets, one to display a list of "motorbike", another to >>> display a list of "motorway" : >>> - page1 : >>> ModelDb1.createNamedQuery[Motorbike]("Motorbike.findAll).getResultList() => >>> ok >>> - page2 >>> : ModelDb2.createNamedQuery[Motorway]("Motorway.findAll).getResultList() => >>> ok >>> - page3 : calling from page 3 motorbike & motorway snippets : Named query >>> not found: Motorway.findAll >>> - page4 : calling from page 4 motorway & motorbike snippets : Named query >>> not found: Motorbike.findAll >>> - page3 & changing the query of *Motorway* snippet : >>> - >>> ModelDb2.createNamedQuery[*Motorbike*]("*Motorbike*.findAll).getResultList() >>> => it's ok and I do NOT have an exception ! >>> >>> I joined a sample application, ... >>> >>> any idea about this issue ? >>> (bad use of LocalEMF in the application code ? issue with LocalEMF or >>> RequestVarEM ?) >>> >>> Jean-Luc >>> >>> PS : >>> I don't know if it's related but I have this in the log : >>> [INFO] Checking for multiple versions of scala >>> [WARNING] Multiple versions of scala libraries detected! >>> >>> >>> -- >>> Jean-Luc Canela >>> jlcane...@gmail.com >>> >> >> >> >> -- >> Jean-Luc Canela >> jlcane...@gmail.com >> >> >> >> > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---