Hi, I would like to load a set of class that has been dynamically created. The dynamically created classes are loaded by a separate classloader. Need to create sessionfactory with the classes only from the supplied class loader.
I tried LocalSessionFactoryBuilder lsfb = new LocalSessionFactoryBuilder(dataSource, classLoader) but could not succeed. I am getting the following error.
Can any one help.
org.hibernate.AssertionFailure: PersistentClass name cannot be converted into a Class at org.hibernate.cfg.BinderHelper.getPropertyOverriddenByMapperOrMapsId(BinderHelper.java:816) at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1969) at org.hibernate.cfg.AnnotationBinder.processIdPropertiesIfNotAlready(AnnotationBinder.java:767) at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:686) at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3533) at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3487) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1376) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1777) at com.chainsys.fwk.db.HibernateUtils.getHibernateSession(HibernateUtils.java:133) at com.chainsys.core.ClassLoaderTest.fetchData(ClassLoaderTest.java:69) at com.chainsys.core.ClassLoaderTest.loadClass(ClassLoaderTest.java:46) at com.chainsys.core.ClassLoaderTest.main(ClassLoaderTest.java:25) Caused by: java.lang.ClassNotFoundException: com.chainsys.appload.dynaclass.entity.IssueDetails at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:270) at org.hibernate.annotations.common.util.ReflectHelper.classForName(ReflectHelper.java:143) at org.hibernate.annotations.common.reflection.java.JavaReflectionManager.classForName(JavaReflectionManager.java:117) at org.hibernate.cfg.BinderHelper.getPropertyOverriddenByMapperOrMapsId(BinderHelper.java:812) ... 11 more
|