reflection « Field « JPA Q&A

1. How can hibernate access a private field?

How can hibernate can access a private field/method of a java class , for example to set the @Id ? Thanks

2. string decoupling and field names

I have a number of domain/business objects, which when used in a hibernate criteria are referenced by the field name as a string, for example :

Criteria crit = session.createCriteria(User.class);
Order myOrdering = ...

3. Incorrect reflection with AccessType("field") in a

Newbie Joined: Tue Nov 02, 2004 2:37 am Posts: 3 I have an entity using access type property. Within that entity, I have a List which I want to access with field access, but expose via a public getter returning an array instead of a list. I have added an @AccessType("field") annotation to the getter method. Hibernate annotations appear to be ...

4. could not set a field value by reflection

public class Endereco implements Serializable { ... @Column(name = "ESTADO") @Type(type="character") private String estado; @Column(name = "CEP") @Type(type="character") ...