Forums Register Login

java.lang.IllegalArgumentException: Unknown entity

+Pie Number of slices to send: Send
hey there


I don't know if it's the right place to ask, if not... feel free to move the thread ;)
well, I`m using seam 2 with hibernate, ejb3, richfaces, ibm websphere and Rational Software Architect as my IDE (based on eclipse) and I tried to test my persistence entity packages, which are all located in an extra project.
I've created a new project with testng, which just should contain test-classes, who are referencing the entity classes in the persistence project, initiate them and run the tests... but it seems, it's not that easy. I added the imports in the test-classes to the entities in the persistence-project and all seems normal, no errors. I wrote a test, which just initiates the persistence entity, persist it to the oracle db, reads them out trough the entitiy-manager by using "find()" and remove the entity again from the db.
And here comes the error: at the point, where the entitiy-manager tries to persist the entity, I get the following error:



It seems like the application finds the class, otherwise the import wouldn't have worked, but when it tries to persist, it doesn't have the mapping, doesn't have the class in the runtime classpath or whatever. Maybe it's because there is a persistence.xml in the entity-package and an extra persistence.xml in the testng-project?

here's the persistence.xml from the testng-proect. I also tried to publish the class by adding the "<class>"-tag to the xml-file, but it cannot resolve the name? weird...




and the persistence.xml from the entity-project:



any suggestions? ;)
+Pie Number of slices to send: Send
i changed some project-dependencies and added the required class by using the "class"-tag in the persistence.xml. it works that way, my tests run without any errors, but isn't there a more sophisticated way available for adding entities? I don't want to add hundreds of classes to the xml-file just because I want to reach them through my tests
+Pie Number of slices to send: Send
anyone? there has to be a way to scan a path for entities....
He repaced his skull with glass. So you can see his brain. Kinda like this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 12420 times.
Similar Threads
Problem with Mapping between 1 bit column and boolean field
A question about "persistence.xml" by Weblogic
EclipseLink1.1 inserts no data..
Could not resolve a persistence unit corresponding to the persistence-context-ref-name
Jboss Error
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 17:42:29.