All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.fluent.hibernate.H Maven / Gradle / Ivy

package com.github.fluent.hibernate;

import java.util.List;

/**
 * Hibernate fluent API entry point.
 *
 * @author DoubleF1re
 * @author V.Ladynev
 */
public final class H {

    private H() {

    }

    public static  HibernateRequest request(Class clazz) {
        return HibernateRequest. create(clazz);
    }

    public static  HibernateHqlRequest request(String query) {
        return HibernateHqlRequest. create(query);
    }

    public static HibernateUpdate update(String updateQuery) {
        return HibernateUpdate.create(updateQuery);
    }

    public static  T getById(Class clazz, Object id) {
        return H. request(clazz).idEq(id).first();
    }

    public static  T save(T entity) {
        return HibernateObjectQuery.save(entity);
    }

    public static  void saveOrUpdate(T entity) {
        HibernateObjectQuery.saveOrUpdate(entity);
    }

    public static  void saveOrUpdateAll(List entities) {
        HibernateObjectQuery.saveOrUpdateAll(entities);
    }

    public static  void saveAll(List entities) {
        HibernateObjectQuery.saveAll(entities);
    }

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

    public static  void deleteById(Class clazz, Object id) {
        HibernateObjectQuery.delete(getById(clazz, id));
    }

    // TODO add invoking IRequest

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy