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 154000 - NPE while running HQL Query
Summary: NPE while running HQL Query
Status: RESOLVED DUPLICATE of bug 159417
Alias: None
Product: javaee
Classification: Unclassified
Component: Hibernate (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Sergey Petrov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-27 10:34 UTC by Vadiraj Deshpande
Modified: 2013-07-16 12:06 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log. Started IDE, invoked HQL editor, issued HQL command - got error. (1.07 MB, text/plain)
2008-12-05 17:29 UTC, killerhippie
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vadiraj Deshpande 2008-11-27 10:34:02 UTC
NetBeans 6.5 IDE. 

Steps :
- Create a valid hibernate.cfg.xml file.
- Right click on the cfg file to invoke HQL Editor.
- Type the query and click 'Run HQL query'.
- Exception appears.

java.lang.NullPointerException
       at java.util.Hashtable.put(Hashtable.java:396)
       at java.util.Properties.setProperty(Properties.java:128)
       at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
       at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
       at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
       at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859)
Comment 1 Vadiraj Deshpande 2008-11-27 10:36:46 UTC
Will be taking up this in 7.0
Comment 2 killerhippie 2008-12-05 17:29:59 UTC
Created attachment 74626 [details]
IDE log. Started IDE, invoked HQL editor, issued HQL command - got error.
Comment 3 killerhippie 2008-12-05 17:39:14 UTC
In the meantime, I sorted out that funcion or non-function depends on the way the underlying database is accessed.

For my application, I use following data-provider based configuration which causes the malfunction described while the
application always runs fine with it:

(excpert from hibernate.cfg.xml)

----- schnipp -----
<property name="connection.driver_class">org.postgresql.Driver</property>
<property name="connection.datasource">java:comp/env/jdbc/XXmyDatabaseReferenceXXX</property>
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="show_sql">false</property>
----- schnapp -----

However, the HQL editor works using this JDBC based configuration:

----- schnipp -----
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/XXmyDatabaseXX</property>
<property name="hibernate.connection.username">my_username</property>
<property name="hibernate.connection.password">my_password</property>
----- schnapp -----

regards, V.
Comment 4 Vadiraj Deshpande 2008-12-06 00:34:46 UTC
Thank you, now it really helps..
Comment 5 Sergey Petrov 2011-11-16 03:25:38 UTC
There is no datasources support on nb side for hibernate support so far, either should be implemented or some message should be provided instead of exception.
Comment 6 Marian Mirilovic 2013-07-16 12:06:04 UTC

*** This bug has been marked as a duplicate of bug 159417 ***