You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Rick Curtis <cu...@gmail.com> on 2012/04/02 20:52:08 UTC

Re: Id field being named "id" despite the @column tag

Santiago --

> shouldnt the sql be SELECT t0.name, bla bla bla FROM Domain t0 ??
As it has been answered numerous times before, you can't have a final
method. Please, remove final.

I believe the reason that OpenJPA is trying to query t0.id is that we're
using a Datastore identity[1] because as far as the runtime is concerned,
you don't have an ID annotated.

Thanks,

[1]
http://openjpa.apache.org/builds/latest/docs/docbook/manual.html#ref_guide_pc_oid_datastore

On Wed, Mar 28, 2012 at 11:32 AM, Santiago García Pimentel R.G. <
santiagozky@gmail.com> wrote:

> Hello,
>
> I am using openjpa 2.2.0
> I have an entity with a string primary key called name.
>
> @Entity
> @Table(name = "Domain")
> public class Domain implements java.io.Serializable, Comparable<Domain> {
>
> ....
> ....
> @Id
>        @Column(name = "name")
>        public final String getName() {
>                return this.name;
>        }
>
> }
> Still, when I see the generated sql I see this:
>  Unknown column 't0.id' in 'field list' {prepstmnt 616432710
>  SELECT t0.id, bla bla bla bla FROM Domain t0} [code=1054, state=42S22]
>
> shouldnt the sql be SELECT t0.name, bla bla bla FROM Domain t0 ??
>
> in case it matters, the classes are enhanced using the maven plugin.
>
> Greetings
>
> Santiago García Pimentel R.G
> santiagozky@gmail.com
>



-- 
*Rick Curtis*