Created
September 21, 2012 11:12
-
-
Save rmannibucau/3760928 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Before | |
public void bind() | |
{ | |
try { | |
if (ctxt == null) { | |
try { | |
Properties p = new Properties(); | |
p.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)"); | |
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory"); | |
// ctxt = new InitialContext(p); | |
p.put(OpenEjbContainer.Provider.OPENEJB_ADDITIONNAL_CALLERS_KEY, getClass().getName()); | |
ctxt = EJBContainer.createEJBContainer(p).getContext(); | |
} | |
catch (Exception ignored) { | |
ignored.printStackTrace(); | |
} | |
} | |
if(ctxt!=null) | |
ctxt.bind("inject", this); | |
} catch (NamingException e) { | |
// TODO Auto-generated catch block | |
e.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment