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 245115 - Problem with Hibernate HQL editor
Summary: Problem with Hibernate HQL editor
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: Hibernate (show other bugs)
Version: 8.0.1
Hardware: PC Windows 8
: P3 normal (vote)
Assignee: Sergey Petrov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-18 04:17 UTC by jdbaltazar
Modified: 2016-07-07 08:54 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jdbaltazar 2014-06-18 04:17:22 UTC
Hi.

I am new in JAVA world.  And I am using this site "https://netbeans.org/kb/docs/java/hibernate-java-se.html" as my guide.

Anyway, I am using NetBean 8.0 and MySQL ver 5.1.73

Then, after following the procedures, I am now testing my hibernate -> HQL
Unfortunately, got an error:

javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
	at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:350)
	at javax.naming.InitialContext.bind(InitialContext.java:425)


And here is my Hibernate.xml:
<?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">
<hibernate-configuration>
  <session-factory name="session1">
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/laptopinv?zeroDateTimeBehavior=convertToNull</property>
    <property name="hibernate.connection.username">laptopinvuser</property>
    <property name="hibernate.connection.password">P@ssw0rd</property>
    <property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
    <property name="hibernate.show_sql">true</property>
    <mapping resource="sentinel/Entity/Employees.hbm.xml"/>
    <mapping resource="sentinel/Entity/Access.hbm.xml"/>
    <mapping resource="sentinel/Entity/Laptop.hbm.xml"/>
    <mapping resource="sentinel/Entity/Department.hbm.xml"/>
    <mapping resource="sentinel/Entity/Users.hbm.xml"/>
    <mapping resource="sentinel/Entity/Position.hbm.xml"/>
    <mapping resource="sentinel/Entity/Guardonduty.hbm.xml"/>
    <mapping resource="sentinel/Entity/Webaccess.hbm.xml"/>
  </session-factory>
</hibernate-configuration>

Anything I missed from the tutorial?  Please help.

Thanks in advance.
Comment 1 Sergey Petrov 2014-07-30 09:18:47 UTC
Did you follow the tutorial step by step?
As it's marked as valid for 8.0, I suppose tutorial author tried this one, as I know another tutorial which doesn't work in 8.0 (but should work in 8.0.1)
Comment 2 Martin Balin 2016-07-07 08:54:59 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss