0% found this document useful (0 votes)
28 views2 pages

Java EE 6 Annotations Overview

This document provides a summary of key Java EE 6 annotations in 3 categories: Bean Types, Security, and Transactions. For Bean Types it lists common annotations used for EJB and CDI managed beans including @Stateless, @Stateful, @Singleton, and more. For Security it covers annotations related to security roles and permissions. For Transactions it lists transaction attribute annotations and those used to define transactional methods.

Uploaded by

GraziaPlena
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views2 pages

Java EE 6 Annotations Overview

This document provides a summary of key Java EE 6 annotations in 3 categories: Bean Types, Security, and Transactions. For Bean Types it lists common annotations used for EJB and CDI managed beans including @Stateless, @Stateful, @Singleton, and more. For Security it covers annotations related to security roles and permissions. For Transactions it lists transaction attribute annotations and those used to define transactional methods.

Uploaded by

GraziaPlena
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

M @AroundTimeout

Java EE 6 Annotations Bean Types: [Link] TM @ExcludeDefaultInterceptors


T @Stateless(name=”ClassName”) M @ExcludeClassInterceptors
Alternatives for EJB management
T @Stateful(name=”ClassName”)
CDI JSF EJB3 Security: [Link]
T @Singleton(name=”ClassName”)
T @MessageDriven(name=”ClassName”, T @RunAs(String rolename)
activationConfig=@ActivationConfigProperty[]) T @DeclareRoles(String[])
CDI: [Link]
@ActivationConfigProperty(propertyName=””, TM @RolesAllowed(String[])
@Named(value=””) propertyValue=””) TM @PermitAll
CMF @Inject T @Local([Link][]) TM @DenyAll
T @Remote([Link][]) -- Possible source file layout for web app –
CDI: [Link] T @LocalBean 1 lib/ [potentially copied to /lib/ inside an EAR]
TMF @ApplicationScoped `-- [Link] [if jar shared between all modules]
TM @Asynchronous
TMF @SessionScoped 2 src/java/ [potentially packaged as EJB-JAR inside EAR -
TM @Lock([[Link],READ]) |-- [Link] or under
TMF @ConversationScoped
T @ConcurrencyManagement([CONTAINER, BEAN]) |-- META-INF/ WEB-INF/classes inside WAR]
TMF @RequestScoped | |-- [Link] [if JPA]
T @DependsOn(String[])
TMF @Dependent | `-- [Link] [if deployment descriptors]
T @Startup `-- com/
`-- myBusiness/
CDI: [Link] Timeouts: [Link] |-- entities/
TMF @New(value=[Link]) | `-- [Link]
TM @AccessTimeout(value=”0”,unit=MILLISECONDS)
TMF @Alternative |-- resources/
T @StatefulTimeout(value=”0”,unit=MILLISECONDS) | `-- [Link]
TMF @Any
M @Timeout `-- [Link]
MF @Produces 3 web/ [potentially packaged as a WAR inside an EAR]
M @Schedule(year=”*”, month=”*”, bimonthly=”*”,
dayOfWeek=”*”, hour=”0”, minute=”0”, info=””, |-- WEB-INF/
JSF management: [Link] persistent=true, timezone=””) | |-- [Link] [if CDI]
| |-- [Link] [if JSF]
T @ManagedBean(name=””, eager=false) M @Schedules(@Schedule[]) | `-- [Link] [if Servlet 2.5]
T @CustomScoped(value=””) |-- resources/
T @ApplicationScoped Transaction: [Link] | |-- css/
EAR | | `-- [Link]
T @SessionScoped T @TransactionManagement([CONTAINER, BEAN]) class | `-- javascript/
T @ViewScoped TM @TransactionAttribute([TransactionAttributeType. loader | `-- [Link]
levels
T @RequestScoped MANDATORY, REQUIRED, REQUIRES_NEW, `-- [Link]
SUPPORTS, NOT_SUPPORTED, NEVER])
T @NoneScoped
M @AfterBegin
F @ManagedProperty(name=””, value=””)
M @BeforeCompletion Legend
T @ReferencedBean(name=””)
M @AfterCompletion TCMF Annotation for Type, Constructor, Method, Field
VALUE Default Value
EJB3 injection: [Link]
TMF @EJB(name=””, beanInterface=[Link],
EJB Lifecycle: [Link]
mappedName=””, lookup=””|| beanName=””, M @Remove(retainIfException=[true,false])
description=””)
Java EE 6 Annotations Cheat Sheet
M @PostConstruct [in [Link].*]
Version 1.3 (2011-11-09), based on Java EE 6 API Doc
T @EJBs(@EJB[]) M @PreDestroy [in [Link].*]
©2005,2011 Philipp Meier – [Link]
M @PostActivate
EJB3 injection: [Link] 2011 Updated for EJB 3.1, JSF 2.0, JPA 2.0 by Chris Rennie
M @PrePassivate Report errors to [Link]@[Link]
T @ManagedBean(value=””)
This work is licensed under the Creative Commons Attribution-
TMF @Resource(name=””, type=[Link], Interceptors: [Link] NonCommercial-ShareAlike 2.0 Germany License. To view a copy of this
authenticationType= license, visit [Link] or
[[Link], APPLICATION], T @Interceptor send a letter to Creative Commons, 543 Howard Street, 5th Floor, San
shareable=true, lookup=””, mappedName=””) TM @Interceptors([Link][]) Francisco, California, 94105, USA.
T @Resources(@Resource[]) M @AroundInvoke
TMF @PrimaryKeyJoinColumn(name=”THIS_PK”, TMF @SequenceGenerator(name=””, schema=””,
Persistence provider: [Link] columnDefinition=””, referencedColumnName= catalog=””, sequenceName=””, initialValue=0,
TMF @PersistenceContext(name=””, unitName=””,type= ”OTHER_FK”) allocationSize=50)
[[Link],EXTENDED], TMF @PrimaryKeyJoinColumns(@PrimaryKeyJoinColumn[]) TMF @TableGenerator(name=””, table=””, schema=””,
properties=@PersistenceProperty[]) MF @JoinColumn(name=”THIS_FK”, table=””, catalog=””, pkColumnName=””,
T @PersistenceContexts(@PersistenceContext[]) unique=false, nullable=true, insertable=true, valueColumnName=””, pkColumnValue=””,
updatable=true, columnDefinition=””, initialValue=0, allocationSize=50,
TMF @PersistenceUnit(name=””, unitName=””)
referencedColumnName=”OTHER_PK”) uniqueConstraints=@UniqueConstraint[])
T @PersistenceUnits(@PersistenceUnit[])
MF @JoinColumns(@JoinColumn[])
@PersistenceProperty(name=””, value=””) Embedded objects: [Link]
MF @JoinTable(name=””, schema=””, catalog=””,
T @Cacheable(value=true) T @Embeddable
joinColumns={}, inverseJoinColumns={},
uniqueConstraints=@UniqueConstraint[]) MF @EmbeddedId
Object mapping: [Link]
TMF @AssociationOverride(name=””, joinTable= MF @Embedded
T @Entity(name=””) @JoinTable || joinColumns=@JoinColumn[])
T @Table(name=””, schema=””, catalog=””, MF @MapsId(value=”propOrField”) Collections and Maps: [Link]
uniqueConstraints=@UniqueConstraint[])
MF @OrderBy(value=””) MF @CollectionTable(name=””, schema=””, catalog=””,
T @SecondaryTable(name=””, schema=””, catalog=””, joinColumns={}, uniqueConstraints={})
pkJoinColumns=@PrimaryKeyJoinColumn[], MF @OrderColumn(name=”FIELD_ORDER”,nullable=true,
uniqueConstraints=@UniqueConstraint[]) insertable=true, updatable=true, columnDefinition=””) MF @ElementCollection(targetClass=[Link],
fetch=[[Link], EAGER])
T @SecondaryTables(@SecondaryTable[])
Queries: [Link] MF @MapKeyColumn(name=”FK”, table=””,
@UniqueConstraint(columnNames=String[],
unique=false, nullable=true, insertable=true,
name=””) T @NamedQuery(name=””, query=”JPQL...”, hints= updatable=true, columnDefinition=””, length=255,
T @IdClass([Link]) @QueryHint[], lockMode=...) precision=0, scale=0)
TMF @Access(value=[[Link], PROPERTY]) T @NamedQueries(@NamedQuery[]) MF @MapKeyJoinColumn(name=”FK”, table=””,
TMF @AttributeOverride(name=””, column=@Column) T @NamedNativeQuery(name=””, query=”SQL...”, unique=false, nullable=true, insertable=true,
resultClass=[Link], hints=..., lockMode=...) updatable=true, columnDefinition=””,
T @NamedNativeQueries(@NamedQuery[]) referencedColumnName=”OTHER_PK”)
Field mapping: [Link]
@QueryHint(name=””, value=””) MF @MapKeyJoinColumns(@MapKeyJoinColumn[])
MF @Column(name=””, table=””, unique=false,
nullable=true, insertable=true, updatable=true, MF @MapKey(”propOrField”)
columnDefinition=””, length=255, precision=0, SqlResultSet mapping: [Link] MF @MapKeyClass([Link])
scale=0)
T @SqlResultSetMappings(@SqlResultSetMapping[]) MF @MapKeyEnumerated([[Link],STRNG])
MF @Id
T @SqlResultSetMapping(name=””, entities= MF @MapKeyTemporal([[Link], TIME,
MF @Basic(fetch=[LAZY, EAGER], optional=true) TIMESTAMP])
@EntityResult[], columns=@ColumnResult[])
MF @Enumerated([[Link],STRING])
@EntityResult(entityResult=[Link],
MF @Temporal([[Link], TIME, TIMESTAMP]) disriminatorColumn=””, fields=@FieldResult[]) JPA Lifecycle: [Link]
MF @Transient @FieldResult(name=””, column=””) M @PrePersist [C]
MF @Lob @ColumnResult(name=””) M @PostPersist [C]
MF @Version M @PostLoad [R]
Inheritance: [Link] M @PreUpdate [U]
Relationship mapping: [Link] T @MappedSuperclass M @PostUpdate [U]
MF @OneToOne(targetEntity=[Link], T @Inheritance([InheritanceType.SINGLE_TABLE, M @PreRemove [D]
cascade={[Link], DETACH, MERGE, TABLE_PER_CLASS, JOINED]) M @PostRemove [D]
PERSIST, REFRESH, REMOVE},
T @DiscriminatorValue(value=””)
fetch=[[Link], EAGER], optional=true,
mappedBy=”propOrField”, orphanRemoval=false) T @DiscriminatorColumn(name=”DTYPE”, Listeners: [Link]
discriminatorType=[STRING,CHAR,INTEGER], T @EntityListeners([Link][])
MF @OneToMany(targetEntity=[Link] ,
columnDefinition=””, length=31)
cascade={...}, fetch=[...], mappedBy=””, T @ExcludeDefaultListeners
orphanRemoval=false) T @ExcludeSuperclassListeners
Generators: [Link]
MF @ManyToOne(targetEntity=[Link],
cascade={...}, fetch=[...], optional=true) MF @GeneratedValue(generator=””, strategy= See [Link]
[[Link],IDENTITY,SEQUENCE,TABLE]) also [Link]
MF @ManyToMany(targetEntity=[Link],
cascade={...}, fetch=[...], mappedBy=””)

You might also like