我正在尝试这样做。
public class MyEntityListener {
@PrePersist
private void onPrePersist(final Object object) {
// set object with value fetched via onPostConstruct
}
@PostConstruct
private void onPostConstruct() {
// fetch some value using entityManager
}
@PersistenceContext
private EntityManager entityManager;
}
onPrePersist
如何,都会执行postConstruct
(之前或之前)。这是正常的吗?