简体   繁体   English

对于注释类型Transactional,未定义属性readOnly

[英]The attribute readOnly is undefined for the annotation type Transactional

I am getting this error when I am putting this piece of code on a service method 当我将这段代码放在服务方法上时,我收到此错误

 @Transactional(readOnly =true)

I am writing this code to make a transaction read only. 我正在编写此代码以使事务只读。 Can you please tell me What I did wrong in this case 你能告诉我在这种情况下我做错了什么

确保从org.springframework.transaction.annotation.Transactional导入@Transactional而不是从javax.transaction.Transactional导入,因为readOnly属性特定于Spring事务。

Add

import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 注释类型Query的属性nativeQuery未定义 - The attribute nativeQuery is undefined for the annotation type Query 注释类型 SerializedName 的属性“alternate”未定义 - The attribute “alternate” is undefined for the annotation type SerializedName JAXB:注释类型XmlElement的属性名称未定义 - JAXB: The attribute name is undefined for the annotation type XmlElement 注释类型测试的预期属性未定义 - the attribute expected is undefined for the annotation type test 具有注释@Transactional(readOnly = false)的所有服务方法周围的切入点或切面 - Pointcut or Aspect Around All Service Methods with Annotation @Transactional(readOnly = false) 带有 readOnly 的 Spring Transactional 注释不适用(+Hibernate) - Spring Transactional annotation with readOnly don't apply (+Hibernate) @Transactional 属性 timout 不适用于属性 readOnly=true - @Transactional attribute timout doesn't work with attribute readOnly=true 为“MediaType.APPLICATION_JSON”生成的注释类型的属性值未定义 - The attribute value is undefined for the annotation type Produces for “MediaType.APPLICATION_JSON” Gremlin ReadOnly事务支持 - Gremlin ReadOnly Transactional support @Transactional 不适用于 readOnly = true - @Transactional not working with readOnly = true
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM