Is this allowed in quarkus?
@Entity
public class User extends PanacheEntity {
// is @Transactional annotation allowed within an Entity
@Transactional
public static final updateName(String name){
...
}
}
Does quarkus allow the annotation @Transactional to be set within a static method (which is normally not bound to a context (CDI-Bean))..depending on PanacheEntity.
No, that is not allowed.
You will get javax.persistence.TransactionRequiredException: Transaction is not active, consider adding @Transactional to your method to automatically activate one.
You have to add the annotation @Transactional to the wrapping method of your resource.
The built-in method persist() does not have the annotation set, so even the quarkus default method wont work without a wrapped @Transactional.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With