
com.github.fluent.hibernate.H Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fluent-hibernate-core Show documentation
Show all versions of fluent-hibernate-core Show documentation
A library to work with Hibernate by fluent API. This library hasn't dependencies except Hibernate dependencies. It requires Java 1.6 and above.
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