Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] The dreaded "not a known entity type" error

Hi Johnny,

I am not familiar with how the netbeans functionality that generates entities from schema works, but there are a few things you can look for in the persistence unit it generates for you.

1. In the persistence.xml it generates, the class is specifically listed using the <class> element. It will look something like this:

<class>myclass.MyPackage</class>

The reason ensuring the class exists is important is depending on how you deploy your persistence unit, it may or may not be required. In a Java SE deployment, it is required. In Java EE, it is not required, but does no harm.

2. Ensure the involved class an Entity.  To be an Entity it should be either:

  a: Annotated with @Entity

  b: described in an orm.xml file that is referred to by your persistence.xml

3. Check that your persistence.xml is in a directory called META-INF

4. Check that the orm.xml files listed as <mapping-file>s are in the appropriate directories

5. Check that the <jar-file>s in your persistence unit are in the appropriate directories

6. Add the property eclipselink.logging.level=FINEST to your persistence unit and ensure there are no warnings when you deploy

-Tom


jxt wrote:
I'm a new list member. My apologies if this is not the best list for this
message.
If not, please recommend a better place to post.

I use NetBeans to develop web applications using JPA and EclipseLink or,
in the past, TopLink. However, everytime I use JPA with a new NetBeans
project, I always seem to run into  the dreaded "not a known entity type"
error. I usually manage to get around  it one way or another, but nothing
seems to work consistently. You can search the NetBeans user list, or
Google,
and find several people asking the same question, but no consistent answer
appears.
Two days ago I fixed the problem by switching to Glassfish v2 from v3. NO
OTHER CHANGE! Just switching Glassfish versions. Yesterday, on an expanded version of that same project, I'm getting the error in both GF v2 and v3! ARGHH!!!
The entity class in question, and all the others, were generated by NetBeans
from the database schema, so they certainly should be valid entity classes.

Any suggestions? Thanks, Johnny Tolliver


Back to the top