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.
I have this code (fragment of the complete file): @NamedQueries({ @NamedQuery(name = "deleteAll", query = "DELETE FROM Wine"), @NamedQuery(name = "findByType", query = "SELECT w FROM Wine w WHERE w.type = :type AND w.bottles > 0 " + "ORDER BY w.winery, w.vintage, w.wine"), @NamedQuery(name = "findAllByType", query = "SELECT w FROM Wine w WHERE w.type = :type " + "ORDER BY w.winery, w.vintage, w.wine"), @NamedQuery(name = "findTypes", query = "SELECT DISTINCT w.type FROM Wine w") }) @Entity @IdClass(Wine.WineKey.class) public class Wine implements Comparable<Wine>, Cloneable { On that last line above the editor shows an error marker and the popup says Named queries can only be defined on an Entity or MappedSuperclass class. Only Entity or MappedSuperclass can use IdClass. Surround with ... The first and second errors seem wrong, my class clearly *is* an Entity. I have no idea what it wants to surround with what. I'm using NetBeans 6.8beta.
can you provide complete/compilable code for your entity as attachment and reopen the issue? I just tried to put your code in my entity and don't see the issue, but have other items like "should implement serializable" etc. may be some new lines make sense or wrong imports etc to reproduce the issue.
Code provided offline.
not sure if it was fixed later or some steps are missed. still can't reproduce the issue. on ubuntu+1.6.14. just opened provided project and see no reported issue I see only "serializable" warning and "entity should be top level class" error. can you try to rename your nb home temporary and open the project with fresh one, and try to open the project with one of the latest builds?
I'm sorry, you want me to try yet a newer version of NetBeans? I get so tired of downloading the latest version, reporting a bug, and then being told to download an even newer version. Have *you* tried to reproduce the bug with NetBeans 6.8beta? If it doesn't reproduce for you using the same version I'm using, then obviously something else is wrong. Let's figure out what the difference is between our environments first.
ok, will try with beta to see if it was reproducible on my system and may be was fixed later.
finally I have some time but can't download beta now, not sure what may happened in this case, I saw the same issue on another system once, and never on my, it looks like something may be broken with nb installation/initialization/home dir etc in this case, if the issue will be reproducible message.log from nb home may help as it may contain some exception and or additional information(like enabled modules, classpath etc), feel free to reopen the issue if it's still valid.
I was experiencing this with two classes that were created with the "New, Entity classes from database" option. The problem went away after deleting my var/cache/index folder. v6.9.1
I too had the same problem in v7.2.1. It went away after re-installing NetBeans.
I resolved it, by deleting C:\Documents and Settings\%username%\My Documents\Application Data\NetBeans\7.3.1\var\filehistory folder.
may mean, parsing fails sometimes to actual data, but existence of workaround is good
Sounds like someone needs to figure out why these cache/index/whatever files get out of sync with reality. Maybe NetBeans needs a "consistency checker" for these files, and a button to rebuild the files and fix any errors?
I must admit, that in some cases, deleting "~\Application Data\NetBeans\7.3.1\var\filehistory" doesn't work. Today I had once more this problem, so I deleted entire "~\Application Data\NetBeans" folder, so now I don't have this "Named queries can only be defined on an Entity or MappedSuperclass class" issue. This issues escalated maybe few days ago, and everything new I've done since than, is that the project I work with, the most of the day I work on my work laptop, and those three times, in order to continue to do at home, I exported project as a zip, and then, I worked at home. So the next day, I exported a project from my home computer, and imported on laptop at work. Maybe this made this problems by broking files and settings...