Annotations are just metadata. By themselves, they do nothing with your code. You must use reflection to use them. So yes, you could add any number of annotations to your classes and fields.
Your persistence structure will read persistence annotations, while your XML parser will read XML annotations.
Eg.
@Entity // JPA @XmlRootElement(name = "book") // JAXB @SuppressWarnings(value = "random") // whatever other annotation public class User { @Id @GeneratedValue @GenericGenerator(name = "incremental", strategy = "increment") @XmlElement private Long userID; // more }
source share