0

I created a new entity class, and added it to the persistence.xml file.

<class>xxx.xxx.xxx.xxx.xxx.Restaurants</class>

When trying to build in Maven, I get this error:

Caused by: java.lang.IllegalArgumentException: Object: Restaurants{id=null, name=Subway} is not a known entity type.

How is this caused and how can I solve it? There are no problems with the other entity classes, but just this one.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
CJR
  • 3,174
  • 6
  • 34
  • 78
  • Is it annotated as an entity? Are you using Maven profiles for the build? – hermitmaster Oct 11 '15 at 16:01
  • @hermitmaster Yes, I have added ´Entity´ to the class. I'm not sure what you mean by "Maven profiles" ? Please, can you explain? – CJR Oct 11 '15 at 16:03
  • ´@Entity´ but couldnt use the at sign in the comment above and tag you at the same time. – CJR Oct 11 '15 at 16:04
  • In some of our applications we use Maven build profiles that use different persistence.xml files for testing, production, etc. http://maven.apache.org/guides/introduction/introduction-to-profiles.html – hermitmaster Oct 11 '15 at 16:06
  • @hermitmaster Thank you! I had added the new entity class to the "persistence.xml" file but forgot to add it to the "test-persistence.xml" file, and thus why I got error while testing. Thank you, and please "answer my question" with what you commented earlier, so I can accept it and you can earn points. – CJR Oct 15 '15 at 14:59

1 Answers1

0

In some of our applications we use Maven build profiles that use different persistence.xml files for testing, production, etc. http://maven.apache.org/guides/introduction/introduction-to-profiles.html

hermitmaster
  • 155
  • 1
  • 10