Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-2276

pushing in @Id triggers exception "Identifier accessor method required"

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 1.1.3.RELEASE
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      MB Pro 10.6.6, Roo 1.1.3 from Git, running roo-dev

      Description

      I am moving the @Id setup to the .java to handle integration of pre set up Sequences. Such as:

      Products.java
          @Id @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="prod_seq")
          @SequenceGenerator(name="prod_seq", sequenceName="PRODUCTS_SEQ")
          @Column(name = "id")
          private Integer id;
      
          public Integer getId() {
              return this.id;
          }
      
          public void setId(Integer id) {
              this.id = id;
          }
      

      This works as expected with roo modifying the entity as such:

      @@ -25,19 +21,6 @@
           @PersistenceContext
           transient EntityManager Products.entityManager;
           
      -    @Id
      -    @GeneratedValue(strategy = GenerationType.AUTO)
      -    @Column(name = "ID")
      -    private BigDecimal Products.id;
      -    
      -    public BigDecimal Products.getId() {
      -        return this.id;
      -    }
      -    
      -    public void Products.setId(BigDecimal id) {
      -        this.id = id;
      -    }
      -    
           @Transactional
           public void Products.persist() {
               if (this.entityManager == null) this.entityManager = entityManager();
      @@ -89,7 +72,7 @@
               return entityManager().createQuery("SELECT o FROM Products o", Products.class).getResultList();
           }
           
      -    public static Products Products.findProducts(BigDecimal id) {
      +    public static Products Products.findProducts(Integer id) {
               if (id == null) return null;
               return entityManager().find(Products.class, id);
           }
      

      Now if I try to create an integration test (roo> test integration --entity ..) I get the following error:

      Identifier accessor method required
      java.lang.IllegalArgumentException: Identifier accessor method required
          at org.springframework.roo.support.util.Assert.notNull(Assert.java:112)
          at org.springframework.roo.addon.dod.DataOnDemandMetadata.<init>(DataOnDemandMetadata.java:75)
          at org.springframework.roo.addon.dod.DataOnDemandMetadataProvider.getMetadata(DataOnDemandMetadataProvider.java:129)
          at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.get(AbstractItdMetadataProvider.java:269)
          at org.springframework.roo.metadata.DefaultMetadataService.getInternal(DefaultMetadataService.java:148)
          at org.springframework.roo.metadata.DefaultMetadataService.get(DefaultMetadataService.java:82)
          at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.notify(AbstractItdMetadataProvider.java:146)
          at org.springframework.roo.metadata.DefaultMetadataService.notify(DefaultMetadataService.java:235)
          at org.springframework.roo.metadata.internal.DefaultMetadataDependencyRegistry.notifyDownstream(DefaultMetadataDependencyRegistry.java:214)
          at org.springframework.roo.classpath.javaparser.JavaParserMetadataProvider.onFileEvent(JavaParserMetadataProvider.java:131)
          at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.publish(PollingFileMonitorService.java:330)
          at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.scanNotified(PollingFileMonitorService.java:213)
          at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:189)
          at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcessManager.java:143)
          at org.springframework.roo.process.manager.ProcessManagerHostedExecutionStrategy.execute(ProcessManagerHostedExecutionStrategy.java:47)
          at org.springframework.roo.shell.AbstractShell.executeCommand(AbstractShell.java:181)
          at org.springframework.roo.shell.jline.JLineShell.promptLoop(JLineShell.java:358)
          at org.springframework.roo.shell.jline.JLineShell.run(JLineShell.java:132)
          at java.lang.Thread.run(Thread.java:680)
      

      I actually noticed this previously in a slightly different situation. I had created my entity with --testautomatically and had already created a controller scaffold for it. After making the @id modification the error pops up every time I launch roo-dev

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              stewarta Alan Stewart
              Reporter:
              ffahs Frank Fahs
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: