• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB

 
ashok ks
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to map Entity Bean with the Databse View instead of database Table ?
 
Sergiu Truta
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When working with database views I use Session Beans and JDBC. You cannot use CMP with views. You could try using BMP with views but you have to be carefull because if you change the view (i.e add some columns or remove some) the beans have to change also.
You could also try using DAO but I think using Session Beans with JDBC it's easy and reliable.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some CMP implementations allow mapping to database views. Check your particular appserver's documentation.
 
Vinod John
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Technically there should be no trouble mapping a Read only CMP EJB to a database view. But if you want read write CMP EJB then you may have some issues when executing DML statements (either database or the app server may restrict you). Personally "I" have mapped read-only CMP EJB to a database view in weblogic and oracle.
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll go ahead and second Lasse on this one. Support for views is entirely dependent on the Application Server. For example, I know that WebLogic definitely supports mapping CMP Beans to views.
As far as read-only vs. read-write... I see no problem using views for read-write operations. Of course, if you're view is sufficiently complex then you RDBMS might not allow updates.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic