Fellows, I'm having problemas using EJB 2.0, CMP. The plan is to use find methods to all my searchs in the database. But: 1) find methods returns EJBObject's or Collection of those, so i have to encapsulate then into Value Objects to pass up, to the presentation layer. Who's responsability is this? 2) EJB-QL don't allow me to use LIKE expression's. My first idea was to use ejbHome methods to execute SQL directly. But than, they wil return VO's and Collection of then. So in the same class i'll have to types of search methods very distinct, i didn't like it.
18.104.22.168 Like expressions The syntax for the use of the comparison operator [NOT] LIKE in a conditional expression is as follows: single_valued_path_expression [NOT] LIKE pattern-value [ESCAPE escape-character] The single_valued_path_expression must have a String value. The pattern-value is a string literal in which an underscore (_) stands for any single character, a percent (%) character stands for any sequence of characters (including the empty sequence), and all other characters stand for themselves. The optional escape-characteris a single character string literal and is used to escape the special meaning of the underscore and percent characters in pattern-value. Examples are: � address.phone LIKE �12%3� is true for �123� �12993� and false for �1234� � asentence.word LIKE �l_se� is true for �lose� and false for �loose� � aword.underscored LIKE �\_%� ESCAPE �\� is true for �_foo� and false for �bar� � address.phone NOT LIKE �12%3� is false for �123� and �12993� and true for �1234� If the value of the single_valued_path_expression is NULL, the value of the LIKE expression is unknown.
1) find methods returns EJBObject's or Collection of those, so i have to encapsulate then into Value Objects to pass up, to the presentation layer. Who's responsability is this?
Define a method in component interface to return value objects. Write a session bean which does the find , get the collection, naviagtes through it and gets value object.
Aleks, follow this example: "SELECT DISTINCT OBJECT(c) FROM Ojb c WHERE LOCATE(?1,c.field) > 0" where ?1 is the first input parameter in your FIND function. It's all rigth in JBOSS. my regards, Wildson