java.lang.IllegalArgumentException: Persist method required

Spring JIRA | Tim Taylor | 7 years ago
  1. 0

    I have an entity derived from a common base class. The id and version are defiend on the base. ROO creates the crud methods on the base aj class, not the subclass. The resulting entity needs to be read only. I performed the following steps in roo. 1. Changed the @RooEntity on the base class (BaseFKItem.java)from @org.springframework.roo.addon.entity.RooEntity to @org.springframework.roo.addon.entity.RooEntity(persistMethod="", removeMethod="", mergeMethod="") 2. Changed the @RooEntity on the subclass (CiLogTypeFKItem.java)in the same way 3. Tried to generate an intergration test for the subclass, I get an error "Persist method required" See stack trace below: ~.entities.cilogs.CiLogTypeFKItem roo> test integration --entity ~.entities.cilogs.CiLogTypeFKItem Created SRC_TEST_JAVA\com\kn\tls\toolkit\entities\cilogs\CiLogTypeFKItemDataOnDemand.java Created SRC_TEST_JAVA\com\kn\tls\toolkit\entities\cilogs\CiLogTypeFKItemIntegrationTest.java Created SRC_TEST_JAVA\com\kn\tls\toolkit\entities\cilogs\CiLogTypeFKItemDataOnDemand_Roo_Configurable.aj Undo create SRC_TEST_JAVA\com\kn\tls\toolkit\entities\cilogs\CiLogTypeFKItemDataOnDemand_Roo_Configurable.aj Undo create SRC_TEST_JAVA\com\kn\tls\toolkit\entities\cilogs\CiLogTypeFKItemIntegrationTest.java Undo create SRC_TEST_JAVA\com\kn\tls\toolkit\entities\cilogs\CiLogTypeFKItemDataOnDemand.java Persist method required java.lang.IllegalArgumentException: Persist method required at org.springframework.roo.support.util.Assert.notNull(Assert.java:112) at org.springframework.roo.addon.dod.DataOnDemandMetadata.<init>(DataOnDemandMetadata.java:83) at org.springframework.roo.addon.dod.DataOnDemandMetadataProvider.getMetadata(DataOnDemandMetadataProvider.java:82) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.get(AbstractItdMetadataProvider.java:238) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.notify(AbstractItdMetadataProvider.java:103) at org.springframework.roo.metadata.internal.DefaultMetadataService.notify(DefaultMetadataService.java:148) at org.springframework.roo.metadata.internal.DefaultMetadataDependencyRegistry.notifyDownstream(DefaultMetadataDependencyRegistry.java:256) at org.springframework.roo.classpath.javaparser.JavaParserMetadataProvider.onFileEvent(JavaParserMetadataProvider.java:131) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.publish(PollingFileMonitorService.java:333) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.scanNotified(PollingFileMonitorService.java:212) at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:138) at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcessManager.java:95) at org.springframework.roo.bootstrap.ProcessManagerHostedExecutionStrategy.execute(ProcessManagerHostedExecutionStrategy.java:31) at org.springframework.roo.shell.internal.AbstractShell.executeCommand(AbstractShell.java:132) at org.springframework.roo.shell.jline.JLineShell.promptLoop(JLineShell.java:158) at org.springframework.roo.bootstrap.Bootstrap.run(Bootstrap.java:114) at org.springframework.roo.bootstrap.Bootstrap.main(Bootstrap.java:53) ~.entities.cilogs.CiLogTypeFKItem roo>

    Spring JIRA | 7 years ago | Tim Taylor
    java.lang.IllegalArgumentException: Persist method required
  2. 0

    I have an entity derived from a common base class. The id and version are defiend on the base. ROO creates the crud methods on the base aj class, not the subclass. The resulting entity needs to be read only. I performed the following steps in roo. 1. Changed the @RooEntity on the base class (BaseFKItem.java)from @org.springframework.roo.addon.entity.RooEntity to @org.springframework.roo.addon.entity.RooEntity(persistMethod="", removeMethod="", mergeMethod="") 2. Changed the @RooEntity on the subclass (CiLogTypeFKItem.java)in the same way 3. Tried to generate an intergration test for the subclass, I get an error "Persist method required" See stack trace below: ~.entities.cilogs.CiLogTypeFKItem roo> test integration --entity ~.entities.cilogs.CiLogTypeFKItem Created SRC_TEST_JAVA\com\kn\tls\toolkit\entities\cilogs\CiLogTypeFKItemDataOnDemand.java Created SRC_TEST_JAVA\com\kn\tls\toolkit\entities\cilogs\CiLogTypeFKItemIntegrationTest.java Created SRC_TEST_JAVA\com\kn\tls\toolkit\entities\cilogs\CiLogTypeFKItemDataOnDemand_Roo_Configurable.aj Undo create SRC_TEST_JAVA\com\kn\tls\toolkit\entities\cilogs\CiLogTypeFKItemDataOnDemand_Roo_Configurable.aj Undo create SRC_TEST_JAVA\com\kn\tls\toolkit\entities\cilogs\CiLogTypeFKItemIntegrationTest.java Undo create SRC_TEST_JAVA\com\kn\tls\toolkit\entities\cilogs\CiLogTypeFKItemDataOnDemand.java Persist method required java.lang.IllegalArgumentException: Persist method required at org.springframework.roo.support.util.Assert.notNull(Assert.java:112) at org.springframework.roo.addon.dod.DataOnDemandMetadata.<init>(DataOnDemandMetadata.java:83) at org.springframework.roo.addon.dod.DataOnDemandMetadataProvider.getMetadata(DataOnDemandMetadataProvider.java:82) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.get(AbstractItdMetadataProvider.java:238) at org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.notify(AbstractItdMetadataProvider.java:103) at org.springframework.roo.metadata.internal.DefaultMetadataService.notify(DefaultMetadataService.java:148) at org.springframework.roo.metadata.internal.DefaultMetadataDependencyRegistry.notifyDownstream(DefaultMetadataDependencyRegistry.java:256) at org.springframework.roo.classpath.javaparser.JavaParserMetadataProvider.onFileEvent(JavaParserMetadataProvider.java:131) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.publish(PollingFileMonitorService.java:333) at org.springframework.roo.file.monitor.polling.PollingFileMonitorService.scanNotified(PollingFileMonitorService.java:212) at org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:138) at org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcessManager.java:95) at org.springframework.roo.bootstrap.ProcessManagerHostedExecutionStrategy.execute(ProcessManagerHostedExecutionStrategy.java:31) at org.springframework.roo.shell.internal.AbstractShell.executeCommand(AbstractShell.java:132) at org.springframework.roo.shell.jline.JLineShell.promptLoop(JLineShell.java:158) at org.springframework.roo.bootstrap.Bootstrap.run(Bootstrap.java:114) at org.springframework.roo.bootstrap.Bootstrap.main(Bootstrap.java:53) ~.entities.cilogs.CiLogTypeFKItem roo>

    Spring JIRA | 7 years ago | Tim Taylor
    java.lang.IllegalArgumentException: Persist method required
  3. 0

    I am moving the @Id setup to the .java to handle integration of pre set up Sequences. Such as: {code:title=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; } {code} This works as expected with roo modifying the entity as such: {code} @@ -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); } {code} Now if I try to create an integration test (roo> test integration --entity ..) I get the following error: {code} 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) {code} 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

    Spring JIRA | 6 years ago | Frank Fahs
    java.lang.IllegalArgumentException: Identifier accessor method required
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    I am moving the @Id setup to the .java to handle integration of pre set up Sequences. Such as: {code:title=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; } {code} This works as expected with roo modifying the entity as such: {code} @@ -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); } {code} Now if I try to create an integration test (roo> test integration --entity ..) I get the following error: {code} 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) {code} 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

    Spring JIRA | 6 years ago | Frank Fahs
    java.lang.IllegalArgumentException: Identifier accessor method required

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      Persist method required

      at org.springframework.roo.support.util.Assert.notNull()
    2. org.springframework.roo
      Assert.notNull
      1. org.springframework.roo.support.util.Assert.notNull(Assert.java:112)
      1 frame
    3. Spring Roo - Annotations (ASLv2 Licensed)
      DataOnDemandMetadataProvider.getMetadata
      1. org.springframework.roo.addon.dod.DataOnDemandMetadata.<init>(DataOnDemandMetadata.java:83)
      2. org.springframework.roo.addon.dod.DataOnDemandMetadataProvider.getMetadata(DataOnDemandMetadataProvider.java:82)
      2 frames
    4. org.springframework.roo
      Bootstrap.main
      1. org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.get(AbstractItdMetadataProvider.java:238)
      2. org.springframework.roo.classpath.itd.AbstractItdMetadataProvider.notify(AbstractItdMetadataProvider.java:103)
      3. org.springframework.roo.metadata.internal.DefaultMetadataService.notify(DefaultMetadataService.java:148)
      4. org.springframework.roo.metadata.internal.DefaultMetadataDependencyRegistry.notifyDownstream(DefaultMetadataDependencyRegistry.java:256)
      5. org.springframework.roo.classpath.javaparser.JavaParserMetadataProvider.onFileEvent(JavaParserMetadataProvider.java:131)
      6. org.springframework.roo.file.monitor.polling.PollingFileMonitorService.publish(PollingFileMonitorService.java:333)
      7. org.springframework.roo.file.monitor.polling.PollingFileMonitorService.scanNotified(PollingFileMonitorService.java:212)
      8. org.springframework.roo.process.manager.internal.DefaultProcessManager.doTransactionally(DefaultProcessManager.java:138)
      9. org.springframework.roo.process.manager.internal.DefaultProcessManager.execute(DefaultProcessManager.java:95)
      10. org.springframework.roo.bootstrap.ProcessManagerHostedExecutionStrategy.execute(ProcessManagerHostedExecutionStrategy.java:31)
      11. org.springframework.roo.shell.internal.AbstractShell.executeCommand(AbstractShell.java:132)
      12. org.springframework.roo.shell.jline.JLineShell.promptLoop(JLineShell.java:158)
      13. org.springframework.roo.bootstrap.Bootstrap.run(Bootstrap.java:114)
      14. org.springframework.roo.bootstrap.Bootstrap.main(Bootstrap.java:53)
      14 frames