jsf - Is there a way to inject an EJB into a custom Resource Bundle -


i'm trying build resource bundle messages database, rather properties file. did tests extending resourcebundle, resourcebundle.control , listresourcebundle, , guess i'm on right path.

i reach point when need query actual database fetch messages resourcebundle implementation. leverage jpa infrastructure have on ejb layer in order run queries , instantiate objects store keys, messages , locales. perfect if @ejb-inject session bean resourcebundle, cannot find way it.

here resourcebundle code:

@managedbean(eager=true) @applicationscoped public class resourcedicweb extends listresourcebundle {  @ejb private mydao mydao;  @override protected object[][] getcontents() {     list<dicweb> dicweb = updatedictionary();      object[][] content = new object[dicweb.size()][2];      for(int = 0; <= dicweb.size(); i++) {         content[i][0] = dicweb.get(i).getatrkey();         content[i][1] = dicweb.get(i).getatrmessage();     }      return content; }      private list<dicweb> updatedictionary() {         return mydao.fetchdictionary(); // @ point mydao null     }  } 

my next step use old-fashioned jdbc create database connection directly resourcebundle, last option.

cheers!

if injection doesn't work should still able via jndi.

context ctx = new initialcontext(); mydao mydao = (mydao) ctx.lookup("myapp/myejbmodule/mydao!org.myapp.ejb.mydao"); 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -