Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unsupport many-to-one/many-to-many? #6

Open
roymax opened this issue Oct 8, 2010 · 3 comments
Open

unsupport many-to-one/many-to-many? #6

roymax opened this issue Oct 8, 2010 · 3 comments

Comments

@roymax
Copy link

roymax commented Oct 8, 2010

when my db include fk , can't import gen java class.

14:30:01,760 INFO ~ Starting POJO Exporter ...
14:30:02,025 ERROR ~

Method public java.lang.String org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.getJavaTypeName(org.hibernate.mapping.Property,boolean) threw an exception when invoked on org.hibernate.tool.hbm2x.pojo.EntityPOJOClass(models.ProxyCompanies)

The problematic instruction:

==> ${pojo.getJavaTypeName(property, jdk5)} [on line 11, column 45 in pojo/PojoFields.ftl]

in include "PojoFields.ftl" [on line 9, column 1 in pojo/Pojo.ftl]

Java backtrace for programmers:

freemarker.template.TemplateModelException: Method public java.lang.String org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.getJavaTypeName(org.hibernate.mapping.Property,boolean) threw an exception when invoked on org.hibernate.tool.hbm2x.pojo.EntityPOJOClass(models.ProxyCompanies)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:136)
at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:160)
at freemarker.core.Environment.visit(Environment.java:351)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:95)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.include(Environment.java:1375)
at freemarker.core.Include.accept(Include.java:155)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.IfBlock.accept(IfBlock.java:82)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.visit(Environment.java:233)
at freemarker.core.BlockAssignment.accept(BlockAssignment.java:83)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.process(Environment.java:176)
at freemarker.template.Template.process(Template.java:232)
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:245)
at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplateProducer.java:67)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:28)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:97)
at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:84)
at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.java:73)
at org.hibernate.tool.hbm2x.GenericExporter.exportClasses(GenericExporter.java:56)
at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:41)
at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
at play.modules.db.Importer.main(Importer.java:177)
Caused by: org.hibernate.tool.hbm2x.ExporterException: Could not resolve type without exception for org.hibernate.mapping.Property(memberProfileses) Value: org.hibernate.mapping.Set(models.ProxyCompanies.memberProfileses)
at org.hibernate.tool.hbm2x.Cfg2JavaTool.getRawTypeName(Cfg2JavaTool.java:279)
at org.hibernate.tool.hbm2x.Cfg2JavaTool.getJavaTypeName(Cfg2JavaTool.java:180)
at org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.getJavaTypeName(BasicPOJOClass.java:815)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:616)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113)
... 41 more
Caused by: java.lang.NullPointerException
at org.hibernate.tool.hbm2x.visitor.JavaTypeFromValueVisitor.accept(JavaTypeFromValueVisitor.java:43)
at org.hibernate.mapping.OneToMany.accept(OneToMany.java:138)
at org.hibernate.tool.hbm2x.Cfg2JavaTool.getJavaTypeName(Cfg2JavaTool.java:301)
at org.hibernate.tool.hbm2x.Cfg2JavaTool.getGenericCollectionDeclaration(Cfg2JavaTool.java:286)
at org.hibernate.tool.hbm2x.Cfg2JavaTool.getRawTypeName(Cfg2JavaTool.java:263)
... 49 more
Exception in thread "main" org.hibernate.tool.hbm2x.ExporterException: Error while processing template pojo/Pojo.ftl
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:251)
at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplateProducer.java:67)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:28)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:97)
at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:84)
at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.java:73)
at org.hibernate.tool.hbm2x.GenericExporter.exportClasses(GenericExporter.java:56)
at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:41)
at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
at play.modules.db.Importer.main(Importer.java:177)
Caused by: freemarker.template.TemplateModelException: Method public java.lang.String org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.getJavaTypeName(org.hibernate.mapping.Property,boolean) threw an exception when invoked on org.hibernate.tool.hbm2x.pojo.EntityPOJOClass(models.ProxyCompanies)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:136)
at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:160)
at freemarker.core.Environment.visit(Environment.java:351)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:95)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.include(Environment.java:1375)
at freemarker.core.Include.accept(Include.java:155)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.IfBlock.accept(IfBlock.java:82)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.visit(Environment.java:233)
at freemarker.core.BlockAssignment.accept(BlockAssignment.java:83)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.process(Environment.java:176)
at freemarker.template.Template.process(Template.java:232)
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:245)
... 9 more
Caused by: org.hibernate.tool.hbm2x.ExporterException: Could not resolve type without exception for org.hibernate.mapping.Property(memberProfileses) Value: org.hibernate.mapping.Set(models.ProxyCompanies.memberProfileses)
at org.hibernate.tool.hbm2x.Cfg2JavaTool.getRawTypeName(Cfg2JavaTool.java:279)
at org.hibernate.tool.hbm2x.Cfg2JavaTool.getJavaTypeName(Cfg2JavaTool.java:180)
at org.hibernate.tool.hbm2x.pojo.BasicPOJOClass.getJavaTypeName(BasicPOJOClass.java:815)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:616)
at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113)
... 41 more
Caused by: java.lang.NullPointerException
at org.hibernate.tool.hbm2x.visitor.JavaTypeFromValueVisitor.accept(JavaTypeFromValueVisitor.java:43)
at org.hibernate.mapping.OneToMany.accept(OneToMany.java:138)
at org.hibernate.tool.hbm2x.Cfg2JavaTool.getJavaTypeName(Cfg2JavaTool.java:301)
at org.hibernate.tool.hbm2x.Cfg2JavaTool.getGenericCollectionDeclaration(Cfg2JavaTool.java:286)
at org.hibernate.tool.hbm2x.Cfg2JavaTool.getRawTypeName(Cfg2JavaTool.java:263)
... 49 more

@abp
Copy link

abp commented Oct 8, 2010

I get the exact same error with a 4 tables database and two relations.

@pepite
Copy link
Owner

pepite commented Oct 25, 2010

Sorry to be late in answering. I will have a look asap. I think if there is no foreign key it is currently not working

@Cwellan
Copy link

Cwellan commented Apr 25, 2012

Hi,

I have the problem with play 1.2.4 and db 1.1.1. I already tried all the versions of play with all the versions of db...

Anyone has a solution ?

Thanks in advance.

Best regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants