I recently F-ed up my JPA entites and I am trying desperately to get that functionality back. After adding some default queries to my my entities I can't call them in my session bean... I am getting this exception
There is no query with the name "" defined for any of the known persistent classes:
While the said named query does exist it is simply an annotation to a the persistence class (or entity bean). Do I need to add that to the ORM.xml file? I seem to remember that you could annotations to the ORM.xml file or you could directly annotate the entity bean. am I missing a step here?
thanks.
UPDATE: Actual Named queries:
import javax.persistence.Table;
import javax.persistence.NamedQuery;
import javax.persistence.NamedQueries;
@Entity
@Table(name="EMAIL_DOMAIN_TRUST")
@NamedQueries({
@NamedQuery(name="getEmailDomainTrust", query = "SELECT e FROM EmailDomainTrust e"),
...
})
Here is where I call it in my stateless session bean
public List<EmailDomainTrust> getEmailDomains() {
List listOfEmailDomains = null;
//try
//{
System.out.println("Testing 1..2...3...!");
listOfEmailDomains = emf.createNamedQuery("getEmailDomainTrust").getResultList();
System.out.println(listOfEmailDomains.size());
//}
//catch(Exception e)
//{
//System.out.println("Sugar Cookies! This thing doesn't work");
//}
// while(it)
return listOfEmailDomains;
}
Do not know why it can't seem to find it? I am working in Websphere integration developer btw. Maybe something isn't updating correctly?
Thanks guys. I was being an idiot and not building my project.