This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 148260

Summary: Not able to run HQL query
Product: javaee Reporter: Jan Horvath <jhorvath>
Component: HibernateAssignee: Vadiraj Deshpande <vadirajvd>
Status: VERIFIED FIXED    
Severity: blocker CC: kganfield
Priority: P2 Keywords: REGRESSION
Version: 6.x   
Hardware: All   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 253164    
Attachments: cfg
log
testing project

Description Jan Horvath 2008-09-24 16:20:13 UTC
Product Version: NetBeans IDE Dev (Build 200809241401)
Java: 1.5.0_13; Java HotSpot(TM) Client VM 1.5.0_13-119
System: Mac OS X version 10.5.5 running on i386; MacRoman; en_EN (nb)

-create a new web application
-generate POJOs from oracle database
-run HQL query 'from Division'
-ERROR:
org.hibernate.MappingException: Association references unmapped class: pojo.Employee
	at org.hibernate.cfg.HbmBinder.bindCollectionSecondPass(HbmBinder.java:2380)
	at org.hibernate.cfg.HbmBinder$CollectionSecondPass.secondPass(HbmBinder.java:2662)
	at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:43)
	at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1130)
	at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:324)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1286)
	at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)

It is strange because the Employee class is mapped in the cfg.
Comment 1 Jan Horvath 2008-09-24 16:20:58 UTC
Created attachment 70491 [details]
cfg
Comment 2 Jan Horvath 2008-09-24 16:21:50 UTC
Created attachment 70492 [details]
log
Comment 3 Jan Horvath 2008-09-24 16:25:26 UTC
I've reproduced similar behavior with MySQL as well
Comment 4 Jan Horvath 2008-09-25 09:42:46 UTC
It is issue is not connected to any particular database or jdbc driver. POJOs are generated correctly.
Looks like a regression, reproduced with the schema which used to work in previous builds.
Comment 5 Jan Horvath 2008-09-25 09:44:01 UTC
Created attachment 70551 [details]
testing project
Comment 6 Kenneth Ganfield 2008-10-02 16:13:42 UTC
I am running into something similar, but different exception.

1. Create web app
2. generate pojos + mapping files from sakila/MySQL db
3. run HQL query 'from Film'

The following error is displayed in the HQL query results window:
org.hibernate.DuplicateMappingException: Duplicate collection role mapping dvdrental.Language.filmsForOriginalLanguageId
	at org.hibernate.cfg.Mappings.addCollection(Mappings.java:124)
	at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2066)
	at org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2041)
	at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:359)
	at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:273)
	at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:144)
	at org.hibernate.cfg.Configuration.add(Configuration.java:669)
	at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:519)
	at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:286)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1286)
	at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
Comment 7 Vadiraj Deshpande 2008-10-07 20:05:41 UTC
Fixed : http://hg.netbeans.org/main/rev/ec686a6c2726

The issue with mapping processing for HQL execution is now solved.
Comment 8 Martin Fousek 2008-10-13 09:56:09 UTC
Verified in NetBeans IDE Dev (Build 200810111401) with JDBC and MySQL databases.