Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!

Bug 136996

Summary: org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <mapping class="org.netbeans.test.entity.Testsuite"/>
Product: javaee Reporter: Jan Horvath <jhorvath>
Component: HibernateAssignee: Vadiraj Deshpande <vadirajvd>
Status: VERIFIED FIXED QA Contact: issues <issues.netbeans.org>
Priority: P1 CC: hmichel
Version: 6.x   
Target Milestone: TBD   
Hardware: All   
OS: All   
URL: http://statistics.netbeans.org/exceptions/detail.do?id=64345
Whiteboard:
Issue Type: DEFECT Exception Report: 64345

Description Jan Horvath 2008-06-11 14:33:25 UTC
I'm not able to run a query on annotated classes.

Build: NetBeans IDE Dev (Build 080611)
VM: Java HotSpot(TM) Client VM, 1.5.0_13-119, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_13-b05-237
OS: Mac OS X, 10.5.3, i386
User comments: ran a query on annotated class
STACKTRACE: (first 10 lines)
org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <mapping class="org.netbeans.test.entity.Testsuite"/>
        at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1600)
        at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1555)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1534)
        at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1508)
        at org.hibernate.cfg.Configuration.configure(Configuration.java:1462)
        at org.netbeans.modules.hibernate.hqleditor.HQLExecutor.execute(HQLExecutor.java:67)
        at org.netbeans.modules.hibernate.hqleditor.HQLEditorController$1.run(HQLEditorController.java:94)
Comment 1 Vadiraj Deshpande 2008-06-13 06:23:57 UTC
AnnotationConfiguration is yet to be supported.
Comment 2 Vadiraj Deshpande 2008-07-17 09:02:55 UTC
Fix : Use AnnotationConfiguration instead of Configuration.
Comment 3 exceptions 2008-07-23 21:46:43 UTC
This issue blocks HQL from using with Annotated classes and should be fixed for Beta
Comment 4 Vadiraj Deshpande 2008-07-26 19:34:16 UTC
Initial fix:
http://hg.netbeans.org/main/rev/46c9d34cf55b
Comment 5 Vadiraj Deshpande 2008-07-28 23:02:39 UTC
*** Issue 141470 has been marked as a duplicate of this issue. ***
Comment 6 Vadiraj Deshpande 2008-08-04 17:08:40 UTC
Fixed (with workaround)
http://hg.netbeans.org/main/log?rev=136996

Comment 7 Jayashri Visvanathan 2008-08-04 19:32:11 UTC
Honza,
  Can you please verify the issue so that we can check into branch. Please also add the keyword once you have verified.
thanks
Comment 8 Jan Horvath 2008-08-05 15:41:52 UTC
I was able to run a query only on fresh project with entity classes generated by rev.eng. from the sample db. 
When I was trying HQL editor on my existing project with entity classes generated by Entity Classes from DB it was no successful. I've got an exception:

org.hibernate.hql.ast.QuerySyntaxException: Testsuite is not mapped [select t from Testsuite t]
	at org.hibernate.hql.ast.util.SessionFactoryHelper.requireClassPersister(SessionFactoryHelper.java:158)
	at org.hibernate.hql.ast.tree.FromElementFactory.addFromElement(FromElementFactory.java:87)
	at org.hibernate.hql.ast.tree.FromClause.addFromElement(FromClause.java:70)
Comment 9 Vadiraj Deshpande 2008-08-08 01:27:13 UTC
That exception is due to the reason of using related Entities in the query.
Now HQL Editor supports related entities (OneToMany, ManyToMany etc...).
http://hg.netbeans.org/main/rev/653397c12bef

Please reverify.
Comment 10 Jan Horvath 2008-08-08 17:02:57 UTC
I was not successful with query on the entity with a relationship.

org.hibernate.AnnotationException: @OneToOne or @ManyToOne on org.netbeans.test.entity.Testsuite.hostname references an unknown entity: 
org.netbeans.test.entity.Hostname
	at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:81)
	at org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:499)
	at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:304)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1286)
	at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
	at org.netbeans.modules.hibernate.hqleditor.HQLEditorController.getHibernateSessionFactoryForThisContext(HQLEditorController.java:187)
	at org.netbeans.modules.hibernate.hqleditor.HQLEditorController.processAndConstructSessionFactory(HQLEditorController.java:275)
	at org.netbeans.modules.hibernate.hqleditor.HQLEditorController$1.run(HQLEditorController.java:112)


Comment 11 Vadiraj Deshpande 2008-08-08 17:52:16 UTC
Honza,
Can you please attach the IDE log also ?
Thnx
Comment 12 Vadiraj Deshpande 2008-08-19 21:01:00 UTC
Fixed remaining issues:
http://hg.netbeans.org/main/rev/a7405dd38963
http://hg.netbeans.org/main/rev/6cf97ed3ff9e
Comment 13 martin_zmrhal 2008-11-24 12:21:22 UTC
Verified

Product Version: NetBeans IDE Dev (Build 200811240201)
Java: 1.6.0_10; Java HotSpot(TM) Client VM 11.0-b15
System: Linux version 2.6.27-7-generic running on i386; UTF-8; en_US (nb)
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo