Home » Eclipse Projects » Dali » Entity Bean Generation from Postgres 8.4 database
| |
Re: Entity Bean Generation from Postgres 8.4 database [message #831689 is a reply to message #831237] |
Thu, 29 March 2012 07:56 |
shalin lazar Messages: 18 Registered: February 2012 |
Junior Member |
|
|
Karen Butzke wrote on Wed, 28 March 2012 12:56I'm trying my best to help now, I didn't see you on EclipseLink or WTP forums until others had responded. I know it's tough for users to know which project is implementing which functionality.
Thank you for your consideration Karen. Really appreciate it.
Quote:There is a view called 'Error Log'. Use ctrl-3 and type in Error Log. This is for exceptions that happen while running eclipse. If there is an exception occuring while generating entities, that could explain why the empty JoinColumns() annotation is being generated.
There are a few errors on the error log:
eclipse.buildId=M20110909-1335
java.version=1.6.0_26
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product
Error
Wed Mar 28 16:38:35 CAT 2012
Unable to find JPA entities generation templates in pluginorg.eclipse.jpt.jpa.gen
org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getReferencedColumn' in class org.eclipse.jpt.jpa.gen.internal.AssociationRole threw exception java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 @ join.vm[56,33]
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:286)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:203)
at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:419)
at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:73)
at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:125)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:88)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:107)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at org.apache.velocity.runtime.directive.Parse.render(Parse.java:224)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:170)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at org.apache.velocity.runtime.directive.Parse.render(Parse.java:224)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:170)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:88)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:88)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:448)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:170)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at org.apache.velocity.Template.merge(Template.java:254)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:508)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:473)
at org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generateJavaFile(PackageGenerator.java:257)
at org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generateClass(PackageGenerator.java:233)
at org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generateInternal(PackageGenerator.java:112)
at org.eclipse.jpt.jpa.gen.internal.PackageGenerator.doGenerate(PackageGenerator.java:90)
at org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generate(PackageGenerator.java:67)
at org.eclipse.jpt.jpa.ui.internal.wizards.gen.GenerateEntitiesFromSchemaWizard$GenerateEntitiesJob.runInWorkspace(GenerateEntitiesFromSchemaWizard.java:248)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at org.eclipse.jpt.jpa.gen.internal.AssociationRole.getReferencedColumn(AssociationRole.java:117)
at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
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:295)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:245)
... 34 more
Then this one:
eclipse.buildId=M20110909-1335
java.version=1.6.0_26
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product
Error
Wed Mar 28 16:22:01 CAT 2012
An exception occurred invoking extension: org.eclipse.jst.jee.ui.ejb for object P/trialfpsJPA
java.lang.IllegalStateException: The project <P/trialfpsJPA> is not accessible.
at org.eclipse.jst.jee.model.internal.JEE5ModelProvider.getModelResource(JEE5ModelProvider.java:148)
at org.eclipse.jst.jee.model.internal.Ejb3ModelProvider.getModelObject(Ejb3ModelProvider.java:43)
at org.eclipse.jst.jee.model.internal.JEE5ModelProvider.getModelObject(JEE5ModelProvider.java:217)
at org.eclipse.jst.jee.model.internal.common.AbstractMergedModelProvider.loadProviders(AbstractMergedModelProvider.java:261)
at org.eclipse.jst.jee.model.internal.common.AbstractMergedModelProvider.access$2(AbstractMergedModelProvider.java:255)
at org.eclipse.jst.jee.model.internal.common.AbstractMergedModelProvider$LoadModelsWorkspaceRunnable.run(AbstractMergedModelProvider.java:278)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.jst.jee.model.internal.common.AbstractMergedModelProvider.loadModel(AbstractMergedModelProvider.java:249)
at org.eclipse.jst.jee.model.internal.common.AbstractMergedModelProvider.getMergedModel(AbstractMergedModelProvider.java:219)
at org.eclipse.jst.jee.model.internal.common.AbstractMergedModelProvider.getModelObject(AbstractMergedModelProvider.java:139)
at org.eclipse.jst.jee.ui.internal.navigator.Ejb3ContentProvider.getNewContentProviderInstance(Ejb3ContentProvider.java:213)
at org.eclipse.jst.jee.ui.internal.navigator.JEE5ContentProvider.getCachedContentProvider(JEE5ContentProvider.java:92)
at org.eclipse.jst.jee.ui.internal.navigator.Ejb3ContentProvider.getChildren(Ejb3ContentProvider.java:75)
at org.eclipse.ui.internal.navigator.extensions.SafeDelegateTreeContentProvider.getChildren(SafeDelegateTreeContentProvider.java:96)
at org.eclipse.ui.internal.navigator.NavigatorContentServiceContentProvider$1.run(NavigatorContentServiceContentProvider.java:152)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.navigator.NavigatorContentServiceContentProvider.internalGetChildren(NavigatorContentServiceContentProvider.java:139)
at org.eclipse.ui.internal.navigator.NavigatorContentServiceContentProvider.getChildren(NavigatorContentServiceContentProvider.java:119)
at org.eclipse.jst.jee.ui.internal.navigator.JEE5ContentProvider$1.run(JEE5ContentProvider.java:127)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3563)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3212)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.block(ModalContext.java:173)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:388)
at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.run(RefactoringWizardDialog2.java:331)
at org.eclipse.ltk.ui.refactoring.RefactoringWizard.internalPerformFinish(RefactoringWizard.java:605)
at org.eclipse.ltk.ui.refactoring.UserInputWizardPage.performFinish(UserInputWizardPage.java:153)
at org.eclipse.ltk.ui.refactoring.resource.DeleteResourcesWizard$DeleteResourcesRefactoringConfigurationPage.performFinish(DeleteResourcesWizard.java:151)
at org.eclipse.ltk.ui.refactoring.RefactoringWizard.performFinish(RefactoringWizard.java:678)
at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.okPressed(RefactoringWizardDialog2.java:455)
at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:472)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
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.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation$1.run(RefactoringWizardOpenOperation.java:181)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:193)
at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:116)
at org.eclipse.ltk.internal.ui.refactoring.actions.DeleteResourcesHandler.execute(DeleteResourcesHandler.java:40)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.ui.internal.handlers.HandlerService.executeCommandInContext(HandlerService.java:270)
at org.eclipse.ui.internal.ide.actions.LTKLauncher.runCommand(LTKLauncher.java:95)
at org.eclipse.ui.internal.ide.actions.LTKLauncher.openDeleteWizard(LTKLauncher.java:47)
at org.eclipse.ui.actions.DeleteResourceAction.run(DeleteResourceAction.java:474)
at org.eclipse.jdt.internal.ui.refactoring.reorg.DeleteAction.run(DeleteAction.java:165)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:275)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:251)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
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:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
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)
Quote:On stack overflow I see you saying that not all the entity beans are generated. Why are you generating them 70 tables at a time? Was there a problem you hit trying to do all 250 tables? Dali will not generate the entities correctly if there are references between tables and you don't generate those at the same time.
Yes, the problem was that not all tables from the database were generated into Entities. Upon noting some tables that weren't generated, I generated these specific tables and it seemed to resolve the problem - sometimes requiring to regenerate tables which were already generated as Entities and raised association errors. I found one such example in the error log as well.
eclipse.buildId=M20110909-1335
java.version=1.6.0_26
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product
Error
Wed Mar 28 16:21:00 CAT 2012
File not found: /home/shalin/eclipse/workplace/trialfpsJPA/src/zm/co/freight/trialfps/entity/Associate.java.
java.io.FileNotFoundException: /home/shalin/eclipse/workplace/trialfpsJPA/src/zm/co/freight/trialfps/entity/Associate.java (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:120)
at org.eclipse.core.internal.filesystem.local.LocalFile.openInputStream(LocalFile.java:362)
at org.eclipse.core.internal.localstore.FileSystemResourceManager.read(FileSystemResourceManager.java:797)
at org.eclipse.core.internal.resources.File.getContents(File.java:289)
at org.eclipse.jdt.internal.core.util.Util.getResourceContentsAsCharArray(Util.java:1187)
at org.eclipse.jdt.internal.core.CompilationUnit.getContents(CompilationUnit.java:649)
at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1116)
at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:807)
at org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools.buildASTRoot(ASTTools.java:52)
at org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceCompilationUnit.buildASTRoot(SourceCompilationUnit.java:140)
at org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceTypeCompilationUnit.buildPersistentType(SourceTypeCompilationUnit.java:58)
at org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceTypeCompilationUnit.<init>(SourceTypeCompilationUnit.java:53)
at org.eclipse.jpt.jpa.core.internal.JavaResourceModelProvider.buildResourceModel(JavaResourceModelProvider.java:49)
at org.eclipse.jpt.jpa.core.internal.JavaResourceModelProvider.buildResourceModel(JavaResourceModelProvider.java:1)
at org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform.buildResourceModel(GenericJpaPlatform.java:111)
at org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform.buildJpaFile(GenericJpaPlatform.java:105)
at org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform.buildJpaFile(GenericJpaPlatform.java:101)
at org.eclipse.jpt.jpa.core.internal.AbstractJpaProject.buildJpaFile(AbstractJpaProject.java:596)
at org.eclipse.jpt.jpa.core.internal.AbstractJpaProject.addJpaFile_(AbstractJpaProject.java:560)
at org.eclipse.jpt.jpa.core.internal.AbstractJpaProject$InitialResourceProxyVisitor.visit(AbstractJpaProject.java:324)
at org.eclipse.core.internal.resources.Resource$1.visitElement(Resource.java:65)
at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:82)
at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:86)
at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:86)
at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:86)
at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:86)
at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:86)
at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:86)
at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:86)
at org.eclipse.core.internal.watson.ElementTreeIterator.iterate(ElementTreeIterator.java:127)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:75)
at org.eclipse.jpt.jpa.core.internal.AbstractJpaProject$InitialResourceProxyVisitor.visitProject(AbstractJpaProject.java:308)
at org.eclipse.jpt.jpa.core.internal.AbstractJpaProject.<init>(AbstractJpaProject.java:252)
at org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaProjectImpl.<init>(EclipseLinkJpaProjectImpl.java:26)
at org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaFactory.buildJpaProject(EclipseLinkJpaFactory.java:60)
at org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.EclipseLink2_0JpaFactory.buildJpaProject(EclipseLink2_0JpaFactory.java:83)
at org.eclipse.jpt.jpa.eclipselink.core.internal.v2_0.EclipseLink2_0JpaFactory.buildJpaProject(EclipseLink2_0JpaFactory.java:1)
at org.eclipse.jpt.jpa.core.GenericJpaProjectManager.buildJpaProject(GenericJpaProjectManager.java:398)
at org.eclipse.jpt.jpa.core.GenericJpaProjectManager.buildJpaProject(GenericJpaProjectManager.java:384)
at org.eclipse.jpt.jpa.core.GenericJpaProjectManager.buildJpaProject(GenericJpaProjectManager.java:373)
at org.eclipse.jpt.jpa.core.GenericJpaProjectManager.addJpaProject(GenericJpaProjectManager.java:356)
at org.eclipse.jpt.jpa.core.GenericJpaProjectManager$ResourceProxyVisitor.processProject(GenericJpaProjectManager.java:734)
at org.eclipse.jpt.jpa.core.GenericJpaProjectManager$ResourceProxyVisitor.visit(GenericJpaProjectManager.java:719)
at org.eclipse.core.internal.resources.Resource$1.visitElement(Resource.java:65)
at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:82)
at org.eclipse.core.internal.watson.ElementTreeIterator.iterate(ElementTreeIterator.java:120)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:75)
at org.eclipse.jpt.jpa.core.GenericJpaProjectManager.buildJpaProjects_(GenericJpaProjectManager.java:245)
at org.eclipse.jpt.jpa.core.GenericJpaProjectManager.buildJpaProjects(GenericJpaProjectManager.java:236)
at org.eclipse.jpt.jpa.core.GenericJpaProjectManager.start_(GenericJpaProjectManager.java:220)
at org.eclipse.jpt.jpa.core.GenericJpaProjectManager.start(GenericJpaProjectManager.java:211)
at org.eclipse.jpt.jpa.core.JptJpaCorePlugin.getJpaProjectManager_(JptJpaCorePlugin.java:785)
at org.eclipse.jpt.jpa.core.JptJpaCorePlugin.getJpaProjectManager(JptJpaCorePlugin.java:248)
at org.eclipse.jpt.jpa.core.JptJpaCorePlugin.getJpaProject(JptJpaCorePlugin.java:257)
at org.eclipse.jpt.jpa.ui.internal.editors.PersistenceEditor.getJpaProject(PersistenceEditor.java:301)
at org.eclipse.jpt.jpa.ui.internal.editors.PersistenceEditor.addPersistenceUnitPages(PersistenceEditor.java:127)
at org.eclipse.jpt.jpa.ui.internal.editors.PersistenceEditor.addPages(PersistenceEditor.java:117)
at org.eclipse.ui.forms.editor.FormEditor.createPages(FormEditor.java:138)
at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:348)
at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:670)
at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:465)
at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:595)
at org.eclipse.ui.internal.EditorAreaHelper.setVisibleEditor(EditorAreaHelper.java:271)
at org.eclipse.ui.internal.EditorManager.setVisibleEditor(EditorManager.java:1459)
at org.eclipse.ui.internal.EditorManager$5.runWithException(EditorManager.java:972)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3563)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3212)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
at org.eclipse.ui.internal.Workbench$33.runWithException(Workbench.java:1595)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3563)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3212)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
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)
Thanks once again for your help ... as you can see, this is beyond my depth of knowledge in Entity Generation.
Best regards,
Shalin.
|
|
|
Re: Entity Bean Generation from Postgres 8.4 database [message #831714 is a reply to message #831689] |
Thu, 29 March 2012 08:40 |
shalin lazar Messages: 18 Registered: February 2012 |
Junior Member |
|
|
My bad ... I deleted the trialfpsJPA project, created a new EJB Project (adding the JPA Facet to it) and ran those tests. I've created a new EAR Project and started afresh. Will post the errors in a bit as not all tables will be generated.
I know this from the generation wizard, where all tables are viewed in the selection (first) dialog, but after the association dialog, including the last one (where the tables are listed), not all tables appear.
Apart from adding new associations and mapping tables, there isn't much one can do in terms of settings for the generator. For the Key generator, I've tried auto, identity, table and none. Postgres uses sequences, but not all my tables have sequences as a result of gap-less sequences which is a functional requirement. In this situation, I created a single column (and row) table, that I use just to store the count of a gap-less PK-sequence.
Entity access: Field
Associations fetch: Default
Collection properties type: java.util.Set
Tried both selecting and not selecting the 'Always generate optional JPS annotations and DDL parameters' option.
I should add that I create an EAR Project, then EJB Project which I add to the EAR, add the JPA Facet to the EJB Project in the Configuration section of its creation wizard.
JPA Settings are:
Platform: EclipseLink 2.3.x
JPA Implementation: User Library
Select the database connection and then both selected and not selected the 'Add driver library to build path' option.
Errors on new project from Error Log:
eclipse.buildId=M20110909-1335
java.version=1.6.0_26
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product
This is a continuation of log file /home/shalin/eclipse/workplace/.metadata/.bak_0.log
Created Time: 2012-03-29 10:43:54.670
Error
Thu Mar 29 11:18:12 CAT 2012
Unable to find JPA entities generation templates in pluginorg.eclipse.jpt.jpa.gen
org.eclipse.core.runtime.CoreException: Unable to find JPA entities generation templates in pluginorg.eclipse.jpt.jpa.gen
at org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generateClass(PackageGenerator.java:245)
at org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generateInternal(PackageGenerator.java:112)
at org.eclipse.jpt.jpa.gen.internal.PackageGenerator.doGenerate(PackageGenerator.java:90)
at org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generate(PackageGenerator.java:67)
at org.eclipse.jpt.jpa.ui.internal.wizards.gen.GenerateEntitiesFromSchemaWizard$GenerateEntitiesJob.runInWorkspace(GenerateEntitiesFromSchemaWizard.java:248)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getReferencedColumn' in class org.eclipse.jpt.jpa.gen.internal.AssociationRole threw exception java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 @ join.vm[31,33]
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:286)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:203)
at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:419)
at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:73)
at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:125)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:448)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:170)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:88)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at org.apache.velocity.runtime.directive.Parse.render(Parse.java:224)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:170)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:107)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at org.apache.velocity.runtime.directive.Parse.render(Parse.java:224)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:170)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
at org.apache.velocity.runtime.parser.node.ASTElseIfStatement.render(ASTElseIfStatement.java:93)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:107)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:88)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:448)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:170)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at org.apache.velocity.Template.merge(Template.java:254)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:508)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:473)
at org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generateJavaFile(PackageGenerator.java:257)
at org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generateClass(PackageGenerator.java:233)
... 6 more
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at org.eclipse.jpt.jpa.gen.internal.AssociationRole.getReferencedColumn(AssociationRole.java:115)
at sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source)
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:295)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:245)
... 38 more
eclipse.buildId=M20110909-1335
java.version=1.6.0_26
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product
This is a continuation of log file /home/shalin/eclipse/workplace/.metadata/.bak_0.log
Created Time: 2012-03-29 10:43:54.670
Error
Thu Mar 29 11:06:06 CAT 2012
Unable to find JPA entities generation templates in pluginorg.eclipse.jpt.jpa.gen
org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getReferencedColumn' in class org.eclipse.jpt.jpa.gen.internal.AssociationRole threw exception java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 @ join.vm[31,33]
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:286)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:203)
at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:419)
at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:73)
at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:125)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:448)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:170)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:88)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at org.apache.velocity.runtime.directive.Parse.render(Parse.java:224)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:170)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:107)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at org.apache.velocity.runtime.directive.Parse.render(Parse.java:224)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:170)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
at org.apache.velocity.runtime.parser.node.ASTElseIfStatement.render(ASTElseIfStatement.java:93)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:107)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:88)
at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:74)
at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:448)
at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:170)
at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:318)
at org.apache.velocity.Template.merge(Template.java:254)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:508)
at org.apache.velocity.app.VelocityEngine.mergeTemplate(VelocityEngine.java:473)
at org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generateJavaFile(PackageGenerator.java:257)
at org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generateClass(PackageGenerator.java:233)
at org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generateInternal(PackageGenerator.java:112)
at org.eclipse.jpt.jpa.gen.internal.PackageGenerator.doGenerate(PackageGenerator.java:90)
at org.eclipse.jpt.jpa.gen.internal.PackageGenerator.generate(PackageGenerator.java:67)
at org.eclipse.jpt.jpa.ui.internal.wizards.gen.GenerateEntitiesFromSchemaWizard$GenerateEntitiesJob.runInWorkspace(GenerateEntitiesFromSchemaWizard.java:248)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at org.eclipse.jpt.jpa.gen.internal.AssociationRole.getReferencedColumn(AssociationRole.java:115)
at sun.reflect.GeneratedMethodAccessor56.invoke(Unknown Source)
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:295)
at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:245)
... 38 more
Thanks again.
[Updated on: Thu, 29 March 2012 09:25] Report message to a moderator
|
|
| |
Re: Entity Bean Generation from Postgres 8.4 database [message #832462 is a reply to message #831920] |
Fri, 30 March 2012 07:15 |
shalin lazar Messages: 18 Registered: February 2012 |
Junior Member |
|
|
So are you saying that I should do away with EJB and access the DB directly? I really like the ORM concept, and this is the first time I ran into a problem like this.
The only reason why I built my DB first was because there were some transactions that required numerous joins, triggers, etc. So I felt that there would be a performance gain by calling stored procedures from Session Beans (which I tested on a smaller test database). I planned to do the more simpler transactions with JPA.
Back to the bug, when I break the database into sets of tables (70), I am able to generate the whole DB, but I still get the 'Join Columns cannot be resolved on table ...' error at @JoinColumns({}). Could it be that there is some sort of limit as to the number of entities Dali can generate from tables at a go?
Funnily enough, after reading your post yesterday, I installed Netbeans 7.1.1 and it seems to be working just fine. I have used Netbeans before, so I know how to go about EJB Development with it. Maybe I'm doing something wrong with my project on Eclipse?
Regarding the posting of the bug, there are quite a few tables that cause the exception. In fact, I'm not sure if these two (not generating all tables, @JoinColumn) are the only errors I'm facing.
I'm not sure if I understood exactly what I should do to file the bug. I suppose I can use the last stack trace I posted and this DDL:
--<ScriptOptions statementTerminator=";"/>
ALTER TABLE "public"."fpsInventoryModel" DROP CONSTRAINT "fpsInventoryModel_unit_id";
ALTER TABLE "public"."fpsInventoryModel" DROP CONSTRAINT "fpsInventoryModel_fpsInventoryModelCategory_id";
ALTER TABLE "public"."fpsInventoryModel" DROP CONSTRAINT "fpsInventoryModel_fpsInventoryModelType_id";
ALTER TABLE "public"."fpsInventoryModel" DROP CONSTRAINT "pk_fpsInventoryModel";
DROP INDEX "public"."fki_fpsInventoryModel_fpsInventoryModelType_id";
DROP INDEX "public"."unique_fpsInventoryModel_binCode_modelTypeId";
DROP INDEX "public"."unique_fpsInventoryModel_name";
DROP INDEX "public"."fki_fpsInventoryModel_fpsInventoryModelCategory_id";
DROP INDEX "public"."fki_fpsInventoryModel_unit_id";
DROP INDEX "public"."pk_fpsInventoryModel";
DROP TABLE "public"."fpsInventoryModel";
CREATE TABLE "public"."fpsInventoryModel" (
"id" BIGSERIAL DEFAULT nextval('"fpsInventoryModel_id_seq"'::regclass) NOT NULL,
"fpsInventoryModelCategoryId" INT8 NOT NULL,
"binCode" TEXT(2147483647),
"name" TEXT(2147483647) NOT NULL,
"unitId" INT4 NOT NULL,
"remark" TEXT(2147483647),
"itemTracker" BOOL DEFAULT false NOT NULL,
"maintainanceTracker" BOOL DEFAULT false NOT NULL,
"modelTypeId" INT4 NOT NULL
);
CREATE INDEX "public"."fki_fpsInventoryModel_fpsInventoryModelType_id" ON "public"."fpsInventoryModel" ("modelTypeId" ASC);
CREATE UNIQUE INDEX "public"."unique_fpsInventoryModel_binCode_modelTypeId" ON "public"."fpsInventoryModel" ("binCode" ASC, "modelTypeId" ASC);
CREATE UNIQUE INDEX "public"."unique_fpsInventoryModel_name" ON "public"."fpsInventoryModel" ("name" ASC);
CREATE INDEX "public"."fki_fpsInventoryModel_fpsInventoryModelCategory_id" ON "public"."fpsInventoryModel" ("fpsInventoryModelCategoryId" ASC);
CREATE INDEX "public"."fki_fpsInventoryModel_unit_id" ON "public"."fpsInventoryModel" ("unitId" ASC);
CREATE UNIQUE INDEX "public"."pk_fpsInventoryModel" ON "public"."fpsInventoryModel" ("id" ASC);
ALTER TABLE "public"."fpsInventoryModel" ADD CONSTRAINT "pk_fpsInventoryModel" PRIMARY KEY ("id");
ALTER TABLE "public"."fpsInventoryModel" ADD CONSTRAINT "fpsInventoryModel_unit_id" FOREIGN KEY ("unitId")
REFERENCES "public"."unit" ("id")
ON DELETE RESTRICT
ON UPDATE RESTRICT
DEFERRABLE;
ALTER TABLE "public"."fpsInventoryModel" ADD CONSTRAINT "fpsInventoryModel_fpsInventoryModelCategory_id" FOREIGN KEY ("fpsInventoryModelCategoryId")
REFERENCES "public"."fpsInventoryModelCategory" ("id")
ON DELETE RESTRICT
ON UPDATE RESTRICT
DEFERRABLE;
ALTER TABLE "public"."fpsInventoryModel" ADD CONSTRAINT "fpsInventoryModel_fpsInventoryModelType_id" FOREIGN KEY ("modelTypeId")
REFERENCES "public"."fpsInventoryModelType" ("id")
ON DELETE RESTRICT
ON UPDATE RESTRICT
DEFERRABLE;
Also, when browsing through the error log, I came across this even though the Entity AccountTransactCenterCostCode.java has been generated:
eclipse.buildId=M20110909-1335
java.version=1.6.0_26
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product
This is a continuation of log file /home/shalin/eclipse/workplace/.metadata/.bak_0.log
Created Time: 2012-03-29 15:20:01.403
Error
Thu Mar 29 15:20:01 CAT 2012
File not found: '/testEJB/ejbModule/zm/co/freight/test/Entity/AccountTransactCenterCostCode.java'
org.eclipse.core.internal.resources.ResourceException: Resource '/testEJB/ejbModule/zm/co/freight/test/Entity/AccountTransactCenterCostCode.java' does not exist.
at org.eclipse.core.internal.resources.Resource.checkExists(Resource.java:320)
at org.eclipse.core.internal.resources.Resource.checkAccessible(Resource.java:194)
at org.eclipse.core.internal.resources.File.getContents(File.java:287)
at org.eclipse.jdt.internal.core.util.Util.getResourceContentsAsCharArray(Util.java:1187)
at org.eclipse.jdt.internal.core.CompilationUnit.getContents(CompilationUnit.java:649)
at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1116)
at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:807)
at org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools.buildASTRoot(ASTTools.java:52)
at org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceCompilationUnit.buildASTRoot(SourceCompilationUnit.java:140)
at org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceCompilationUnit.synchronizeWithJavaSource(SourceCompilationUnit.java:158)
at org.eclipse.jpt.jpa.core.internal.AbstractJpaProject.synchronizeWithJavaSource(AbstractJpaProject.java:1327)
at org.eclipse.jpt.jpa.core.internal.AbstractJpaProject.rebuild(AbstractJpaProject.java:1271)
at org.eclipse.jpt.jpa.core.internal.AbstractJpaProject.processJavaProjectDelta(AbstractJpaProject.java:1257)
at org.eclipse.jpt.jpa.core.internal.AbstractJpaProject.processJavaDelta(AbstractJpaProject.java:1207)
at org.eclipse.jpt.jpa.core.internal.AbstractJpaProject.processJavaDeltaChildren(AbstractJpaProject.java:1225)
at org.eclipse.jpt.jpa.core.internal.AbstractJpaProject.processJavaModelDelta(AbstractJpaProject.java:1247)
at org.eclipse.jpt.jpa.core.internal.AbstractJpaProject.processJavaDelta(AbstractJpaProject.java:1204)
at org.eclipse.jpt.jpa.core.internal.AbstractJpaProject.javaElementChanged(AbstractJpaProject.java:1195)
at org.eclipse.jpt.jpa.core.GenericJpaProjectManager.javaElementChanged_(GenericJpaProjectManager.java:598)
at org.eclipse.jpt.jpa.core.GenericJpaProjectManager$8.execute_(GenericJpaProjectManager.java:587)
at org.eclipse.jpt.jpa.core.GenericJpaProjectManager$EventHandlerCommand.execute(GenericJpaProjectManager.java:766)
at org.eclipse.jpt.common.utility.internal.AsynchronousCommandExecutor$Consumer.execute(AsynchronousCommandExecutor.java:163)
at org.eclipse.jpt.common.utility.internal.ConsumerThreadCoordinator$RunnableConsumer.execute_(ConsumerThreadCoordinator.java:226)
at org.eclipse.jpt.common.utility.internal.ConsumerThreadCoordinator$RunnableConsumer.execute(ConsumerThreadCoordinator.java:216)
at org.eclipse.jpt.common.utility.internal.ConsumerThreadCoordinator$RunnableConsumer.run(ConsumerThreadCoordinator.java:204)
at java.lang.Thread.run(Thread.java:662)
Sorry for the many questions. Just want to post the bug and hope it can be resolved soon. Otherwise, I have no option but to switch to Netbeans and/or another technology.
Appreciate your help. Thanks and best regards,
Shalin.
|
|
|
Re: Entity Bean Generation from Postgres 8.4 database [message #832479 is a reply to message #831920] |
Fri, 30 March 2012 07:41 |
shalin lazar Messages: 18 Registered: February 2012 |
Junior Member |
|
|
Karen Butzke wrote on Thu, 29 March 2012 10:22Please file a bug against Web Tools -> Dali JPA Tools.
I went to bugs[dot]eclipse[dot]org
I don't know exactly where to post the bug. From the options on the 'new' page, I only saw Enterprise Java -> Data Tools (DTP). Would this be sufficient? Don't know where Dali JPA Tools is.
EDIT: Just worked on Netbeans. I assume it uses the same JPA Tools and Eclipse, since in the Entity generation wizard, there is an "Include Related Tables" check box, that when selected, seems to not include the tables that are not being generated on Eclipse. Mind, this is what I noted from looking at it once. I could be wrong.
Upon un-checking that option, all the tables appear and are generated as Entities. Now, you could say that these tables are just created for DB relations, containing only foreign keys as columns. But, there is one table in particular that I have noted:
CREATE TABLE associate
(
id bigint NOT NULL DEFAULT nextval('associates_id_seq'::regclass),
name1 text,
name2 text,
name3 text,
name4 text,
"associateTypeId" integer NOT NULL,
"userId" integer NOT NULL,
CONSTRAINT pk_associate PRIMARY KEY (id)
)
WITH (
OIDS=FALSE
);
This table also appears on that list of table that are affected by the "Include Related Tables" option. If it is not created, how am I going to perform CRUD operations on the names?
Sorry for the side track. Trying to figure out why this is happening.
Thanks Again,
Shalin.
Edit2: Done
/show_bug.cgi?id=375728
[Updated on: Fri, 30 March 2012 14:59] Report message to a moderator
|
|
|
Re: Entity Bean Generation from Postgres 8.4 database [message #837034 is a reply to message #832479] |
Thu, 05 April 2012 07:34 |
shalin lazar Messages: 18 Registered: February 2012 |
Junior Member |
|
|
Bump.
Well, no response from bugs[dot]eclipse; I'm beginning to wonder if its a bug OR a problem with my database. I've tried generating the entities on IntelliJ IDEA 11, and am still facing errors in Entity generation. Netbeans is also giving me errors, so could there be something wrong with my database?
Postgres has a lot of functionality built into it, so for the time being, I'm continuing my project's business logic with their stored functions. If the generation problem can be resolved, then I can switch onto EJB and call the stored functions from there. Otherwise, good old jdbc string connection will have to do.
I've been also looking at QT a lot lately. I like Swing, but want this application to have a more modern look and feel to it. Seems like the learning curve is considerable so far, but what is your take on it?
|
|
| |
Re: Entity Bean Generation from Postgres 8.4 database [message #837353 is a reply to message #837294] |
Thu, 05 April 2012 15:17 |
shalin lazar Messages: 18 Registered: February 2012 |
Junior Member |
|
|
Thing is, I'd like to know what is wrong on my database. Is it the naming of my columns, use of upper-case, etc. I honestly haven't got a clue. The database, as it is, seems to be working fine. I've decided to start implementing some of the larger business logic with plpgsql stored functions, and so far I haven't found an error.
And given the amount of errors raised by the generators, I would think that if there was some logic wrong within the database, I would have found it by now.
Also, Netbeans generates all entities correctly. It only raised errors when I added persistence (Entity Manager) to a Session Bean. Even then, it compiled with no errors. Only on deployment, I got the following error:
forums[dot]netbeans[dot]org[slash]viewtopic[dot]php?p=126217#126217
IntelliJ IDEA 11 however raised an error with a primary key sequence. Postgres creates a single column, single row, table to store the current value of any sequence (types Serial and BigSerial). IDEA generated all these tables as well and raised an error stating that there were duplicate values, which I couldn't see.
So I really have no clue what is wrong with my DB. If I could just find out and fix it, it would make life a lot more easier
|
|
| |
Re: Entity Bean Generation from Postgres 8.4 database [message #840539 is a reply to message #840160] |
Tue, 10 April 2012 07:57 |
shalin lazar Messages: 18 Registered: February 2012 |
Junior Member |
|
|
I discovered something this morning. Sorry I haven't been able to put more effort into finding out why this error is rising up. I've been busy with my stored procedures. Debugging in SQL ain't one for the impatient.
I did a little testing, and noted that Entity UserHistory, which is linked to many other tables isn't generated.
--<ScriptOptions statementTerminator=";"/>
CREATE TABLE userHistory (
id BIGSERIAL DEFAULT nextval('"userHistory_id_seq"'::regclass) NOT NULL,
userId INT4,
_datetime TIMESTAMP NOT NULL
);
CREATE INDEX fki_userHistory_user_id ON userHistory (userId ASC);
CREATE UNIQUE INDEX pk_userHistory ON userHistory (id ASC);
ALTER TABLE userHistory ADD CONSTRAINT pk_userHistory PRIMARY KEY (id);
ALTER TABLE userHistory ADD CONSTRAINT userHistory_user_id FOREIGN KEY (userId)
REFERENCES user (id)
ON DELETE RESTRICT
ON UPDATE RESTRICT
DEFERRABLE;
Entity AccountTransactCenter raises a "UserHistory cannot be resolved to a type" error. It is an n-to-n relation that I created by using a 'join' table, if I may, which basically has both AccountTransactCenter and UserHistory ids as the only columns, both FKs referencing the respective tables, and forming a 2-column PK.
--<ScriptOptions statementTerminator=";"/>
CREATE TABLE accountTransactCenter (
currentDate TIMESTAMP NOT NULL,
transactionTypeId INT4 NOT NULL,
accountId INT8 NOT NULL,
contraAccountId INT8 NOT NULL,
currencyId INT4 NOT NULL,
_remark TEXT(2147483647),
userId INT4 NOT NULL,
_amount NUMERIC(17 , 2),
exchangeRate NUMERIC(17 , 2),
hcAmount NUMERIC(17 , 2) NOT NULL,
entryCode BPCHAR(5) NOT NULL,
entryNo INT8 NOT NULL,
_inventory BOOL DEFAULT false NOT NULL,
hasCostCode BOOL DEFAULT false NOT NULL,
taxCodeId INT4 NOT NULL,
crDr BOOL NOT NULL,
taxAmount NUMERIC(17 , 2),
totalAmount NUMERIC(17 , 2),
invoiceNo TEXT(2147483647),
referenceCode BPCHAR(5) NOT NULL,
id INT8 DEFAULT "accountTransactCenter_pk_next"() NOT NULL,
hcTotalAmount NUMERIC(17 , 2) NOT NULL,
hcTaxAmount NUMERIC(17 , 2),
referenceNo INT8 NOT NULL
);
CREATE UNIQUE INDEX unique_accountTransactCenter_entryCode_entryNo ON accountTransactCenter (entryCode ASC, entryNo ASC);
CREATE INDEX fki_accountTransactCenter_taxCode_id ON accountTransactCenter (taxCodeId ASC);
CREATE INDEX fki_accountTransactCenter_accountTransactCenterRequestType_requ ON accountTransactCenter (referenceCode ASC);
CREATE UNIQUE INDEX pk_accountTransactCenter ON accountTransactCenter (id ASC);
CREATE INDEX fki_accountTransactCenter_currency_id ON accountTransactCenter (currencyId ASC);
CREATE INDEX fki_accountTransactCenterCr_subjectAccount_id ON accountTransactCenter (accountId ASC);
CREATE UNIQUE INDEX unique_accountTransactCenter_referenceCode_referenceNo ON accountTransactCenter (referenceCode ASC, referenceNo ASC);
CREATE INDEX fki_accountTransactCenter_user_id ON accountTransactCenter (userId ASC);
CREATE INDEX fki_accountTransactCenterDr_subjectAccount_id ON accountTransactCenter (contraAccountId ASC);
CREATE INDEX fki_accountTransactCenter_transactionType_id ON accountTransactCenter (transactionTypeId ASC);
ALTER TABLE accountTransactCenter ADD CONSTRAINT pk_accountTransactCenter PRIMARY KEY (id);
ALTER TABLE accountTransactCenter ADD CONSTRAINT accountTranstactCenterContra_subjectAccount_id FOREIGN KEY (contraAccountId)
REFERENCES subjectAccount (id)
ON DELETE RESTRICT
ON UPDATE RESTRICT
DEFERRABLE;
ALTER TABLE accountTransactCenter ADD CONSTRAINT accountTransactCenter_user_id FOREIGN KEY (userId)
REFERENCES user (id)
ON DELETE RESTRICT
ON UPDATE RESTRICT
DEFERRABLE;
ALTER TABLE accountTransactCenter ADD CONSTRAINT accountTransactCenter_transactionType_id FOREIGN KEY (transactionTypeId)
REFERENCES transactionType (id)
ON DELETE RESTRICT
ON UPDATE RESTRICT
DEFERRABLE;
ALTER TABLE accountTransactCenter ADD CONSTRAINT accountTransactCenter_currency_id FOREIGN KEY (currencyId)
REFERENCES currency (id)
ON DELETE RESTRICT
ON UPDATE RESTRICT
DEFERRABLE;
ALTER TABLE accountTransactCenter ADD CONSTRAINT accountTransactCenter_subjectAccount_id FOREIGN KEY (accountId)
REFERENCES subjectAccount (id)
ON DELETE RESTRICT
ON UPDATE RESTRICT
DEFERRABLE;
ALTER TABLE accountTransactCenter ADD CONSTRAINT accountTransactCenter_taxCode_code FOREIGN KEY (taxCodeId)
REFERENCES taxCode (code)
ON DELETE RESTRICT
ON UPDATE RESTRICT
DEFERRABLE;
This is the join table: merge_userHistory_accountTransactCenter
--<ScriptOptions statementTerminator=";"/>
CREATE TABLE merge_userHistory_accountTransactCenter (
userHistoryId INT8 NOT NULL,
accountTransactCenterId INT8 NOT NULL
);
CREATE UNIQUE INDEX pk_merge_userHistory_accountTransactCenter ON merge_userHistory_accountTransactCenter (userHistoryId ASC, accountTransactCenterId ASC);
CREATE INDEX fki_merge_userHistory_accountTransactCenter_accountTransactCent ON merge_userHistory_accountTransactCenter (accountTransactCenterId ASC);
ALTER TABLE merge_userHistory_accountTransactCenter ADD CONSTRAINT pk_merge_userHistory_accountTransactCenter PRIMARY KEY (userHistoryId, accountTransactCenterId);
ALTER TABLE merge_userHistory_accountTransactCenter ADD CONSTRAINT merge_userHistory_accountTransactCenter_userHistory_id FOREIGN KEY (userHistoryId)
REFERENCES userHistory (id)
ON DELETE RESTRICT
ON UPDATE RESTRICT
DEFERRABLE;
ALTER TABLE merge_userHistory_accountTransactCenter ADD CONSTRAINT merge_userHistory_accountTransactCenter_accountTransactCenter_i FOREIGN KEY (accountTransactCenterId)
REFERENCES accountTransactCenter (id)
ON DELETE RESTRICT
ON UPDATE RESTRICT
DEFERRABLE;
If I regenerate all three tables (to the existing list of Entities), userHistory is still not generated. If I generate only AccountTransactCenter and UserHistory, UserHistory is generated and no errors are noted, but the association isn't created.
//bi-directional many-to-many association to UserHistory
@ManyToMany(mappedBy="accountTransactCenters")
private Set<UserHistory> userHistories;
raises the error.
Please let me know if you need any further information.
|
|
|
Goto Forum:
Current Time: Sat Oct 19 14:41:01 GMT 2024
Powered by FUDForum. Page generated in 0.06130 seconds
|