Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB spec conflicts - CMR field return types

 
Sankar Subbiramaniam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In page 182, section 10.5.7:
A select method is similar to a finder method, but unlike a finder method, but it can return values that
correspond to any cmp- or cmr-field type.


I understand that CMR field type is a valid return value.

However page 220, section 11.2.2, select methods explanation:
The result type of a select method can be an EJBLocalObject (or a collection of EJBLocalObjects), an EJBObject (or a collection of EJBObjects), or a cmp-field value (or a collection of such).


CMR field type is not mentioned as a valid return type.

Question: Can ejbSelect return a CMR field type ? Please explain.
Thanks.
 
Sankar Subbiramaniam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After thought:
In the secound quote from page 220:
The result type of a select method can be an EJBLocalObject (or a collection of EJBLocalObjects), an EJBObject (or a collection of EJBObjects), or a cmp-field value (or a collection of such).


In the above, EJBLocalObject/Collection of EJBLocalObject represents CMR field value type.

Conclusion: ejbSelect can return CMR field type values. If the return type is CMR field type then the OBJECT clause must be used.
 
B.Sathish
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes it can. There is also an example in the HFEJB where the ejbSelect returns a collection of Director (CMR field) component interface references and the hone business method calls it, gets the collection and calls the getDirectorName() method on each collection, gets all the names and concatenates them and returns a big string to the client
 
Sankar Subbiramaniam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sathish, please provide the page number of this example in HFEJB.
Thanks.

Are you are referring to the example on page396: MoveiBean ?
In this example the ejbSelectGetMoviesByDirectorAndGenre() - returns only a collection of cmp fields of movie bean. It does not return a CMR field.

Refer to the corresponding EJB-QL on page 405:
SELECT m.title FROM MovieSchema m
WHERE m.director.directorId??1 AND m.genre =?2

m.title - is a cmp field in movie bean.
[ December 16, 2005: Message edited by: Sankar Subbiramaniam ]
 
Sankar Subbiramaniam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found a related discussion CMR field as return type in a select statement

In Summary, are the following queries valid (refer to specs for the relationship between order and Product, Page 221):
1) SELECT l.product FROM Order AS o, IN(o.lineItems) l
2) SELECT l.product.name FROM Order AS o, IN(o.lineItems) l
Note: Name is a cmp field of product

According to HFEJB, page 406 (BANG) -- Both queries 1 and 2 are wrong.
According to spec 11.2.8, page 232 both are correct.

As of my current stand , query 2 is OK. Query 1 is not correct.

I will try to deploy this code and confirm the answers. If anybody has already done it, please inform.
Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic