I am new to JPA, I have created a class like the following
/**
*
*/
package programme;
import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
* @author anoop
*
*/
@Entity
@Table(name="course")
@Access(AccessType.FIELD)
public class programme {
@Id private int id;
private String name;
private int year;
@Transient private String comments;
//getters and setters for the fields.
}
I noted that there is another class with name as my entity java class Programme.java with an underscore i.e. Programme_.java. What is this class and why is this generated. Is there any way that I can stop its generation?
the code for the Programme_.java class is as following.
package programme;
import javax.annotation.Generated;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2014-04-27T21:32:59.433+0530")
@StaticMetamodel(programme.class)
public class programme_ {
public static volatile SingularAttribute<programme, Integer> id;
public static volatile SingularAttribute<programme, String> name;
public static volatile SingularAttribute<programme, Integer> year;
public static volatile SingularAttribute<programme, String> comments;
}
This is your "Canonical Metamodel". It can be used with the JPA Criteria API, as described by the JPA 2.x spec (Section 6.2).
To stop Eclipse from generating these classes: edit your Eclipse project properties > JPA > Canonical metamodel (JPA 2.0) > Source folder - set the folder's value to "".