i have a new problem.
i have a domain object called "Lecture", and in the database its called "Lectures"
i want to use hibernate to manage this database stuff so i created the annotations:
the interpreter says:
named queries can be defined only on an entity or a mappedsuperclass class.
i have no idea whats the problem because with @entity i tell hibernate that its a entity, dont i?
ps.: and yes, i used the netbeans "do the magic"-create objects from database sheme ;)
I think that in this case you need to refer to Lecture in your named queries as Lecture because that is the name of the class. You never need to refer to the name of the table anywhere in your code (HQL included) with the exception of the @Table annotation or if you ever do plain sql queries (that is without hibernate).
Try changing your named queries to use the name of the class instead of the name of the table and see if that works.
thats what i tried first ;)
And no, it doesnt resolve the problem.
What's funny, everything works fine... as far as i can say (because the portlet is not finished yet).
Btw. i changed the database fields (from plural to singular) - imo it looks ugly now, but its working...
Thanks for the offer but I think I'll try further with a simple setup and see what I can find. I've put it together in IntelliJ and it's not showing any error messages so I'm going to try reading and writing some data with the queries and see how far I get.
no i can compile and run the portlet fine (no it doesnt run fine, but thats because im absolutly new to hibernate, spring and struts)
the output of the sql querys looks also ok, like:
if you need further informations, just reply maybe its just a netbeans bug?
If it's generating the right sql for you then I think I'd be looking at if it's a problem with netbeans. I did a quick search and found this at Stack Overflow.
No thanks. We have all the government we need. This tiny ad would like you to leave now:
a bit of art, as a gift, that will fit in a stocking