facebook

Hibernate POJO Generation Problem

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #285785 Reply

    Adam Crane
    Participant

    I am having a problem generating a Hibernate POJO from a .hbm.xml file. Initially I generated the hbm file from an Oracle database. I then had to modify the hbm file to add some custom tags. Then, when I right click the file and select MyEclipse -> Generate POJOs I get the exception pasted below. This doesn’t happen on all the hbm files, only a few. I have attached working and none working hbm files below.

    The only explanation I could come up with is that somehow the class it has a problem with wasn’t registered in the hibernate.cfg.xml file, but all related classes are defined there.

    Installation Summary:

    *** Date:
    Wednesday, June 11, 2008 10:33:33 AM EDT

    ** System properties:
    OS=Linux
    OS version=2.6.24-19-generic
    Java version=1.6.0_06

    *** MyEclipse details:
    MyEclipse Enterprise Workbench
    Version: 6.0.1 GA
    Build id: 6.0.1-GA-200710

    *** Eclipse details:
    Eclipse SDK

    Version: 3.3.2
    Build id: M20080221-1800

    Eclipse Platform

    Version: 3.3.3.r33x_r20080129-_19UEl7Ezk_gXF1kouft
    Build id: M20080221-1800

    Eclipse RCP

    Version: 3.3.3.r33x_r20080129-8y8eE9UEUWI6qujeED0xT7bc
    Build id: M20080221-1800

    Eclipse Java Development Tools

    Version: 3.3.2.r33x_r20080129-7o7jE7_EDhYDiyVEnjb1pFd7ZGD7
    Build id: M20080221-1800

    Eclipse Project SDK

    Version: 3.3.3.r33x_r20080129-7M7J7LB-u3aphGW6o3_VmiVfGXWO
    Build id: M20080221-1800

    Eclipse Plug-in Development Environment

    Version: 3.3.3.r33x_r20080129-7N7M5DQVIA_6oJsEFkEL
    Build id: M20080221-1800

    Eclipse Graphical Editing Framework

    Version: 3.3.1.v20070814
    Build id: 20070814-1555

    Eclipse startup command=-os
    linux
    -ws
    gtk
    -arch
    x86
    -showsplash
    /opt/eclipse-3.3.2//plugins/org.eclipse.platform_3.3.3.r33x_r20080129/splash.bmp
    -launcher
    /opt/eclipse-3.3.2/eclipse
    -name
    Eclipse
    –launcher.library
    /opt/eclipse-3.3.2/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.0.3.R33x_v20080118/eclipse_1023.so
    -startup
    /opt/eclipse-3.3.2/plugins/org.eclipse.equinox.launcher_1.0.1.R33x_v20080118.jar
    -vm
    /usr/lib/jvm/java-6-sun-1.6.0.06/jre/bin/../lib/i386/client/libjvm.so

    Exception stack trace from .metadata/.log:

    !SESSION 2008-06-11 10:12:55.562 ———————————————–
    eclipse.buildId=M20080221-1800
    java.version=1.6.0_06
    java.vendor=Sun Microsystems Inc.
    BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
    Command-line arguments: -os linux -ws gtk -arch x86

    !ENTRY org.eclipse.wst.internet.cache 1 0 2008-06-11 10:13:06.490
    !MESSAGE wtp.autotest.noninteractive is set. Licenses dialogs will not be displayed.

    !ENTRY org.eclipse.jdt.ui 4 10001 2008-06-11 10:14:47.490
    !MESSAGE Internal Error
    !STACK 0
    java.lang.reflect.InvocationTargetException
    at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:381)
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:313)
    at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:934)
    at com.genuitec.eclipse.core.portability.NewElementWizard.performFinish(NewElementWizard.java:112)
    at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:742)
    at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:373)
    at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:618)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1101)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3319)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
    at org.eclipse.jface.window.Window.open(Window.java:796)
    at com.genuitec.eclipse.hibernate.action.GeneratePOJOActionDelegate.run(GeneratePOJOActionDelegate.java:28)
    at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:256)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:546)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490)
    at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1101)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3319)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
    at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
    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 org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
    Caused by: org.hibernate.tool.hbm2x.ExporterException: MethodInvocationException while processing template Pojo. Invocation of method ‘get’ in class com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper$Templates threw exception class org.hibernate.tool.hbm2x.ExporterException : MethodInvocationException while processing template pojo/PojoFields.vm. Invocation of method ‘getJavaTypeName’ in class com.genuitec.eclipse.hibernate.wizards.MEEntityPOJOClass threw exception class org.hibernate.tool.hbm2x.ExporterException : Could not resolve type without exception for org.hibernate.mapping.Property(touchs) Value: org.hibernate.mapping.Set(com.beamland.miniusa.db.general.Campaign.touchs)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper.processTemplate(VTemplateHelper.java:153)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VelocityProducer.firstPass(VelocityProducer.java:82)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VelocityProducer.produce(VelocityProducer.java:31)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VelocityProducer.produce(VelocityProducer.java:120)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VGenericExporter.exportPOJO(VGenericExporter.java:84)
    at com.genuitec.eclipse.hibernate.wizards.MEPOJOExporter.exportPOJO(MEPOJOExporter.java:104)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VGenericExporter.exportPersistentClass(VGenericExporter.java:73)
    at com.genuitec.eclipse.hibernate.wizards.MEPOJOExporter.exportClasses(MEPOJOExporter.java:156)
    at com.genuitec.eclipse.hibernate.wizards.MEPOJOExporter.doStart(MEPOJOExporter.java:130)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VAbstractExporter.start(VAbstractExporter.java:97)
    at com.genuitec.eclipse.hibernate.wizards.GeneratePOJOWizard$1.execute(GeneratePOJOWizard.java:137)
    at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:101)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1797)
    at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:113)
    at com.genuitec.eclipse.hibernate.wizards.GeneratePOJOWizard$2.execute(GeneratePOJOWizard.java:151)
    at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:56)
    at com.genuitec.eclipse.hibernate.wizards.GeneratePOJOWizard.finishPage(GeneratePOJOWizard.java:148)
    at com.genuitec.eclipse.core.portability.NewElementWizard$2.run(NewElementWizard.java:105)
    at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
    at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:720)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1797)
    at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4466)
    at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87)
    at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:369)
    … 42 more
    Caused by: org.hibernate.tool.hbm2x.ExporterException: MethodInvocationException while processing template pojo/PojoFields.vm. Invocation of method ‘getJavaTypeName’ in class com.genuitec.eclipse.hibernate.wizards.MEEntityPOJOClass threw exception class org.hibernate.tool.hbm2x.ExporterException : Could not resolve type without exception for org.hibernate.mapping.Property(touchs) Value: org.hibernate.mapping.Set(com.beamland.miniusa.db.general.Campaign.touchs)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper.processTemplate(VTemplateHelper.java:153)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper$Templates.get(VTemplateHelper.java:111)
    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 org.apache.velocity.runtime.parser.node.GetExecutor.execute(GetExecutor.java:65)
    at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:302)
    at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:157)
    at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
    at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:220)
    at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
    at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:70)
    at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
    at org.apache.velocity.Template.merge(Template.java:256)
    at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:450)
    at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:419)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper.processTemplate(VTemplateHelper.java:141)
    … 65 more
    Caused by: org.hibernate.tool.hbm2x.ExporterException: Could not resolve type without exception for org.hibernate.mapping.Property(touchs) Value: org.hibernate.mapping.Set(com.beamland.miniusa.db.general.Campaign.touchs)
    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 org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:267)
    at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:197)
    at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
    at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:220)
    at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
    at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
    at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:89)
    at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
    at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:70)
    at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
    at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:166)
    at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:114)
    at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
    at org.apache.velocity.Template.merge(Template.java:256)
    at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:450)
    at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:419)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper.processTemplate(VTemplateHelper.java:141)
    … 82 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:115)
    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)
    … 105 more
    Root exception:
    org.hibernate.tool.hbm2x.ExporterException: MethodInvocationException while processing template Pojo. Invocation of method ‘get’ in class com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper$Templates threw exception class org.hibernate.tool.hbm2x.ExporterException : MethodInvocationException while processing template pojo/PojoFields.vm. Invocation of method ‘getJavaTypeName’ in class com.genuitec.eclipse.hibernate.wizards.MEEntityPOJOClass threw exception class org.hibernate.tool.hbm2x.ExporterException : Could not resolve type without exception for org.hibernate.mapping.Property(touchs) Value: org.hibernate.mapping.Set(com.beamland.miniusa.db.general.Campaign.touchs)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper.processTemplate(VTemplateHelper.java:153)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VelocityProducer.firstPass(VelocityProducer.java:82)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VelocityProducer.produce(VelocityProducer.java:31)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VelocityProducer.produce(VelocityProducer.java:120)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VGenericExporter.exportPOJO(VGenericExporter.java:84)
    at com.genuitec.eclipse.hibernate.wizards.MEPOJOExporter.exportPOJO(MEPOJOExporter.java:104)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VGenericExporter.exportPersistentClass(VGenericExporter.java:73)
    at com.genuitec.eclipse.hibernate.wizards.MEPOJOExporter.exportClasses(MEPOJOExporter.java:156)
    at com.genuitec.eclipse.hibernate.wizards.MEPOJOExporter.doStart(MEPOJOExporter.java:130)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VAbstractExporter.start(VAbstractExporter.java:97)
    at com.genuitec.eclipse.hibernate.wizards.GeneratePOJOWizard$1.execute(GeneratePOJOWizard.java:137)
    at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:101)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1797)
    at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:113)
    at com.genuitec.eclipse.hibernate.wizards.GeneratePOJOWizard$2.execute(GeneratePOJOWizard.java:151)
    at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:56)
    at com.genuitec.eclipse.hibernate.wizards.GeneratePOJOWizard.finishPage(GeneratePOJOWizard.java:148)
    at com.genuitec.eclipse.core.portability.NewElementWizard$2.run(NewElementWizard.java:105)
    at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
    at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:720)
    at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1797)
    at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4466)
    at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87)
    at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:369)
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:313)
    at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:934)
    at com.genuitec.eclipse.core.portability.NewElementWizard.performFinish(NewElementWizard.java:112)
    at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:742)
    at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:373)
    at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:618)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1101)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3319)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
    at org.eclipse.jface.window.Window.open(Window.java:796)
    at com.genuitec.eclipse.hibernate.action.GeneratePOJOActionDelegate.run(GeneratePOJOActionDelegate.java:28)
    at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:256)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:546)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490)
    at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1101)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3319)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
    at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
    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 org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
    Caused by: org.hibernate.tool.hbm2x.ExporterException: MethodInvocationException while processing template pojo/PojoFields.vm. Invocation of method ‘getJavaTypeName’ in class com.genuitec.eclipse.hibernate.wizards.MEEntityPOJOClass threw exception class org.hibernate.tool.hbm2x.ExporterException : Could not resolve type without exception for org.hibernate.mapping.Property(touchs) Value: org.hibernate.mapping.Set(com.beamland.miniusa.db.general.Campaign.touchs)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper.processTemplate(VTemplateHelper.java:153)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper$Templates.get(VTemplateHelper.java:111)
    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 org.apache.velocity.runtime.parser.node.GetExecutor.execute(GetExecutor.java:65)
    at org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke(UberspectImpl.java:302)
    at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:157)
    at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
    at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:220)
    at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
    at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:70)
    at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
    at org.apache.velocity.Template.merge(Template.java:256)
    at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:450)
    at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:419)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper.processTemplate(VTemplateHelper.java:141)
    … 65 more
    Caused by: org.hibernate.tool.hbm2x.ExporterException: Could not resolve type without exception for org.hibernate.mapping.Property(touchs) Value: org.hibernate.mapping.Set(com.beamland.miniusa.db.general.Campaign.touchs)
    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 org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:267)
    at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:197)
    at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:175)
    at org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference.java:220)
    at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
    at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
    at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:89)
    at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
    at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:70)
    at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:55)
    at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:166)
    at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:114)
    at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:230)
    at org.apache.velocity.Template.merge(Template.java:256)
    at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:450)
    at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:419)
    at com.genuitec.eclipse.hibernate.tool.hbm2x.VTemplateHelper.processTemplate(VTemplateHelper.java:141)
    … 82 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:115)
    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)
    … 105 more

    Working HBM file:

    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <!-- 
        Mapping file autogenerated by MyEclipse Persistence Tools
    -->
    <hibernate-mapping>
        <class name="com.beamland.miniusa.db.general.ListCategory" table="LIST_CATEGORY">
            <id name="listCategoryId" type="java.lang.Long">
                <column name="LIST_CATEGORY_ID" precision="10" scale="0" />
                <generator class="sequence">
                    <param name="sequence">LIST_CATEGORY_SEQ</param>
                </generator>
            </id>
            <property name="name" type="java.lang.String">
                <column name="NAME" length="100" />
            </property>
            <property name="label" type="java.lang.String">
                <column name="LABEL" length="100" />
            </property>
            <property name="createdDate" type="org.joda.time.contrib.hibernate.PersistentDateTime" update="false" insert="false">
                <column name="CREATED_DATE" length="7" />
            </property>
            <property name="modifiedDate" type="org.joda.time.contrib.hibernate.PersistentDateTime" update="false" insert="false">
                <column name="MODIFIED_DATE" length="7" />
            </property>
            <set name="listItems" inverse="true">
                <key>
                    <column name="LIST_CATEGORY_ID" precision="10" scale="0" />
                </key>
                <one-to-many class="com.beamland.miniusa.db.general.ListItem" />
            </set>
        </class>
    </hibernate-mapping>
    

    Broken HBM file:

    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <!-- 
        Mapping file autogenerated by MyEclipse Persistence Tools
    -->
    <hibernate-mapping>
        <class name="com.beamland.miniusa.db.general.Campaign" table="CAMPAIGN">
            <id name="campaignId" type="java.lang.Long">
                <column name="CAMPAIGN_ID" precision="10" scale="0" />
                <generator class="sequence">
                    <param name="sequence">CAMPAIGN_SEQ</param>
                </generator>
            </id>
            <many-to-one name="campaignTypeListItem" class="com.beamland.miniusa.db.general.ListItem" fetch="select">
                <column name="CAMPAIGN_TYPE_ID" precision="10" scale="0" />
            </many-to-one>
            <many-to-one name="reportTypeListItem" class="com.beamland.miniusa.db.general.ListItem" fetch="select">
                <column name="REPORT_TYPE_ID" precision="10" scale="0" />
            </many-to-one>
            <property name="msdbmCode" type="java.lang.String">
                <column name="MSDBM_CODE" length="10" />
            </property>
            <property name="name" type="java.lang.String">
                <column name="NAME" />
            </property>
            <property name="dateStart" type="org.joda.time.contrib.hibernate.PersistentDateTime">
                <column name="DATE_START" length="7" />
            </property>
            <property name="dateEnd" type="org.joda.time.contrib.hibernate.PersistentDateTime">
                <column name="DATE_END" length="7" />
            </property>
            <property name="status" type="java.lang.String">
                <column name="STATUS" length="2" />
            </property>
            <property name="description" type="java.lang.String">
                <column name="DESCRIPTION" length="256" />
            </property>
            <property name="createdDate" type="org.joda.time.contrib.hibernate.PersistentDateTime" update="false" insert="false">
                <column name="CREATED_DATE" length="7" />
            </property>
            <property name="modifiedDate" type="org.joda.time.contrib.hibernate.PersistentDateTime" update="false" insert="false">
                <column name="MODIFIED_DATE" length="7" />
            </property>
            <property name="sortOrder" type="java.lang.Long">
                <column name="SORT_ORDER" precision="4" scale="0" />
            </property>
            <set name="touchs" inverse="true">
                <key>
                    <column name="CAMPAIGN_ID" precision="10" scale="0" />
                </key>
                <one-to-many class="com.beamland.miniusa.db.general.Touch" />
            </set>
            <set name="communications" inverse="true">
                <key>
                    <column name="CAMPAIGN_ID" precision="10" scale="0" />
                </key>
                <one-to-many class="com.beamland.miniusa.db.general.Communication" />
            </set>
        </class>
    </hibernate-mapping>
    
    #285815 Reply

    Loyal Water
    Member

    Can you go to Windows > Show View > General > Problem and check if any build path errors are showing up.

    #285828 Reply

    Adam Crane
    Participant

    I have made sure that there are no build problems. The errors I’m getting are related to other generated Hibernate POJOs. For example, in the exception above, the Campaign class has a problem with the touches Set in that the Touch class cannot be resolved. That class is generated as well. It’s Abstract class failed to build for a similar reason, but the concrete class is definitely in the build path. I even decompiled the class file from the bin folder and it looks fine to me. I tried to clean the project with all the concrete classes there and generate again, but I still get the same problem as before.

    #285841 Reply

    Loyal Water
    Member

    Can you create a sample project and send it across so that I can try reproducing this issue at my end as well. You can hit the pm button and at the bottom of my post and send me the project.

    #285849 Reply

    Adam Crane
    Participant

    In the process of putting together a simple sample, I have figured out what the problem is. I still have no idea how to resolve it, but at least I’ve narrowed it down…

    Because I have so many tables, I wanted to group them into several packages. Some of the POJOs reference objects in packages other than their own. For example, the test.employee.Manager object has a set of test.project.Project objects and a set of test.employee.Employee. This causes the “Generate POJOs” menu option to fail. However, if these objects are generated from the database there is no problem. If I remove the set of Project so that the test.employee.Manager object only has a set of test.employee.Employee, this works without a problem. Also, this only seems to be happening on sets, bags, maps etc. If there is a many-to-one reference, it seems to work without a problem.

    Unfortunately I don’t have the option generating my POJOs directly from the database because we have too many FKs that don’t need to be in the objects. I really need to have the option of generating a POJO from an hbm file.

    #286061 Reply

    Loyal Water
    Member

    Im extremely sorry for the delay in replying to you. The dev team is still looking into this issue and they will get back to you with an update asap.

    #296123 Reply

    vshopping1
    Member

    @support-nipun wrote:

    Im extremely sorry for the delay in replying to you. The dev team is still looking into this issue and they will get back to you with an update asap.

    I am also getting the same error. if try to created mapping xml files it works fine but for annotation it wont work. I tried all the soluntion given above. Do u have any updates on this

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: Hibernate POJO Generation Problem

You must be logged in to post in the forum log in