v-ladynev / fluent-hibernate

Library to work with Hibernate by fluent API
Other
48 stars 12 forks source link

Consider changing API for H.update("delete from User").execute(); #7

Open Levvy055 opened 9 years ago

Levvy055 commented 9 years ago

not better H.delete(object) ?

v-ladynev commented 9 years ago

Yeah, and there is already is a method for it in H

    public static <T> void delete(T entity) {
        HibernateObjectQuery.delete(entity);
    }

A problem is with not delete request but with any HQL update request. I have made an error in code just writing

H.update("delete from User") ;

without execute()

Levvy055 commented 9 years ago

so than just H.execute(hql) would be best cause 'update' can be mistaken

v-ladynev commented 9 years ago

Yeah, you are right...but there is a problem with query named parameters

H.update("delete from User where pid = :pid") .p("pid", pid).execute();