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 192554 - Query fails in two Tutorials
Summary: Query fails in two Tutorials
Status: RESOLVED FIXED
Alias: None
Product: usersguide
Classification: Unclassified
Component: Web tutorials (show other bugs)
Version: 7.0
Hardware: All All
: P3 normal (vote)
Assignee: Kenneth Ganfield
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-26 20:41 UTC by bht
Modified: 2011-05-10 10:20 UTC (History)
1 user (show)

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 bht 2010-11-26 20:41:43 UTC
As described in the feedback page

http://netbeans.org/projects/usersguide/lists/nbdocs_feedback/archive/2010-10/message/44

the following tutorials fail when executing the query "from Film":
http://netbeans.org/kb/docs/java/hibernate-java-se.html
http://netbeans.org/kb/docs/web/hibernate-webapp.html

These excellent tutorials would have surely worked at some stage, and I don't know what is not wrong with them.

My workaround was to replace a property in hibernate.cfg.xml as follows:

    <property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>

replaced with 
    <property name="hibernate.query.factory_class">org.hibernate.hql.ast.ASTQueryTranslatorFactory</property>

There is some more background in bug 192027.
Comment 1 Sergey Petrov 2010-11-29 09:15:20 UTC
Do you have the same issue with downloaded project and one created yourself?
Comment 2 Sergey Petrov 2010-11-29 10:19:32 UTC
Ok, I'm not sure why it can be resolved by transaction factory chnages,
but 'from Film' produce 'select from' as sql with ClassicQueryTranslatorFactory and 'Invalid query' with ASTQueryTranslatorFactory, yes, it's better to recognize query is invalid rather then create wrong query. It's the case for java se sample in latest nb.
What I see here it's just a minor issue and it should be just a better handling from wrong querries with better message (not just 'Invalid query' and especially not empty sql script), at least for me the root reason is in missed mapping for Film, as in the same time query for Actor works fine and if make mapping for Film query will be successful. In your case its' likely you miss mapping creation for Film at some step.
Comment 3 bht 2010-11-29 17:58:31 UTC
Hi Sergey,

It looks like that if a user follows the tutorial step by step, then there is no problem anymore as before. I agree with you on the issue with the error message for a missing mapping.
Comment 4 Kenneth Ganfield 2010-12-06 12:10:52 UTC
The tutorials were modified to state the correct property for people using the tutorial with older versions of the IDE before the values were fixed.
Currently the tutorial says to manually type the correct value.

In the current version of the IDE the property editor now provides the correct value in the dropdown list so with 7.0 there will be no error.

I am leaving this issue open and assigning the issue to myself to update the tutorial for the 7.0 release to clarify that they must manually type the property if they are not using 7.0, but that if they are using 7.0 they can select the property from the dropdown list.
Comment 5 Irina Filippova 2010-12-08 03:13:16 UTC
Assigning to Ken (when Ken wrote his comment, the Reset Assignee to Default checkbox was selected)
Comment 6 Kenneth Ganfield 2011-03-29 16:49:26 UTC
fixed in staged docs
Comment 7 Kenneth Ganfield 2011-05-10 10:20:20 UTC
Marking as fixed. The current versions of the tutorial now has a note about the incorrect property that is generated in 6.9.