Hi everybody, I have some troubles and I need your help.
It turns out that I need to create run-time entities that adapt to user-defined structures, currently I build a runtime class with annotations, I compile the dynamic class and make the instance with the Class.forName method, in addition, I set the hibernate session to add the class using: configuration.addAnnotatedClass ( MyDinamicClass ) and after that I build it the session.
The problem is that although I can use the dynamic instance of my class, I cannot record anything whit it, because I get the error "Unknown entity", It should be mentioned that it does not generate an exception when I do the instance of the dynamic class and when I added to the configuration of the session. I checked the annotations in the dynamic class and apparently I cannot find any of them (using MyClass.getDeclaredAnnotations ()).
It runs on a Java Bean in Jboss 6, the same project runs as expected when it is out of a Java Bean in jboss, I can even read the annotations with which the class was created, also I used ReflectHelper.classForName instead of Class.forName, but the annotations are still missed.
Anyone knows why hibernate cannot recognize the annotations in my class? thanks in advance
|