Exposing Hibernate criteria via service API

前端 未结 6 1151
鱼传尺愫
鱼传尺愫 2021-02-04 14:14

This is more of a design than implementation question and it\'s going to be long so bear with me. It\'s best explained with an example:

Let\'s say I have a business

6条回答
  •  礼貌的吻别
    2021-02-04 14:37

    It is never a good idea to expose such implementation details. You are bounded to that library from there on. Worse, any api change of the library will couse an api i change of your service. Any security considerations left behind...

    What about bean property names used in critera (a triple of property name, enum with less, equal and more and value). With a bean wrapper on your model, you may transform this to a hibernate criteria.

    It will also be possible to transform this property names to a new version after a model change.

提交回复
热议问题