facebook

Error on reverse engineering table to generate POJO

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

    Phoenix_133
    Member

    Hi devs,

    I currently get a NullPointerException on generating the Pojo and hbm.xml files on two certain tables. Sadly, the stacktrace of myEclipse did not reveal a lot.
    I also made sure, that this is not due to my own templates, by deactivating the option.

    Here is the stacktrace I get from myEclipse .log:

    
    !SESSION 2012-05-04 09:36:25.962 -----------------------------------------------
    eclipse.buildId=unknown                                                         
    java.version=1.6.0_20
    java.vendor=Sun Microsystems Inc.
    BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
    Command-line arguments:  -os linux -ws gtk -arch x86_64
    
    !ENTRY com.genuitec.eclipse.core 1 0 2012-05-04 09:36:42.414
    !MESSAGE Unable to locate .myeclipse-blue.properties file
    
    !ENTRY com.genuitec.eclipse.hibernate 1 0 2012-05-04 09:37:46.471
    !MESSAGE Could not find implementors of IBaseHibernateDAO
    !STACK 0
    java.lang.ClassCastException: org.eclipse.jdt.core.search.TypeDeclarationMatch cannot be cast to org.eclipse.jdt.core.search.TypeReferenceMatch
            at com.genuitec.eclipse.hibernate.wizards.NewHibernateArtifactWizardPage.initializeBaseDAOCombo(NewHibernateArtifactWizardPage.java:702)
            at com.genuitec.eclipse.hibernate.wizards.NewHibernateArtifactWizardPage.loadProjectProperties(NewHibernateArtifactWizardPage.java:638)
            at com.genuitec.eclipse.hibernate.wizards.NewHibernateArtifactWizardPage.updatePackageFragmentRoot(NewHibernateArtifactWizardPage.java:521)
            at com.genuitec.eclipse.hibernate.wizards.NewHibernateArtifactWizardPage.init(NewHibernateArtifactWizardPage.java:976)
            at com.genuitec.eclipse.hibernate.wizards.NewHibernateMappingWizard.createPageControls(NewHibernateMappingWizard.java:212)
            at org.eclipse.jface.wizard.WizardDialog.createPageControls(WizardDialog.java:736)
            at org.eclipse.jface.wizard.WizardDialog.createContents(WizardDialog.java:608)
            at org.eclipse.jface.window.Window.create(Window.java:431)
            at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1089)
            at com.genuitec.eclipse.hibernate.action.NewHibernateMappingAction.basicRun(NewHibernateMappingAction.java:68)
            at com.genuitec.eclipse.core.ui.action.LicenseValidatingAction.run(Unknown Source)
            at com.genuitec.eclipse.hibernate.action.NewHibernateMappingAction.run(NewHibernateMappingAction.java:82)
            at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
            at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
            at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
            at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
            at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
            at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
            at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3588)
            at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3209)
            at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
            at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
            at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
            at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
            at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
            at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
            at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
            at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
            at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
            at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
            at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
            at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
            at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
            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:622)
            at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
            at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
            at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
    
    !ENTRY org.eclipse.core.jobs 4 2 2012-05-04 09:37:53.088
    !MESSAGE An internal error occurred during: "Generating Artifacts".
    !STACK 0
    java.lang.NullPointerException
            at org.hibernate.cfg.JDBCBinder.isFKConstrained(JDBCBinder.java:1018)
            at org.hibernate.cfg.JDBCBinder.bindOutgoingForeignKeys(JDBCBinder.java:594)
            at org.hibernate.cfg.JDBCBinder.createPersistentClasses(JDBCBinder.java:179)
            at org.hibernate.cfg.JDBCBinder.readFromDatabase(JDBCBinder.java:93)
            at com.genuitec.eclipse.hibernate.wizards.MEJDBCMetaDataConfiguration.readFromJDBC(MEJDBCMetaDataConfiguration.java:137)
            at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob$7.execute(GenerateArtifactsJob.java:891)
            at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:64)
            at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:95)
            at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.buildConfiguration(GenerateArtifactsJob.java:872)
            at com.genuitec.eclipse.hibernate.wizards.GenerateArtifactsJob.run(GenerateArtifactsJob.java:412)
            at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
    

    The following is my (because of NDA-issues slightly altered) SQL statements, to create the table:

    
    create table myPROD_BASE.TABLE_A
    (
      DISPLAY_MYID     CHAR(30) not null,
      MY_FIGUREID    CHAR(20) not null,
      MY_SHAPE     CHAR(3) not null,
      LINE_VIEW   CHAR(1) not null,
      FG_COLOUR CHAR(15) not null,
      BGT_IND  CHAR(1) not null,
      TRANS_PLACE  CHAR(1) not null
    )
    tablespace myPROD_DATA;
    Alter Table myPROD_BASE.TABLE_A
      add primary key (DISPLAY_MYID, MY_FIGUREID)
      using index tablespace myPROD_INDEX;
    Alter Table myPROD_BASE.TABLE_A
      add foreign key (DISPLAY_MYID)
      References myPROD_BASE.MAPS_GUIDE (DISPLAY_MYID);
    Alter Table myPROD_BASE.TABLE_A
      add foreign key (FG_COLOUR)
      References myPROD_BASE.MY_COLOURS (COLOUR_NAME);
    Alter Table myPROD_BASE.TABLE_A
      add check (MY_SHAPE IN ('ABC','DEF','GHI'));
    Alter Table myPROD_BASE.TABLE_A
      add check (LINE_VIEW IN ('A','B','C'));
    Alter Table myPROD_BASE.TABLE_A
      add check (BGT_IND IN ('Y','N'));
    Alter Table myPROD_BASE.TABLE_A
      add check (TRANS_PLACE IN ('Y','N'));
    
    prompt Creating TABLE_B...
    create table myPROD_BASE.TABLE_B
    (
      DISPLAY_MYID   CHAR(30) not null,
      MY_FIGUREID  CHAR(20) not null,
      C_FMT   CHAR(1) not null,
      C_LCN CHAR(15) not null,
      R_DIST NUMBER(4) not null
    )
    tablespace myPROD_DATA;
    Alter Table myPROD_BASE.TABLE_B
      add constraint TABLE_B_PK primary key (DISPLAY_MYID, MY_FIGUREID, C_FMT, 
    C_LCN, R_DIST)
      using index tablespace myPROD_INDEX;
    Alter Table myPROD_BASE.TABLE_B
      add foreign key (DISPLAY_MYID, MY_FIGUREID)
      References myPROD_BASE.TABLE_A (DISPLAY_MYID, MY_FIGUREID);
    Alter Table myPROD_BASE.TABLE_B
      add check (C_FMT IN ('A','B','C'));
    Alter Table myPROD_BASE.TABLE_B
      add check (R_DIST >= 1);
    Alter Table myPROD_BASE.TABLE_B
      add check (R_DIST <= 999);
    
    
    #325848 Reply

    support-swapna
    Moderator

    Phoenix_133 ,

    Sorry that you are seeing this issue.

    1. Can you please recheck your tables if a case where the foreign key column contains a value without a match in the pk column exists? Please ensure that there are no issues with foreign keys and their related tables.

    2. The DDL which you have sent is not complete enough for us to investigate. Can you please put together a DDL for a set of tables that exhibit the problem to help us investigate further ?

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Error on reverse engineering table to generate POJO

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