Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Find by property name failed (unknown state or association field)

The metadata processing finds the annotation on the property and then determines the default property name by removing the 'get' and using a lowercase value of the first character. This follows from the standard where a salary attribute would have getSalary access method. If you want to use DParentId in your JPQL, try putting all your annotations on the fields instead. This will cause them to be used as they are defined.

Best Regards,
Chris

Mark Horstmeier wrote:
Perfect.  That's what happens when you subcontract out to a wizard.

Is that mapping defined in metadata somewhere or is this the default
behavior for the Query engine?



-----Original Message-----
From: christopher delahunt [mailto:christopher.delahunt@xxxxxxxxxx] Sent: Friday, April 24, 2009 7:20 AM
To: EclipseLink User Discussions
Subject: Re: [eclipselink-users] Find by property name failed (unknown state
or association field)

Because getDParent might be using an attribute name of dParent, have you tried using "select model from SCfBusy model where model.dParentId= :propertyValue"?

Best Regards,
Chris

Mark Horstmeier wrote:
Here is the error:

--

Caused by: Exception [EclipseLink-8030] (Eclipse Persistence Services - 1.0.2 (Build 20081024)): _org.eclipse.persistence.exceptions.JPQLException_

Exception Description: Error compiling the query [select model from SCfBusy model where model.DParentId= :propertyValue], line 1, column 44: unknown state or association field [DParentId] of class [xxx.xxx.xxx.feature.standard.SCfBusy].

at
org.eclipse.persistence.exceptions.JPQLException.unknownAttribute(_JPQLExcep
tion.java:450_)
at
org.eclipse.persistence.internal.jpa.parsing.DotNode.validate(_DotNode.java:
77_)
--

My database is SQL Server and the table is defined as follows:

--

create table "xxxx"."dbo"."s_cf_busy"(

"data_id" int identity not null,

"crid" int not null,

"d_custid" int not null,

"d_active" char(1) not null,

"timestamp" timestamp null,

"busy" varchar(254) null,

"d_struct_id" int null,

"d_parent_id" int null,

"d_parent_type" int null,

"enable" varchar(50) null,

constraint "PK_s_cf_busy" primary key ("data_id")

)

go

create unique index "PK_s_cf_busy" on "xxxx"."dbo"."s_cf_busy"("data_id")

go

create unique index "s_cf_busy_id" on "xxxx"."dbo"."s_cf_busy"("data_id")

go

create index "s_cf_busy_crid" on "xxxx"."dbo"."s_cf_busy"("crid")

go

--

The bean has:

--

@Entity

@Table(name = "s_cf_busy", schema = "dbo", catalog = "xxxx")

*public* *class* _SCfBusy_ *implements* java.io.Serializable {

.

@Column(name = "d_parent_id")

*public* Integer getDParentId() {

*return* *this*.DParentId;

}

--

FYI: findAll() works so I try

--

List<SCfBusy> l = dao.findAll();

Iterator< SCfBusy > iter = l.iterator();

*while* (iter.hasNext()) {

*if* (sbusy.getDParentId()==*null*)

*continue*;

SCfBusy sbusy = iter.next();

*if* (sbusy.getDParentId().compareTo( id)==0)

features.add(sbusy);

}

--

For obvious reasons, I would prefer to not have to resort to this workaround.

------------------------------------------------------------------------

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top