Java Hibernate Transformer AliasToBeanNestedResultTransformer

Ich habe eine Frage wie diese. Ich gebe den Studentenausweis weiter Ich benötige einige Felder von Student sowie deren Eltern sowie einige Felder von der Eltern-> Adresse, die ich benutzeAliasToBeanNestedResultTransformer Transformator vonSami Andoni

Hier ist die Implementierung davonCODE

Hier ist mein Code.

public List<Student>searchForStudent(Integer studentId)
{           
    Projection p=Projections.projectionList().create()
    .add(Projections.property("name"),"name")//the student name it works O.K
    .add(Projections.property("lastname"),"lastname")//the student name it works O.K
    .add(Projections.property("age"),"age")//the student AGE it works O.K                
    .add(Projections.property("p.phone"),"parent.phone")//the parent phone it works O.K                
    .add(Projections.property("address.state").as("parent.Address.state")); // i need a field from address.state here is the problem...  
    Session session = ......
    Criteria like = session.createCriteria(Student.class).add(prepareForSelect())//some filters..
    .createAlias("parent","p")//the parent of the student. a student have one parent
    .createAlias("parent.Address","address")//the address of the parent.... a parent have one address.
    .setProjection(p)                
    .setResultTransformer(new AliasToBeanNestedResultTransformer(Student.class));    
    List<Student>results=like.list();   
    return results;     
}         

es wirft

Exception in thread "main" org.hibernate.PropertyAccessException:   IllegalArgumentException occurred while calling setter of com.generic.model.Parent.Address

FYI ist eine Typinkongruenz, in der ich etwas nachgezeichnet habeSAMI Code und ich sehe das

[MyState]
[Address]

scheint, dass Hibernate a zurückgibtString State MyState In diesem Fall verwendet der Transformator aAddress Object und das ist dastype Mismatch.

ist jede hilfe die es dringend braucht

Danke vielmals.

Antworten auf die Frage(1)

Ihre Antwort auf die Frage