• Post Reply Bookmark Topic Watch Topic
  • New Topic

question about entity bean  RSS feed

 
zb cong
Ranch Hand
Posts: 416
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello
can i map one CMP-entitybean to multiple database table?
thank you
 
Craig Demyanovich
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my experience so far, which is limited to EJB 1.1 and is only a few weeks old, an entity bean is tied to a single table. However, custom finder methods can be defined that use joins, a technique more standardized and easier in EJB 2.0, to find one or a collection of your bean instances based on criteria in multiple tables. The documentation for your J2EE server should include some information on declaring custom finders that use joins.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on your vendor. For instance, in WebSphere we do allow some simple joins in defining your table mapping so you can in fact map a single entity bean to more than one table.
Kyle
 
Craig Demyanovich
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This thought has just occurred to me based on your post, Kyle: Can an entity bean be based on a view, either via CMP or BMP, EJB 1.1 or 2.0? I have a little work here that takes precedence, but I'll check this thread later and have a look at the relevant specs.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, as I said, it depends on your vendor. In WebSphere, the answer is no, for either version. The reason is you usually can't update a View...
Kyle
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!