fix some hibernate deprecation warnings

This commit is contained in:
Andy Janata 2017-02-26 22:26:29 -08:00
parent a67c721427
commit a38dc53a77
3 changed files with 17 additions and 17 deletions

View File

@ -24,7 +24,7 @@
package net.socialgamer.cah;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;
/**
@ -41,6 +41,6 @@ public class HibernateUtil {
public final SessionFactory sessionFactory;
private HibernateUtil() {
sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
sessionFactory = new Configuration().configure().buildSessionFactory();
}
}

View File

@ -13,11 +13,11 @@ package net.socialgamer.cah.hibernate;
import java.sql.Types;
import org.hibernate.Hibernate;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.function.SQLFunctionTemplate;
import org.hibernate.dialect.function.StandardSQLFunction;
import org.hibernate.dialect.function.VarArgsSQLFunction;
import org.hibernate.type.StandardBasicTypes;
public class SqliteDialect extends Dialect {
@ -47,10 +47,10 @@ public class SqliteDialect extends Dialect {
registerColumnType(Types.CLOB, "clob");
registerColumnType(Types.BOOLEAN, "integer");
registerFunction("concat", new VarArgsSQLFunction(Hibernate.STRING, "", "||", ""));
registerFunction("mod", new SQLFunctionTemplate(Hibernate.INTEGER, "?1 % ?2"));
registerFunction("substr", new StandardSQLFunction("substr", Hibernate.STRING));
registerFunction("substring", new StandardSQLFunction("substr", Hibernate.STRING));
registerFunction("concat", new VarArgsSQLFunction(StandardBasicTypes.STRING, "", "||", ""));
registerFunction("mod", new SQLFunctionTemplate(StandardBasicTypes.INTEGER, "?1 % ?2"));
registerFunction("substr", new StandardSQLFunction("substr", StandardBasicTypes.STRING));
registerFunction("substring", new StandardSQLFunction("substr", StandardBasicTypes.STRING));
}
@Override

View File

@ -32,7 +32,7 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Configuration;
import org.hibernate.dialect.PostgreSQLDialect;
@ -51,7 +51,7 @@ public class Schema extends HttpServlet {
@Override
protected void doGet(final HttpServletRequest request, final HttpServletResponse response)
throws ServletException, IOException {
final AnnotationConfiguration c = new AnnotationConfiguration();
final Configuration c = new Configuration();
c.configure();
final String[] ls = c.generateSchemaCreationScript(new PostgreSQLDialect());
final PrintWriter out = response.getWriter();