| Author |
@NamedQuery : does it have to be declared on an @Entity ?
|
Sol Mayer-Orn
Ranch Hand
Joined: Nov 13, 2002
Posts: 310
|
|
I'm new to ejb, and trying to use @NamedQuery. When you declare @NamedQuery (using annotations, not XML), do you have to declare it on an @Entity class ? I mean: I couldn't get the second example to work. I even tried declaring the NotEntityClass in persistence.xml, but it didn't work - maybe I did it wrong ? <class>somePackage.NotAnEntity<class> Is there some way to make it work ? Thank you. [ October 03, 2007: Message edited by: Sol Mayer-Orn ]
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26201
|
|
Sol, @NamedQuery does need to be declared on an @Entity class. As you noted, the alternative is to put it in XML. As I recall, it goes in the orm.xml file. For example:
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
 |
|
|
subject: @NamedQuery : does it have to be declared on an @Entity ?
|
|
|