eclipselink - @Prepersist/@PreUpdate 与 Eclipselink 中的 @Embaddable 未触发
问题描述
从 EclipseLink 文档中它说: Annotation Type PrePersist 和 PreUpdate 为相应的生命周期事件指定回调方法。此注解可以应用于实体类、映射超类或回调侦听器类的方法。
这是否意味着@PrePersist 和@PreUpdate 注释应用于使用@Embeddable 注释注释的类的方法不会被触发?这是我的配置,其中不执行事件 PrePersist 和 PreUpdate。
MyType.clss :
@Entity
@Table(name = "MY_TYPES")
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name ="DTYPE",
discriminatorType = DiscriminatorType.INTEGER,
columnDefinition = "SMALLINT")
@DiscriminatorValue("0")
public class MyType implements Serializable {
...
...
}
MySpecialType.class :
@Entity
@Table(name = "MY_SPECIAL_TYPES")
@DiscriminatorValue("3")
public class MySpecialType extends MyType implements Serializable {
....
@Valid
@Embedded
MyEmbeddable myEmbeddable = new MyEmbeddable();
....
}
MyEmbeddable.class :
@Embeddable
public class MyEmbeddable {
...
@PreUpdate
@PrePersist
public void doSomething() {
...
}
...
}
任何帮助将不胜感激。先感谢您。
解决方案
推荐阅读
- assembly - 为什么在 64 模式下默认操作数大小为 32 位?
- angular - 单击按钮时清除同一组件中的数据
- google-sheets - 如何在电子表格中用特定字符查找和替换文本中的单词
- django - 如何修复 QuerySet' 对象没有属性问题?
- postgresql - Postgres函数返回一个int数组
- grafana - 在 promtail loki 日志文件链中配置时间戳格式
- c# - 不同 WCF 服务的 C# 公共库相同位置
- python - Tweepy:调整 JSON 输出
- datatable - UI5 - 使用 url 参数显示文本
- node.js - 关闭终端后 Nvm 和 Node 一直丢失