For example I have two entities:
@Entity
@Audited
@Table(....
public class Worker
{
private Long id;
private String name ;
}
@Entity
@Audited
@Table(....
public class Department
{
private Long id;
private String departmentName;
private Worker worker;
}
I want to display the following data for Department
:
| departmentName
| name
(from fetched entity worker
) |
When using AuditQuery
to get audit information for entity Department
, is it possible to fetch the entity Worker
to display name
value for more human readable display?
不支持此功能,因此您必须使用本机查询并连接实际的数据库表。
EAGER
loading is not supported by envers, all association can only be lazy loaded. An alternative solution to doing joins by hand, is initializing lazy fields of an entity.
My solution to this problem was to go through all fields using java reflection ( see ), finding proxies by using Hibernate.isInitialized(...) and initializing them with Hibernate.initialize(...) .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.