Announcement Announcement Module
No announcement yet.
Roo Integration test fail hibernate.MappingException:component property not found: id Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Roo Integration test fail hibernate.MappingException:component property not found: id

    I cannot figure out what is missing with JPA entity generated by Roo, I get the following exception
    Caused by: org.hibernate.MappingException: component property not found: id
    at org.hibernate.mapping.Component.getProperty(Compon
    at org.hibernate.cfg.AnnotationBinder.fillComponent(A
    at org.hibernate.cfg.AnnotationBinder.fillComponent(A

    so the test fails with java.lang.IllegalStateException: Failed to load ApplicationContext

    I have a simple JPA Roo entity as follows

    public class Customer {

    @DateTimeFormat(style = "M-")
    private Calendar enrollmentDate;

    private String identifier;

    private String name;

    private String countryOfResidence;

    private PostalAddress postalAddress;

    @ManyToMany(cascade = CascadeType.ALL)
    private Set<Account> accounts = new HashSet<Account>();

    private transient MailSender primaryEmail;

    public void sendMessage(String mailFrom, String subject, String mailTo, String message) {
    org.springframework.mail.SimpleMailMessage mailMessage = new org.springframework.mail.SimpleMailMessage();

    I generated integration tests for it using roo shell so first I do see correct Customer_Roo_Jpa_Entity.aj generated below
    privileged aspect Customer_Roo_Jpa_Entity {

    declare @type: Customer: @Entity;

    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    private Long;

    @Column(name = "version")
    private Integer Customer.version;

    public Long Customer.getId() {

    public void Customer.setId(Long id) { = id;

    public Integer Customer.getVersion() {
    return this.version;

    public void Customer.setVersion(Integer version) {
    this.version = version;


    I have attached the META-INF folder here that contains my spring config and the persistence xml also attached is the text output from the test run

  • #2
    Use the Roo 'backup' command and attach the whole project. I need and to attempt to reproduce the issue.


    • #3
      Thanks Alex, I found the issue, one of my entity has embedded object and there are multiple attributes of the same type its the Typical Person has to "Address" fields one is the property of "homeAddress" and other "workAddress" so I'm now in the process of using @AttributeOverrides to fix the column names for it

      I do have a question about entity Mapping for you,

      For Account there are 2 types of objects, one is an Account object that needs to be embeddable inside like a Payment objects whereas another type of Account has to be a ManyToMany relationship with Customer, they have exactly same attributes so what is your recommendation for this model? since I cannot have one Account entity that can do both, should I have Parent class Account and then 2 child entity classes CashAccount (embeddable) and CustomerAccount(m to m relationship with Customer)

      I'm using the documentation from this link to fix my error with the tests