Error generating code from an entity by extending Pojotype

2

In the project a Pojo class was created that receives the type of the serializable variable for indexing and treats the generic conversion:

Pojo.java:
    {...}
    public abstract class Pojo<T extends Serializable> implements Serializable {
      private static final long serialVersionUID = -519803732136444707L;
      public abstract T getId();          
      public abstract void setId(T id);
    }

When creating a class in the package domain and extending it, the declaration line looks like this:

Empresa.java:
    {...}
    public class Empresa extends Pojo<Long> implements Serializable{
    {...}

Then the nimble is run for the crud generation of it, I'm using a custom template, based on JSF2 (primefaces 3) CRUD.   When manipulating the class for code generation, groovy displays the following error:

        java.io.FileNotFoundException: C:[...]\src\main\java\br\com\djsystem\
projeto\domain\Pojo<Long>.java (A sintaxe do nome do arquivo, do nome do diretório ou
do rótulo do volume está incorreta)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:146)
        at japa.parser.JavaParser.parse(JavaParser.java:138)
        at japa.parser.JavaParser.parse(JavaParser.java:159)
        at japa.parser.JavaParser$parse.call(Unknown Source)
        at br.gov.frameworkdemoiselle.tools.nimble.util.ParserUtil.getCompilationUnit(Pars
erUtil.groovy:278)
        at br.gov.frameworkdemoiselle.tools.nimble.util.ParserUtil$getCompilationUnit.call
Static(Unknown Source)
        at br.gov.frameworkdemoiselle.tools.nimble.util.ParserUtil.getAttributesFromClass(
ParserUtil.groovy:96)
        at br.gov.frameworkdemoiselle.tools.nimble.util.ParserUtil$getAttributesFromClass.
callStatic(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteAr
ray.java:53)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSi
te.java:157)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSi
te.java:165)
        at br.gov.frameworkdemoiselle.tools.nimble.util.ParserUtil.getAttributesFromClassF
ile(ParserUtil.groovy:120)
        at br.gov.frameworkdemoiselle.tools.nimble.util.ParserUtil$getAttributesFromClassF
ile.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.ja
va:45)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.jav
a:108)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.jav
a:116)
        at SimpleTemplateScript1.run(SimpleTemplateScript1.groovy:5)
        at groovy.text.SimpleTemplateEngine$SimpleTemplate$1.writeTo(SimpleTemplateEngine.
java:165)
        at groovy.text.SimpleTemplateEngine$SimpleTemplate$1.toString(SimpleTemplateEngine
.java:177)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja
va:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoU
nwrapNoCoerce.invoke(PojoMetaMethodSite.java:230)
        at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite
.java:53)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.ja
va:45)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.jav
a:108)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.jav
a:112)
        at br.gov.frameworkdemoiselle.tools.nimble.template.GroovyTemplate.applyTemplate(G
roovyTemplate.groovy:58)
        at br.gov.frameworkdemoiselle.tools.nimble.template.Template$applyTemplate.call(Un
known Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.ja
va:45)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.jav
a:108)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.jav
a:120)
        at br.gov.frameworkdemoiselle.tools.nimble.util.TemplateUtil.applyTemplate(Templat
eUtil.groovy:58)
        at br.gov.frameworkdemoiselle.tools.nimble.util.TemplateUtil$applyTemplate.call(Un
known Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.ja
va:45)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.jav
a:108)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.jav
a:120)
        at br.gov.frameworkdemoiselle.tools.nimble.DemoiselleNimble.applyFileTemplate(Demo
iselleNimble.groovy:438)
        at br.gov.frameworkdemoiselle.tools.nimble.DemoiselleNimble.this$2$applyFileTempla
te(DemoiselleNimble.groovy)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja
va:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMeta
Class.java:361)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:906)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClas
sSite.java:66)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteA
rray.java:49)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallS
ite.java:133)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallS
ite.java:153)
        at br.gov.frameworkdemoiselle.tools.nimble.DemoiselleNimble$_applyTemplates_closur
e4.doCall(DemoiselleNimble.groovy:252)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja
va:43)(continua...)

The same error occurs when I use in my entity a composite attribute whose class also extends the Pojo, under ManyToMany, ManyToOne, etc.  In this second case the error occurs in the generation of the select / picklist.  I also checked that it only occurs when using groovy commands, since .vm files are generated normally.

Can anyone who has ever had this problem help me find a solution?

Standard class

    @Entity
    @Table(name = "Cliente", uniqueConstraints = {
        @UniqueConstraint(columnNames = {"cnpj"})})
    public class Cliente extends Pojo<Long> implements Serializable {

        private static final long serialVersionUID = 1654193767247607000L;

        @Id
        @Column(name = "id", columnDefinition = "serial")
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private Long id;

        @Column(name = "razao_social", nullable = false, length = 80)
        private String razaoSocial;

        @Column(name = "cnpj", nullable = false, length = 14)
        private Long cnpj;

        @Column(name = "fantasia", nullable = false, length = 60)
        private String fantasia;

        public Cliente() {
            super();
        }

        public Long getId() {
            return id;
        }

        public void setId(Long id) {
            this.id = id;
        }

        public String getRazaoSocial() {
            return razaoSocial;
        }

        public void setRazaoSocial(String razaoSocial) {
            this.razaoSocial = razaoSocial;
        }

        public Long getCnpj() {
            return cnpj;
        }

        public void setCnpj(Long cnpj) {
            this.cnpj = cnpj;
        }

        public String getFantasia() {
            return fantasia;
        }

        public void setFantasia(String fantasia) {
            this.fantasia = fantasia;
        }

    }
    
asked by anonymous 07.04.2015 / 16:44

1 answer

2

I have identified it as a tool bug, because of the generics of the POJO class. If you can register in the bugtrack of the project thank you: link

Demoiselle version 2.5.0 templates should be released soon, and this should be fixed.

    
09.04.2015 / 17:31