facebook

[Closed] Errors of id generation in HQL Editor

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

    gladsjr
    Member

    Hi everyone.
    When I try running HQL Editor I got the following error:
    “A session factory for this configuration could not be built, dynamic query translation will be unavailable. Queries cannot be executed.
    Reason: could not instantiate id generator”

    It happens when I try the simple “from Produto” query.

    The hibernate.cfg.xml and the Produto.hbm.xml are following. I used the defaults. The database is a Hypersonic inside the JBoss (it’s running when error occours).

    Can anyone help me please?

    <?xml version=’1.0′ encoding=’UTF-8′?>
    <!DOCTYPE hibernate-configuration PUBLIC
    “-//Hibernate/Hibernate Configuration DTD 3.0//EN”
    http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd”&gt;

    <!– Generated by MyEclipse Hibernate Tools. –>
    <hibernate-configuration>
    <session-factory>
    <property name=”connection.username”>sa</property>
    <property name=”connection.url”>
    jdbc:hsqldb:hsql://localhost:1701
    </property>
    <property name=”dialect”>
    org.hibernate.dialect.HSQLDialect
    </property>
    <property name=”myeclipse.connection.profile”>HSQLDB</property>
    <property name=”connection.driver_class”>
    org.hsqldb.jdbcDriver
    </property>
    <mapping resource=”Produto.hbm.xml” />

    </session-factory>

    </hibernate-configuration>

    <?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”&gt;
    <!–
    Mapping file autogenerated by MyEclipse – Hibernate Tools
    –>
    <hibernate-mapping>
    <class name=”Produto” table=”PRODUTO” schema=”PUBLIC”>
    <id name=”ideProduto” type=”java.lang.Integer”>
    <column name=”IDEPRODUTO” />
    <generator class=”assigned” />
    </id>
    <property name=”nome” type=”java.lang.String”>
    <column name=”NOMEPRODUTO” />
    </property>
    </class>
    </hibernate-mapping>

    #272822 Reply

    Loyal Water
    Member

    Cna you please go through the posting guidelines at the top of the forum and paste all the information here for me. Also, can you go to <workspace>/.metada/.log and paste your error log here as well.

    #272826 Reply

    gladsjr
    Member

    Dear friend.

    I’m really sorry, but I couldn’t find the posting guidelines at the top of the forum as you said. I tried to find it in all pages I found but unsucessfully.

    Can you help me find this?

    Thank you.
    Gladstone.

    #272827 Reply

    gladsjr
    Member

    Ops! I forgot the log:

    !ENTRY com.genuitec.org.hibernate.eclipse.console 4 4 2007-07-17 14:24:00.509
    !MESSAGE could not instantiate id generator
    !STACK 0
    org.hibernate.MappingException: could not instantiate id generator
    at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:97)
    at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:152)
    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:181)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
    at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:270)
    at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
    at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:72)
    at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:265)
    at com.genuitec.eclipse.hibernate.wizards.MEConsoleConfiguration.buildSessionFactory(MEConsoleConfiguration.java:211)
    at com.genuitec.eclipse.hibernate.action.MERefreshCCAction.buildSessionFactory(MERefreshCCAction.java:117)
    at com.genuitec.eclipse.hibernate.action.MEExecuteHQLAction.run(MEExecuteHQLAction.java:52)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:499)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:539)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
    at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:441)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1930)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:422)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
    at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
    at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
    at org.eclipse.core.launcher.Main.run(Main.java:977)
    at org.eclipse.core.launcher.Main.main(Main.java:952)
    Caused by: org.hibernate.MappingException: param named “property” is required for foreign id generation strategy
    at org.hibernate.id.ForeignGenerator.configure(ForeignGenerator.java:82)
    at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:93)
    … 36 more
    !SUBENTRY 1 com.genuitec.org.hibernate.eclipse.console 4 150 2007-07-17 14:24:00.520
    !MESSAGE org.hibernate.MappingException: param named “property” is required for foreign id generation strategy
    !STACK 0
    org.hibernate.MappingException: param named “property” is required for foreign id generation strategy
    at org.hibernate.id.ForeignGenerator.configure(ForeignGenerator.java:82)
    at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:93)
    at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:152)
    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:181)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
    at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:270)
    at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
    at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:72)
    at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:265)
    at com.genuitec.eclipse.hibernate.wizards.MEConsoleConfiguration.buildSessionFactory(MEConsoleConfiguration.java:211)
    at com.genuitec.eclipse.hibernate.action.MERefreshCCAction.buildSessionFactory(MERefreshCCAction.java:117)
    at com.genuitec.eclipse.hibernate.action.MEExecuteHQLAction.run(MEExecuteHQLAction.java:52)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:499)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:539)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
    at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:441)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1930)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:422)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
    at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
    at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
    at org.eclipse.core.launcher.Main.run(Main.java:977)
    at org.eclipse.core.launcher.Main.main(Main.java:952)
    !SUBENTRY 2 com.genuitec.org.hibernate.eclipse.console 4 150 2007-07-17 14:24:00.520
    !MESSAGE org.hibernate.MappingException: param named “property” is required for foreign id generation strategy
    !STACK 0
    org.hibernate.MappingException: param named “property” is required for foreign id generation strategy
    at org.hibernate.id.ForeignGenerator.configure(ForeignGenerator.java:82)
    at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:93)
    at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:152)
    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:181)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
    at org.hibernate.console.ConsoleConfiguration$2.execute(ConsoleConfiguration.java:270)
    at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
    at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:72)
    at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:265)
    at com.genuitec.eclipse.hibernate.wizards.MEConsoleConfiguration.buildSessionFactory(MEConsoleConfiguration.java:211)
    at com.genuitec.eclipse.hibernate.action.MERefreshCCAction.buildSessionFactory(MERefreshCCAction.java:117)
    at com.genuitec.eclipse.hibernate.action.MEExecuteHQLAction.run(MEExecuteHQLAction.java:52)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:499)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:539)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
    at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:441)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1930)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:422)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95)
    at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
    at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
    at org.eclipse.core.launcher.Main.run(Main.java:977)
    at org.eclipse.core.launcher.Main.main(Main.java:952)

    #272830 Reply

    Loyal Water
    Member
    #272901 Reply

    Brian Fernandes
    Moderator

    Gladstone,

    This isn’t really a problem with the HQL Editor, but it’s an issue with the Hibernate configuration. The HQL Editor is attempting to create a hibernate configuration from your project, but is failing due to an error in the Hibernate mapping files or the POJOs.
    The stack trace indicates a missing <param name = “property”…. element under your generator element, but AFAIK this is only required for generator type = “foreign” – according to your source, you are using the assigned strategy. Can you please check this? Also are there any other mapping files involved?

    #272923 Reply

    gladsjr
    Member

    My friend,

    I see that the problem is exactly what you said. I tried again until the beggining and avoided the foreign strategy and everything is ok now.

    Thank you.
    Gladstone.

    #272947 Reply

    Brian Fernandes
    Moderator

    I’m glad it’s working now. Thanks for posting back.

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: [Closed] Errors of id generation in HQL Editor

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