This content has been marked as final.
Show 1 reply
-
1. Re: @factory and Contexts
mnrz Oct 28, 2006 5:46 AM (in response to mrohad)Hi
In my opinion you should create a factory class in which you choose proper instance to select from database depend on given locale.
for example, if you support two locales you should have something like this:
interface Country {}
class CountryEnglish implement Country{}
class CountryFrench implements Country{}
then your factory class:
class CountryFactory {
static Country getInctance(int localeId){
if(localeId == ENGLISH){
return new CountryEnglish();
}
if(localeId == FRENCH){
return new CountryFrench();
}
}
}
and you should put EntityManager in those two class and call them to select from database instead of calling "em" directly.
hope this help.