2

I've generated my metamodels correctly as seen below. They do not import the actual entity class therefore I get the " cannot be resolved to a type" compiler error.

package dummy.package;

import javax.annotation.Generated;
import javax.persistence.metamodel.StaticMetamodel;

@Generated(value = "org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor")
@StaticMetamodel(MyClass.class)
public abstract class MyClass_ {

}

as you can see, the class used in the @StaticMetamodel annotation isn't imported

My assumptions and questions are:

1) Assumption: Both classes have the same package structure, so i'm assuming that we won't need to import the class (both declared under "dummy.package") But why do I get the error?

2) The metamodel is actually under "annotations.dummy.package" even though the file says "dummy.package", that's a different error (does not match the expected package) Can this be the reason for issue #1 above?

Joe
  • 181
  • 11
  • 1
    You don't need any import since they are in the same package. Why you get the error is likely because your classpath is configured wrong. The package root of the original class and the package root of the generated class should be passed to the compiler, so maybe this "annotations." is what is fscked up. Your build system is where you find the answer to that –  Oct 04 '17 at 15:26
  • @DN1 , Thanks for the sanity check. I'll try to figure out why it's getting repackaged under "annotations". – Joe Oct 04 '17 at 17:09
  • any success on this. I can see what your are trying to do. I am getting the same thing in eclipse IDE. Even I added the jpa and hibernate metamodal jars. – 0o'-Varun-'o0 Oct 14 '17 at 18:00
  • I havent dug any further @0o'-Varun-'o0 , sorry I'll keep you posted when I do. – Joe Oct 16 '17 at 17:50
  • Hi @Joe I have successfully created the metamodel class, But I ended up discrediting that idea for database searches. Instead I just started used Lucene for searches and more functionality. – 0o'-Varun-'o0 Oct 24 '17 at 13:10
  • Hey @0o'-Varun-'o0 , that's good to hear. So how'd you resolve this isuue If I may ask? – Joe Oct 25 '17 at 13:49

0 Answers0