View Javadoc

1   /*
2    * EL4J, the Extension Library for the J2EE, adds incremental enhancements to
3    * the spring framework, http://el4j.sf.net
4    * Copyright (C) 2005 by ELCA Informatique SA, Av. de la Harpe 22-24,
5    * 1000 Lausanne, Switzerland, http://www.elca.ch
6    *
7    * EL4J is published under the GNU Lesser General Public License (LGPL)
8    * Version 2.1. See http://www.gnu.org/licenses/
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   * GNU Lesser General Public License for more details.
14   *
15   * For alternative licensing, please contact info@elca.ch
16   */
17  package ch.elca.el4j.services.persistence.hibernate.dialect;
18  
19  import java.sql.Types;
20  
21  import org.hibernate.dialect.Oracle10gDialect;
22  
23  /**
24   * Fix hibernate column type validation on double precision values. Oracle
25   * accepts the type "double precision", but stores it as "float(126)". Whenever
26   * hibernate validates such a column, oracle returns "float(126)" and hibernate
27   * therefore reports a mismatch.
28   * 
29   * See http://opensource.atlassian.com/projects/hibernate/browse/HHH-1961
30   * or http://opensource.atlassian.com/projects/hibernate/browse/HHH-2315
31   * 
32   * Registers type for timestamps (see http://opensource.atlassian.com/projects/hibernate/browse/HHH-3193)
33   *
34   * @svnLink $Revision: 4082 $;$Date: 2010-01-07 16:36:39 +0100 (Do, 07. Jan 2010) $;$Author: swisswheel $;$URL: https://el4j.svn.sourceforge.net/svnroot/el4j/branches/el4j_3_1/el4j/framework/modules/hibernate/src/main/java/ch/elca/el4j/services/persistence/hibernate/dialect/PatchedOracle10gDialect.java $
35   *
36   * @author Stefan Wismer (SWI)
37   */
38  public class PatchedOracle10gDialect extends Oracle10gDialect {
39  	/**
40  	 * Is the sql type for timestamps.
41  	 */
42  	private static final int TIMESTAMP_CODE = -101;
43  	
44  	/**
45  	 * Default constructor.
46  	 */
47  	public PatchedOracle10gDialect() {
48  		super();
49  		registerColumnType(Types.DOUBLE, "float(126)");
50  		registerHibernateType(TIMESTAMP_CODE, "timestamp");
51  	}
52  }