Skip to main content

JPA queries and properties

1 reply [Last post]
Joined: 2003-08-04

Perhaps this is simple pilot error and this is addressed somewhere in the specification, but I thought I'd put it out there.

I got burned by defining a query like this:
select, x.displayName from Foo x

...where Foo had an ID property defined like this:

  @Id<br />
  @Basic(fetch=FetchType.EAGER, optional=false)<br />
  @GeneratedValue(strategy=GenerationType.IDENTITY)<br />
  @Column(name="FooID", nullable=false, updatable=false, scale=0)<br />
  protected long getID() {<br />
    return;<br />
<p>  protected void setID(final long id) {<br /> = id;<br />

I rewrote the query to be:
select x.ID, x.displayName from Foo x

...and that didn't work either. The only one that worked was:
select x.iD, x.displayName from Foo x

Shouldn't the property introspection mechanism in JPA--which is not JavaBeans compliant, but is certainly inspired by JavaBeans--do the same sort of decapitalization behavior as Beans.decapitalize()? Is this a Toplink bug, or a feature?


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2005-07-06


Looks like a bug. But 234222 has been filed for the issue in EclipseLink ( if you want to reference it or add anything that I might have missed. EclipseLink will be the RI for JPA2.0 and will be the default JPA provider in glassfish going forward.

Best regards,