Another plea for better error messages
I just wasted two hours trying to debug a simple EJB3 program. Here is the error message that I got:
[java] Caused by: Exception [TOPLINK-7154] (Oracle TopLink Essentials - 10g release 4 (10.1.4.0.0) (Build 051205Dev)): oracle.toplink.essentials.exceptions.ValidationException
[java] Exception Description: The attribute [choices] in entity class [class elvis.entity.Question] has a mappedBy value of [question] which does not exist in its owning entity class [class elvis.entity.Choice]. If the owning entity class is an @EmbeddableSuperclass, this is invalid, and your attribute should reference the correct subclass.
I double-checked everything and even ran the example at https://glassfish.dev.java.net/javaee5/persistence/entity-persistence-su... for comparison (which worked correctly). Finally, I realized that I had made a really stupid mistake.
I forgot the @Entity declaration in the Choice class.
I know that was stupid, but real programmers make stupid mistakes. Wouldn't it be easy to check for this mistake in the ORM layer and give a better error message?