Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

EclipseLink/Development/AdditionalCriteria

< EclipseLink‎ | Development
Revision as of 21:05, 9 September 2010 by Unnamed Poltroon (Talk) (New page: == Additional Criteria Requirements and Design == {{322008|bug}} <source lang="java"> @Entity // This annotation is needed and very useful when defining comparison against // columns t...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Additional Criteria Requirements and Design

Template:322008

@Entity
 
// This annotation is needed and very useful when defining comparison against 
// columns that are not mapped
@DirectQueryKey(name = "isDeleted", column = @Column(name = "IS_DEL"))
 
/**
 *  Simple fixed criteria for virtual delete scenario
 */
@FixedCriteria(attribute = "isDeleted", operator = EQUAL, value = "Y")
 
/**
 *  Simple Property usage. The property will be looked up in the active session
 *  
 *  Note: Currently this is only the UOW/CS when the cache.shared=false. When cache.shared=true only the server session's properties are visible.
 */
@PropertyCriteria(attribute = "company", operator = LIKE, property = "COMPANY_PATTERN")
 
/**
 * Call-back criteria where expressions can be added dynamically. This class
 * could either implement an interface for call-backs or an additional set of
 * annotations could be defined that allows you to define which methods are
 * called for which query types.
 */
@CallbackCriteria(CustomerUserCriteria.class)
 
/**
 * More complex additional criteria that supports composition, named access, and 
 * enable/disable. Any of the above could be specified within @AdditionalCriteria to 
 * allow enable/disable through named access.
 * 
 * When specified without @AdditionalCriteria all of the provided criteria are combined 
 * into a AdditionalCriteria named 'default' on the descriptor and enabled.
 */
@AdditionalCriteria(name = "example", enabled = false, 
        fixed = { @FixedCriteria(attribute = "name", operator = NOT_NULL) }, 
        properties = { @PropertyCriteria(attribute = "company", operator = EQUAL, property = "COMPANY_NAME") }, 
        callbacks = { @CallbackCriteria(CustomerTemporalCriteria.class) })
public class Customer {
 
    @Id
    private int id;
 
    private String name;
 
    private String company;

Back to the top