fix some hibernate deprecation warnings
This commit is contained in:
parent
a67c721427
commit
a38dc53a77
|
@ -1,16 +1,16 @@
|
|||
/**
|
||||
* Copyright (c) 2012, Andy Janata
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
* provided that the following conditions are met:
|
||||
*
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
* and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
|
@ -24,12 +24,12 @@
|
|||
package net.socialgamer.cah;
|
||||
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.cfg.AnnotationConfiguration;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
|
||||
|
||||
/**
|
||||
* Utility class for Hibernate.
|
||||
*
|
||||
*
|
||||
* @author Andy Janata (ajanata@socialgamer.net)
|
||||
*/
|
||||
public class HibernateUtil {
|
||||
|
@ -41,6 +41,6 @@ public class HibernateUtil {
|
|||
public final SessionFactory sessionFactory;
|
||||
|
||||
private HibernateUtil() {
|
||||
sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
|
||||
sessionFactory = new Configuration().configure().buildSessionFactory();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
/**
|
||||
* Copyright (c) 2012, Andy Janata
|
||||
* All rights reserved.
|
||||
*
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted
|
||||
* provided that the following conditions are met:
|
||||
*
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions
|
||||
* and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
|
@ -32,13 +32,13 @@ 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;
|
||||
|
||||
|
||||
/**
|
||||
* Servlet implementation class Schema.
|
||||
*
|
||||
*
|
||||
* Get the database schema for known Hibernate objects.
|
||||
*/
|
||||
@WebServlet("/Schema")
|
||||
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue