"Class isn't an entity" with JPA.

Hi!
I'm working on a little project using JPA.
I have "Class isn't an entity" errors on all my queries. How does Idea
verifiy this?
Important note: my project runs and works so JPA finds these entities.

Thanks for your help!

BoD

5 comments

Hello BoD,

Entities are defined by @Entity annotation, tag of an orm.xml referenced in some persistence unit, ]]> tags of an hbm.xml.

The simplest way to see if IDEA recognizes a class as entity is to check
if it is in the "Java EE structure" view.

Regards,
Gregory Shrago

BoD wrote:

Hi! I'm working on a little project using JPA. I have "Class isn't an
entity" errors on all my queries. How does Idea verifiy this?
Important note: my project runs and works so JPA finds these
entities.

Thanks for your help!

BoD

0

My entities have the @Entity annotation.
Where is the "Java EE structure" view? Do I need to add a JavaEE
Application facet?

Thanks!

BoD


Gregory Shrago (JetBrains) wrote:

Hello BoD,

Entities are defined by @Entity annotation, <entity> tag of an orm.xml
referenced in some persistence unit, <sub/class> tags of an hbm.xml.

The simplest way to see if IDEA recognizes a class as entity is to check
if it is in the "Java EE structure" view.

Regards,
Gregory Shrago

BoD wrote:

>> Hi! I'm working on a little project using JPA. I have "Class isn't an
>> entity" errors on all my queries. How does Idea verifiy this?
>> Important note: my project runs and works so JPA finds these
>> entities.
>>
>> Thanks for your help!
>>
>> BoD

0

If you have JPA facet it should be visible in "JavaEE Structure" view
(Project View/View As->"Java EE: Structure").

Try adding your persistence.xml as descriptor in JPA facet properties.

BoD wrote:

My entities have the @Entity annotation. Where is the "Java EE
structure" view? Do I need to add a JavaEE Application facet?

Thanks!

BoD


Gregory Shrago (JetBrains) wrote:

>> Hello BoD,
>>
>> Entities are defined by @Entity annotation, tag of an >> orm.xml referenced in some persistence unit, tags of an >> hbm.xml. >> >> The simplest way to see if IDEA recognizes a class as entity is to >> check if it is in the "Java EE structure" view. >> >> Regards, Gregory Shrago >> >> BoD wrote: >>> Hi! I'm working on a little project using JPA. I have "Class >>> isn't an entity" errors on all my queries. How does Idea verifiy >>> this? Important note: my project runs and works so JPA finds >>> these entities. >>> >>> Thanks for your help! >>> >>>]]> BoD

0

The persistence.xml was already declared there but I removed it and then
added it again, and now it works fine :)
Thanks!

BoD



Gregory Shrago (JetBrains) wrote:

If you have JPA facet it should be visible in "JavaEE Structure" view
(Project View/View As->"Java EE: Structure").

Try adding your persistence.xml as descriptor in JPA facet properties.

BoD wrote:

>> My entities have the @Entity annotation. Where is the "Java EE
>> structure" view? Do I need to add a JavaEE Application facet?
>>
>> Thanks!
>>
>> BoD
>>
>>
>> Gregory Shrago (JetBrains) wrote:
>>> Hello BoD,
>>>
>>> Entities are defined by @Entity annotation, tag of an >>> orm.xml referenced in some persistence unit, tags of an >>> hbm.xml. >>> >>> The simplest way to see if IDEA recognizes a class as entity is to >>> check if it is in the "Java EE structure" view. >>> >>> Regards, Gregory Shrago >>> >>> BoD wrote: >>>> Hi! I'm working on a little project using JPA. I have "Class >>>> isn't an entity" errors on all my queries. How does Idea verifiy >>>> this? Important note: my project runs and works so JPA finds >>>> these entities. >>>> >>>> Thanks for your help! >>>> >>>>]]> BoD

0

I'm seeing this error with IntelliJ 8.1 with an existing project where it did not happen before.

0

Please sign in to leave a comment.