java ee - Changing from views to sql joins in hibernate -


i have domain object

@entity @table (name = "vw_t_bucket") public class tbucket {  ....  @manytoone (cascade = { cascadetype.persist, cascadetype.merge }, fetch = fetchtype.eager, targetentity = prd.class)       @joincolumns({           @joincolumn(name = "key", referencedcolumnname="key"),           @joincolumn(name = "cdate", referencedcolumnname="cdate")       })       public iprd getprd() {         return prd;       } ....        @manytoone (cascade = { cascadetype.persist, cascadetype.merge }, fetch = fetchtype.eager, targetentity = acct.class)       @joincolumn (name = "acct", nullable = false)       public iacct getacct() {             return acct;       }  }  @entity @table (name = "product") public class prd implements iprd { ... }   @entity @table (name = "vw_acct") public class acct implements iacct { ... } 

as can see, tbucket view, , joined table ( product ) , view ( vw_acct)

i have been told db join both views , tables perform poorly , need change views tables.

but, views made of joins multiple tables.

my lead wondering if there solution can put join sql directly in annotation , told him can use tables/views mapping domain objects.

i wondering if there possible solutions problem.

if not update entity, can use org.hibernate.annotations.subselect annotation name exact sql use. developed (well on hbm xml mapping side) long time ago stand-in views on databases did not support views. but, mentioned, read-only.

if need update, need use org.hibernate.annotations.loader, org.hibernate.annotations.sqlinsert, org.hibernate.annotations.sqlupdate , org.hibernate.annotations.sqldelete annotations map enity.

yet, option (depending on exact nature of db view) map joins secondarytables.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -