Hibernate not equal example criteria

后端 未结 3 672
盖世英雄少女心
盖世英雄少女心 2020-12-17 16:19

Hibernate has example criteria: For example:

Example equal = Example.create(mydbObject);

Is there a way to do the opposite, For example:

3条回答
  •  盖世英雄少女心
    2020-12-17 16:38

    I looking for the same restriction method for "not equal" and according to the document, it's

    List list = getSession().createCriteria("you.pakcage.hibernate.Example")
                            .add(Restrictions.ne("myProperty","blablabla"))
                            .list();
    

    by this way you retreat a list contain all the Example object except those whose myProperty property is "blablabla".

    May be not exactly what you what, but it achieve the same thing for me .

提交回复
热议问题