I have two questions regarding java annotations:
-
Why does it have to defined as public static final?
-
Why do I have do I have to import them since they're def in the current class?
Is it because in @interface you can only use public static final fields?
And does the import has to do something with optimization?
i.e.
import static db.Rezervare.FINDALL;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
@Entity
@Table(name = "rezervari")
@NamedQueries(
@NamedQuery(name = FINDALL, query = "SELECT r FROM Rezervare r ORDER BY r.nume")
)
public class Rezervare {
public static final String FINDALL = "Rezervare.findAll";
Aucun commentaire:
Enregistrer un commentaire