JavaJEEJPA: Difference between revisions
| Line 2: | Line 2: | ||
The Java Persistence API is part of the Java SE. To search for entities there is JPQL. The API defines the interface and is no '''persistence provider'''. This is for example JBoss or Glassfish. | The Java Persistence API is part of the Java SE. To search for entities there is JPQL. The API defines the interface and is no '''persistence provider'''. This is for example JBoss or Glassfish. | ||
The information regarding persistence is specified via annotations or deployment descriptor. The central instance of the JPA is the entity manager. The '''entity manager''' is responsible for saving, actualizing or deleting of entities. The entity manager provides a persistence context. | The information regarding persistence is specified via annotations or deployment descriptor. The central instance of the JPA is the entity manager. The '''entity manager''' is responsible for saving, actualizing or deleting of entities. The entity manager provides a persistence context. | ||
An entity in a persistence context is '''attached''' or '''managed''', otherwise '''detached'''. It can also reattached. The entity manager is accessed via JNDI or in an EJB container by injection. | An entity in a persistence context is '''attached''' or '''managed''', otherwise '''detached'''. It can also reattached. The entity manager is accessed via JNDI or in an EJB container by injection (javax.persistence.PeristenceContext). | ||
=Annotations= | =Annotations= | ||
Revision as of 11:43, 22 August 2008
Introduction
The Java Persistence API is part of the Java SE. To search for entities there is JPQL. The API defines the interface and is no persistence provider. This is for example JBoss or Glassfish. The information regarding persistence is specified via annotations or deployment descriptor. The central instance of the JPA is the entity manager. The entity manager is responsible for saving, actualizing or deleting of entities. The entity manager provides a persistence context. An entity in a persistence context is attached or managed, otherwise detached. It can also reattached. The entity manager is accessed via JNDI or in an EJB container by injection (javax.persistence.PeristenceContext).
Annotations
javax.persistence.Column
javax.persistence.Column[([name="<Name>"])]
javax.persistence.Entity
- if no table specified, tablename is classname
- all members are persistent, unless speficied with javax.persistence.Transient
java.persistence.GeneratedValue
javax.persistence.Id
javax.persistance.Table
javax.persitance.Table[([name="<Name>"])]