草庐IT

PostUpdate

全部标签

php - postUpdate 和 postPersist 在学说上的区别

Doctrine的事件监听类中的postUpdate和postPersist事件有什么区别?以我的理解,更新和插入都必须坚持下去。那么当可以在postPersist事件中处理它时,拥有postUpdate有什么好处? 最佳答案 因为您应该只在更新时处理一些逻辑。从学说的文档中:postPersist-ThepostPersisteventoccursforanentityaftertheentityhasbeenmadepersistent.Itwillbeinvokedafterthedatabaseinsertoperation

php - Doctrine postSave、postUpdate 和国际化(检测修改)

我在使用我正在开发的Symfony1.4项目中使用i18n行为的表时遇到了一些小问题。例如,在YAML上定义的以下模型(我有其他遵循相同模式的模型):Subject:actAs:Timestampable:~I18n:fields:[name]columns:name:{type:string(255),notnull:true}relations:Publications:class:PublicationrefClass:PublicationSubjectlocal:subject_idforeign:publication_id我只有国际化的名称字段,但在保存时(在更改表单上的

java - JPA/@PostPersist @PostUpdate - 交易

我目前正在使用@PostPersist和@PostUpdate,在这些触发器中我正在持久化其他实体。问题是,这些触发器是否在同一事务中,如果不是,是否可以强制执行?对我来说,它是这样工作的。当我查看日志时,事务不存在(它是在触发器启动之前提交的)这阻止了我(在注入(inject)bean的持久方法上没有REQUIRES_NEW)将其他实体保存在数据库。REQUIRED属性被完全忽略,MANDATORY属性不抛出异常。这可能是JUnit的问题(因为我处于开发阶段并且没有在完整环境中测试行为。)?如果无法在此触发器上扩展事务,如何确保回滚发生在@PostPersist和@PostUpdat