This is source level metadata. This is a way of adding information to code that is not code and that is easily processed by the machine.
In your example, they are used to set up object-relational mapping for this type of entity. He says that, for example, the id field should be the primary key for this object, and that firstName, lastName and hireDate should be stored in the database. (To specify these fields except the state of the transition object.)
GAE support for JDO needs to know which objects you are trying to store in the database. It does this by looking at classes in your code, looking for those that are annotated with @PersistenceCapable.
They are usually used to replace where you used external configuration files; the standard Java library has tools for reading annotations in your code, which greatly simplifies their processing than deploying your own configuration file, and you get free IDE support.
millimoose
source share