On 15 March 2010 07:52, Richard Kolb <rjdkolb_at_gmail.com> wrote:
> Hello.
>
> I am trying to get MetaModel classes working.
> But I keep on getting syntax errors on the last line
> (Name can't be resolved)
>
> Is this an issue ?
> Or is it not implemented ?
>
> I tried NetBeans 6.8 and Eclipse 3.5
>
> I know I can use pet.get("name") instead.
>
> thanks
> Richard.
>
> CriteriaQuery<String> cq = cb.createQuery(String.class);
> Metamodel m = em.getMetamodel();
> EntityType<Pet> Pet_ = m.entity(Pet.class);
>
> Root<Pet> pet = cq.from(Pet.class);
> cq.select(pet.get(Pet_.name));
>
>
If I comment out : EntityType<Pet> Pet_ = m.entity(Pet.class);
And create the following class, it works.
@StaticMetamodel(Pet.class)
public class Pet_ {
public static volatile SingularAttribute<Pet, Long> id;
public static volatile SingularAttribute<Pet, String> name;
public static volatile SingularAttribute<Pet, String> color;
public static volatile SetAttribute<Pet, Person> owners;
}
So should I create all these classes manually ?
Or should 'EntityType<Pet>' do this for me ?