We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
For an application generated with the hibernate-jpa feature, starting 3.7.0 we are generating bean bean definitions for classes annotated with javax.persistence.Entity.
hibernate-jpa
javax.persistence.Entity
for this entity
package com.example; import io.micronaut.core.annotation.Creator; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.validation.constraints.NotBlank; @Entity @Table(name = "account") public class Account { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Column(name = "username", nullable = false) @NotBlank private String username; @Column(name = "password", nullable = false) @NotBlank private String password; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
The following test will pass for 3.7.0
package com.example; import io.micronaut.context.BeanContext; import io.micronaut.test.extensions.junit5.annotation.MicronautTest; import jakarta.inject.Inject; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; @MicronautTest(startApplication = false) class AccountTest { @Inject BeanContext beanContext; @Test void beanDefinitions() { assertFalse(beanContext.getBeanDefinitions(Account.class).isEmpty()); } }
It will fail for 3.6.3.
Is this expected behaviour?
The text was updated successfully, but these errors were encountered:
Looks like my changes making an entity a bean because of the validation annotations
Sorry, something went wrong.
Fix: @entity should not become a bean (#8098)
96ba9f2
Close #8096
dstepanov
No branches or pull requests
For an application generated with the
hibernate-jpa
feature, starting 3.7.0 we are generating bean bean definitions for classes annotated withjavax.persistence.Entity
.for this entity
The following test will pass for 3.7.0
It will fail for 3.6.3.
Is this expected behaviour?
The text was updated successfully, but these errors were encountered: