I am having this super irritating issue with my hibernate/jpa app I'm developing using maven and editing in eclipse.
I have my target/metamodel location set up in Properties > compiler > annotation processing, and it's all working fine, except for one class, where the metamodel class only contains the id.
Here is the entity:
@Entity
public class User {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
private String username;
private String password;
@Transient
private Authorization authorization;
// getters/setters omitted, but I do have them in the entity class
}
and here is the metamodel class
@Generated(value="Dali", date="2019-06-22T11:49:45.797-0400")
@StaticMetamodel(User.class)
public class User_ {
public static volatile SingularAttribute<User, Integer> id;
}
This issue only occurs in the User class, all other classes are fine. I am getting compile errors in my DAO where I try to get a user with username/pw, and those fields do not exist in the metamodel class.
Any ideas what would cause this? Working on linux, compiler set to 1.8. thanks
update
I ended up solving it by adding an entry for the entity in persistence.xml
<class>com.mypack.model.User</class>
I had gone thru the process of creating the entity and doing crud save, update, delete, and get by id functions, without the persistence.xml entries. I think I started with a few, found I didn't need them and commented them out.
Seeing now that when I try to create a criteriabuilder/root/query, etc, I run into that issue. Adding the entity to persistence.xml seems to have resolved it.