Apache Cayenne: correctly load classes under OSGI environment

This step is required to correctly use Cayenne framework under OSGi environment.
Simply adjust the class-loading issues that can arise in OSGi.
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
private void initCayenneClasses() { String packageName = "myPackage.with.cayenne.autogenerated.classes"; List<Class<?>> classes = getClassesOfPackage(FrameworkUtil.getBundle(this.getClass()), packageName); for (Class<?> cl : classes) { ClassRegistry.unRegisterClass(cl); } for (Class<?> cl : classes) { ClassRegistry.registerClass(cl); } }

Other Steps and Solutions

If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus