openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phill Moran" <pjmo...@rogers.com>
Subject RE: Named query created in error
Date Thu, 19 Apr 2007 14:37:36 GMT
Thanks Jacek,

Store is annotated with @Entity:

@Entity
@Table(name = "manufacturer", schema = "bidspec")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@NamedQueries( {
		@NamedQuery(name = "StoreFXPK", query = "SELECT s FROM Store s
WHERE s.id = :primaryKey"),
		@NamedQuery(name = "StoreFXTypeAndName", query = "SELECT s FROM
Store s WHERE s.type = :type AND UPPER(s.name) = :storeName OR
UPPER(s.displayName) = :storeName"),
		@NamedQuery(name = "StoreFXName", query = "SELECT s FROM Store s
WHERE UPPER(s.name) = :storeName OR UPPER(s.displayName) = :storeName") })
public class Store extends Persistable {
....

I thought I needed to add the class names to persistence.xml to have them
post-processed. I recognized (since using java agent right now) they are all
looked at for persistence candidacy but figured this would be needed for compile
time processing that I would switch to later. Let me know if I am way off here.
Also must I list all other classes in the <exclude-unlisted-classes> section or
can I simply list add <exclude-unlisted-classes/> after my listed classes. -
Clearly I am uncertain to the full purpose of this file

Thanks for all this support

Phill

-----Original Message-----
From: eljotpl@gmail.com [mailto:eljotpl@gmail.com] On Behalf Of Jacek Laskowski
Sent: April 19, 2007 10:15 AM
To: open-jpa-dev@incubator.apache.org
Subject: Re: Named query created in error

On 4/19/07, Phill Moran <pjmoran@rogers.com> wrote:
> I am using MySQL version 5
> The stack trace only shows because  have wrapped this in a try/catch. 
> The exception becomes NPE due to  OpenJPA trying to make a Person 
> object form more than just Person Object data, it fails to do this 
> (silently) and the object it was to be assigned to become an NP

Could you make sure that the entity behind p.store is really an entity? Is it
annotated with @Entity?

> Nothing in the persistence.xml except class names (all persistable 
> classes represented in here) and OpenJPA settings.
> Interesting questions on why the duplicate query exception suddenly 
> showing up,

It's because you use <class> and no <exclude-unlisted-classes> in
persistence.xml. You should either remove the <class> elements or add
<exclude-unlisted-classes> and the Ignoring. warning message should go away.

Jacek

--
Jacek Laskowski
http://www.JacekLaskowski.pl


Mime
View raw message