Hello. I am facing a huge problem now. I want to  "SELECT a FROM  AClass a 
WHERE a.object.attribute". I am always catching this exception: Can only 
reference properties of a sub-object if the sub-object is embedded.

I do not know what to do. Here are my classes:

@Entity
@Table(name = "annotation")
public class Annotation implements Serializable, IsSerializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Key id;
    private String bookId;
    private Integer pageNumber;
    
    @Basic
    @ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY)
    private AnnotationType annotationType;


// setters and getters

@Entity
@Table(name = "annotation_type")
public class AnnotationType implements Serializable, IsSerializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Key id;
    @Basic
    private String name;
    @Basic
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "annotationType")
    private ArrayList<Annotation> annotations;

//setters and getters

            String sql = "SELECT a FROM Annotation a WHERE 
a.annotationTypeName='" + annotationType2.getName() + "'";
            annotations2 = (List<Annotation>) 
entityManager.createQuery(sql).getResultList();

exception: Can only reference properties of a sub-object if the sub-object 
is embedded.

Thank you a lot.

Kido.


-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to