6 Replies Latest reply on Mar 10, 2010 6:56 AM by Simon Cigoj

    hql editor porblem with @GenericGenerator

    Simon Cigoj Newbie

      I use generic generator for generating the id-s for my entities defined like this

       


      {code}

      @Id

      @Column(name = "ID_PROJECT", unique = true, nullable = false, scale = 0, insertable = false, updatable = false)

      @GeneratedValue(generator = "seq_id_project",strategy=)

      @GenericGenerator(name = "seq_id_project", strategy = "org.hibernate.id.enhanced.TableGenerator", parameters = { @Parameter(name = "segment_value", value = "SEQ_ID_PROJECT"), @Parameter(name = "initial_value", value = "1000"), @Parameter(name = "optimizer", value = "pooled"), @Parameter(name = "increment_size", value = "10") })

      public long getIdProject() {

           return this.idProject;

      }


      {code}

       

       

      and when I try using the hql editor to test hql I got the folowing error

       

       


      {code}

      org.hibernate.MappingException: could not instantiate id generator

      at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:98)

      at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:152)

      at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:192)

      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)

      at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)

      at org.hibernate.console.ConsoleConfiguration$4.execute(ConsoleConfiguration.java:550)

      at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:63)

      at org.hibernate.console.ConsoleConfiguration.execute(ConsoleConfiguration.java:97)

      at org.hibernate.console.ConsoleConfiguration.buildSessionFactory(ConsoleConfiguration.java:545)

      at org.hibernate.eclipse.console.workbench.LazySessionFactoryAdapter.getChildren(LazySessionFactoryAdapter.java:43)

      at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.getChildren(BasicWorkbenchAdapter.java:100)

      at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:106)

      at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:234)

      at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

      Caused by: java.lang.IllegalArgumentException: alias not found: tbl

      at org.hibernate.sql.ForUpdateFragment.<init>(ForUpdateFragment.java:36)

      at org.hibernate.dialect.Dialect.applyLocksToSql(Dialect.java:970)

      at org.hibernate.id.enhanced.TableGenerator.configure(TableGenerator.java:194)

      at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:94)

      ... 13 more

      {code}

       

       

      maybe some configuration problem? The app works nice with this generator, only the hql editor is porblematic.