@Entity
From CauchoWiki
The @Entity annotation marks a Java class as a persistent entity, mapped to a database table.
@Entity
public class TestBean {
...
}
The fields or properties of the entity's Java class are mapped to database columns. The entity must have at least on @Id column.
[edit] Annotation Definition
public @interface Entity {
String name() default "";
}
The default name is the unqualified name of the Java class, e.g. TestBean. The entity name is used in queries as well as providing the default table name.
[edit] Field and property annotations
The fields or properties of the entity are mapped to database columns. The following list the possible types:
- @Basic - primitive columns like Strings, int, double, etc.
- @Id - a primary key column.
- @ManyToOne - a unidirectional link (foreign key)
- @OneToMany - a collection of children (unidirectional or bidirectional)
- @ManyToMany - a collection of children
A catalog of relation types is at Relation catalog
[edit] Related class-level annotations
The following annotations can be used in combination with @Entity.
* @Table specifies the table name
