Java reflection superClass loaded by hibernate problems -


I am trying to print in the console, which, by the name of the name of a superclass, which is required for later computing A simple POJO is working fine but when the class is first loaded by hibernation, I can not find a super class in the area of ​​the child and when I print the name of the parent (when it happens to be in hibernation , So I'm getting the following)

[Handler, _Filter_signature, serialWARUID, methods ]

This is my code

  public static zero main String [] args) {fixing models clause = new fixing models (); Hibernate Handler Handler = New Hibernate Handler (true); Student student = (student) handler.jet session (). Load (student.jagger, 1); Student new student = new student (); System.out.println ("Printing class loaded by Humbernet"); Clazz.showFieldsFromSuperClass (student); // Show Fields of the Child and Parent Incorrect Systems. Out.printline ("------------------------- -------------------- ----- "); System.out.println ("Printing Class Instance by New .."); Clazz.showFieldsFromSuperClass (newStudent); // Parents and children IS O.K. Show private from) Private Zero Showfield Fraums Up Class (Student Claz) {Last Class objectClass = clazz.getClass (); Last square parentClass = objectClass.getSuperclass (); System.out.println ("printing hair"); (Field field: objectClass.getDeclaredFields ()) System.out.println (field.getName ()); // Printing System System.out.println ("Printing Parents");   

for the first time

  clazz.showFieldsFromSuperClass (student); After the printing [handler, _filter_signature, serialvarsionUID,  methods ] is said that the child is like hibernate, now the students of my students' My abstract class is not later in the father code  
  clazz.showFieldsFromSuperClass (new student);   

In this case, the prints of the students' fields and their parents are printed.

My question is how can I find individual square fields Am [parent class] whenever comes in hibernation or new examples of spring container ??

The hibernate load () method is not initialize the fully retrieved object, but as long as you have an object Do not use a property until a proxy is given.

You can get the right class of the object without the use of auxiliary class in a particular hibernation:

Hibernate Proxy Helper.Get Classwithout inlineingprosy (student);

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -