Use database Views with Hibernate

后端 未结 1 367
悲哀的现实
悲哀的现实 2021-01-02 09:14

I have a table named Samples in my DB,and it has a column named baseline which is a boolean variable. I wanted to search among the rows which have

1条回答
  •  有刺的猬
    2021-01-02 10:07

    Hibernate can treat views like it does any table. Just define an entity class based on that view (Baselines, as you say).

    The most common difficulty with views is that some database engines can't handle inserts or updates on views, so be aware of that if your application tries to modify the data. I don't know if MySQL is capable of this.

    An alternative to using a view is to use Hibernate Filters, which do much the same thing, but at the Hibernate session level.

    0 讨论(0)
提交回复
热议问题