Correct NamedQuery is marked as error

Hi,

I have got a JPA entity defined like this:

@Entity
@NamedQuery(name="SEARCH_ALL_OWNER", query="SELECT o FROM Owner o")
public class Owner {

    // ...

}

The word "Owner" in the named query is marked red and the error message is "Can't resolve symbol Owner".
Is this a bug or do I have to switch off Persistence QL queries inspection?

I'm using Idea 12 Ultimate 123.94.

0

Entity resolution successful if JPA or Hibernate facet is properly configured in Project Structure dialog.
You may verify the list of discovered entities in Persistence tool window.

We may need to add "Configure JPA or Hibernate facet" quick fix and/or suppress this inspection if there's no facet.
Please file a ticket for this in http://youtrack.jetbrains.com

0

Hi Gregory,

I added the JPA facet with Hibernate default provider. The NamedQuery error is gone now.
But now I have errors with the @Column annotation. In the example below I get "Cannot resolve symbol creation_date".

@Temporal(TemporalType.TIMESTAMP)
@Column(name = "creation_date")
private Calendar creationDate;


If I change the column name to creationDate the error does not go away. Do I have to configure a datasource to get rid of this one?

0

Okay, I added a datasource and the errors were gone. Everything fine now.

For the previous problem I'll file an improvement for Idea in Youtrack as you proposed.

Here's the issue: http://youtrack.jetbrains.com/issue/IDEA-98652

0

请先登录再写评论。