Building a Web Application Using EJB, JPA, and JavaServer Faces – Annotations

Any symbol in Java code beginning with @ is known as an annotation.  

The use of annotations allows you to add metadata to your objects. Examples of annotations follow:

Annotation Description
@Entity Identifies the file as an EJB 3.0 entity
@NamedQuery A query that can be used at run time to retrieve data
@Table Specifies the primary table for the entity
@Id Can define which property is the identifier for the entity
@Column Specifies a mapped column for a persistent property or field
@ManyToOne Specifies a type of foreign key relationship between tables
@JoinColumn Specifies the join column and referenced column for a foreign key relationship

Generics are not supported in -source 1.3 error in Maven Project

When compiling via maven project, you may have encountered following error:

generics are not supported in -source 1.3 error in Maven Project. use -source 5 or higher to enable generics.

Annotation is not allowed in -source 1.3 use -source 5 or higher to enable annotation.

To solve this you must add the below lines at your pom.xml :

<build>
 <plugins>
  <plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-compiler-plugin</artifactId>
   <configuration>
    <source>1.5</source>
    <target>1.5</target>
   </configuration>
  </plugin>
 </plugins>
</build>