关注JEECG发展历程 关注最新动态和版本, 记录JEECG成长点滴 更新日志 - 技术支持 - 招聘英才

JEECG最新版本下载 JEECG智能开发平台 - 显著提高开发效率 常见问题 - 入门视频 - 参与开源团队

商务QQ: 69893005、418799587 商务热线(5*8小时): 010-64808099 官方邮箱: jeecgos@163.com

查看: 10952|回复: 7

[代码生成器] 3.7.5新模板bug

[复制链接]
发表于 2018-5-19 03:36:58 | 显示全部楼层 |阅读模式
生成实体类出错
这是生成的实体类。3.7.5一对多生成。老版本正常

  1. #segment#MonyEntity.java
  2. package com.jeecg.dsafd.entity;
  3. import java.math.BigDecimal;
  4. import java.util.Date;
  5. import java.lang.String;
  6. import java.lang.Double;
  7. import java.lang.Integer;
  8. import java.math.BigDecimal;
  9. import javax.xml.soap.Text;
  10. import java.sql.Blob;
  11. import javax.persistence.Column;
  12. import javax.persistence.Entity;
  13. import javax.persistence.GeneratedValue;
  14. import javax.persistence.GenerationType;
  15. import javax.persistence.Id;
  16. import javax.persistence.Table;
  17. import org.hibernate.annotations.GenericGenerator;
  18. import javax.persistence.SequenceGenerator;
  19. import org.jeecgframework.poi.excel.annotation.Excel;

  20. /**   
  21. * @Title: Entity
  22. * @Description: testonetomany
  23. * @author onlineGenerator
  24. * @date 2018-05-19 03:34:43
  25. * @version V1.0   
  26. *
  27. */
  28. @Entity
  29. @Table(name = "mony", schema = "")

  30. Expression subsG['${key}'].cgformConfig is undefined on line 33, column 6 in table/onetomany/java/subEntity.ftl.
  31. The problematic instruction:
  32. ----------
  33. ==> if subsG['${key}'].cgformConfig.cgFormHead.jformPkType?if_exists?html == "SEQUENCE" [on line 33, column 1 in table/onetomany/java/subEntity.ftl]
  34. in include "/table/onetomany/java/subEntity.ftl" [on line 1, column 1 in naturebt\onetomany\java\${bussiPackage}\${entityPackage}\entity\[1-n]Entity.java]
  35. ----------

  36. Java backtrace for programmers:
  37. ----------
  38. freemarker.core.InvalidReferenceException: Expression subsG['${key}'].cgformConfig is undefined on line 33, column 6 in table/onetomany/java/subEntity.ftl.
  39.         at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:125)
  40.         at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:135)
  41.         at freemarker.core.Dot._getAsTemplateModel(Dot.java:78)
  42.         at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
  43.         at freemarker.core.Dot._getAsTemplateModel(Dot.java:74)
  44.         at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
  45.         at freemarker.core.BuiltIn$if_existsBI._getAsTemplateModel(BuiltIn.java:751)
  46.         at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
  47.         at freemarker.core.Expression.getStringValue(Expression.java:93)
  48.         at freemarker.core.StringBuiltins$StringBuiltIn._getAsTemplateModel(StringBuiltins.java:71)
  49.         at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
  50.         at freemarker.core.ComparisonExpression.isTrue(ComparisonExpression.java:111)
  51.         at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:77)
  52.         at freemarker.core.Environment.visit(Environment.java:221)
  53.         at freemarker.core.MixedContent.accept(MixedContent.java:92)
  54.         at freemarker.core.Environment.visit(Environment.java:221)
  55.         at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:179)
  56.         at freemarker.core.Environment.visit(Environment.java:428)
  57.         at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
  58.         at freemarker.core.Environment.visit(Environment.java:221)
  59.         at freemarker.core.Environment.include(Environment.java:1508)
  60.         at freemarker.core.Include.accept(Include.java:169)
  61.         at freemarker.core.Environment.visit(Environment.java:221)
  62.         at freemarker.core.Environment.process(Environment.java:199)
  63.         at freemarker.template.Template.process(Template.java:259)
  64.         at org.jeecgframework.codegenerate.extcommon.FreemarkerHelper.processTemplate(FreemarkerHelper.java:79)
  65.         at org.jeecgframework.codegenerate.extcommon.BaseCodeExtCommonFactory.generateNewFileOrInsertIntoFile(BaseCodeExtCommonFactory.java:161)
  66.         at org.jeecgframework.codegenerate.extcommon.BaseCodeExtCommonFactory.executeGenerate(BaseCodeExtCommonFactory.java:92)
  67.         at org.jeecgframework.codegenerate.extcommon.BaseCodeExtCommonFactory.scanTemplatesAndProcess(BaseCodeExtCommonFactory.java:73)
  68.         at org.jeecgframework.codegenerate.extcommon.BaseCodeExtCommonFactory.generateFileCommon(BaseCodeExtCommonFactory.java:56)
  69.         at org.jeecgframework.codegenerate.extcommon.onetomany.CgformCodeOne2ManyExtCommonFactory.generateFileCommon(CgformCodeOne2ManyExtCommonFactory.java:32)
  70.         at org.jeecgframework.codegenerate.extcommon.onetomany.CgformCodeOne2ManyExtCommonFactory.invokeCommon(CgformCodeOne2ManyExtCommonFactory.java:73)
  71.         at org.jeecgframework.codegenerate.extcommon.onetomany.CgformCodeOne2ManyExtCommonGenerate.generateToFile(CgformCodeOne2ManyExtCommonGenerate.java:242)
  72.         at org.jeecgframework.web.cgform.controller.generate.GenerateController.dogenerateOne2Many(GenerateController.java:353)
  73.         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  74.         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  75.         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  76.         at java.lang.reflect.Method.invoke(Method.java:498)
  77.         at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
  78.         at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
  79.         at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
  80.         at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:747)
  81.         at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:676)
  82.         at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
  83.         at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
  84.         at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
  85.         at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
  86.         at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
  87.         at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
  88.         at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
  89.         at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
  90.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
  91.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  92.         at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
  93.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  94.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  95.         at org.jeecgframework.core.aop.GZipFilter.doFilter(GZipFilter.java:119)
  96.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  97.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  98.         at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:140)
  99.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  100.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  101.         at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
  102.         at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  103.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  104.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  105.         at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:150)
  106.         at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  107.         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
  108.         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
  109.         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
  110.         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
  111.         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475)
  112.         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
  113.         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
  114.         at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:625)
  115.         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
  116.         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
  117.         at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:498)
  118.         at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
  119.         at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:796)
  120.         at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1372)
  121.         at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
  122.         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  123.         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  124.         at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
  125.         at java.lang.Thread.run(Thread.java:748)
复制代码
发表于 2018-5-19 11:27:35 | 显示全部楼层
你怎么配置的,有什么特殊的?

主键是什么规则
 楼主| 发表于 2018-5-19 15:33:13 | 显示全部楼层
admin 发表于 2018-5-19 11:27
你怎么配置的,有什么特殊的?

主键是什么规则

没任何特殊。我测试都是默认规则。字段任意简单名称
发表于 2018-5-19 15:56:38 | 显示全部楼层
用的是那套模板,你的3.7.5下载时间?
 楼主| 发表于 2018-5-19 18:00:45 | 显示全部楼层
admin 发表于 2018-5-19 15:56
用的是那套模板,你的3.7.5下载时间?

用的是新版。即昨日修复无法生成文件bug后的代码。github上的版本
 楼主| 发表于 2018-5-20 16:40:13 | 显示全部楼层
admin 发表于 2018-5-19 15:56
用的是那套模板,你的3.7.5下载时间?

使用beta版本依旧有此问题
发表于 2018-5-21 19:33:15 | 显示全部楼层
本帖最后由 jeecg_ty 于 2018-5-21 19:38 编辑

一般情况不会出现这个bug,如果有这个bug,请去src/main/resources/jeecg/ext-common-template/table/onetomany/java/subEntity.ftl这个文件下把subsG['${key}'].cgformConfig全部替换成subsG['${key}']  经jeecg6群的热心网友【懒洋洋】测试过,非常管用。
 楼主| 发表于 2018-5-26 13:30:35 | 显示全部楼层
jeecg_ty 发表于 2018-5-21 19:33
一般情况不会出现这个bug,如果有这个bug,请去src/main/resources/jeecg/ext-common-template/table/oneto ...

他也是闲的蛋疼  我从来不这么搞  
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表