Friday, March 02, 2007

JAVA 認證心得 -- SCBCD (12)



  • In an EJB QL query path expressions may appear in either FROM,SELECT or WHERE clause.

  • EJB QL path expressions

    1. (.) is considered the navigation operator

    2. Path expressions can terminate with either cmr-field or cmp-field

    3. A path expression can end with a single value or a collection value

  • The IS EMPTY operator allows an EJB-QL query to test if a collection-valued path expression contains elements or not

  • EJB-QL is a standard query language for declaring the behavior of find methods and select methods.

  • For finder method queries, the return type of the SELECT clause is the abstract schema type of the entity bean that defines the finder method.

  • For select method queries, the return type of the SELECT clause may be one of the following

    1. the abstract schema of the entity bean that contains the select method

    2. the abstract schema of a related entity bean

    3. a persistent field

  • CMP fields can’t be decomposed and navigated through path expressions.

  • query
    ejb-qlselect distinct object(a) from Address a where a.cid=?1/ejb-ql

  • The following built-in functions are available to EJBQL queries:
    String Functions
    CONCAT( String, String) returns a String
    SUBSTRING( String, start, length) returns a String
    LOCATE( String, String [, start]) returns an int
    LENGTH( String) returns an int
    Arithmetic Functions:
    ABS( number) returns a number (int, float, or double)
    SQRT( double) returns a double

  • IN can be used only for a set containing String literals. Eg. SELECT Object(s) FROM Student s WHERE NOT IN ('robert', 'michael')

  • The abstract-schema-name deployment descriptor is used to specified the name of the abstract schema type of an entity bean. Used in EJB-QL queries.

  • EJB-QL allows SELECT clauses to return any CMP or single CMR field.

Read more!

No comments: