Hibernate SVN: r19392 - in core/trunk: testsuite/src/test/java/org/hibernate/test/hql and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: gbadner
Date: 2010-05-06 15:08:18 -0400 (Thu, 06 May 2010)
New Revision: 19392
Added:
core/trunk/testsuite/src/test/java/org/hibernate/test/hql/EntityWithArgFunctionAsColumn.java
core/trunk/testsuite/src/test/java/org/hibernate/test/hql/EntityWithFunctionAsColumnHolder.java
core/trunk/testsuite/src/test/java/org/hibernate/test/hql/EntityWithNoArgFunctionAsColumn.java
core/trunk/testsuite/src/test/java/org/hibernate/test/hql/FunctionNameAsColumnTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/hql/FunctionNamesAsColumns.hbm.xml
Modified:
core/trunk/core/src/main/java/org/hibernate/sql/Template.java
Log:
HHH-5135 : 'Ambiguous column' with columns having the same name as a registered function
Modified: core/trunk/core/src/main/java/org/hibernate/sql/Template.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/sql/Template.java 2010-05-06 17:41:24 UTC (rev 19391)
+++ core/trunk/core/src/main/java/org/hibernate/sql/Template.java 2010-05-06 19:08:18 UTC (rev 19392)
@@ -28,6 +28,7 @@
import java.util.StringTokenizer;
import org.hibernate.dialect.Dialect;
+import org.hibernate.dialect.function.SQLFunction;
import org.hibernate.dialect.function.SQLFunctionRegistry;
import org.hibernate.util.StringHelper;
import org.hibernate.sql.ordering.antlr.ColumnMapper;
@@ -317,11 +318,29 @@
private static boolean isFunctionOrKeyword(String lcToken, String nextToken, Dialect dialect, SQLFunctionRegistry functionRegistry) {
return "(".equals(nextToken) ||
KEYWORDS.contains(lcToken) ||
- functionRegistry.hasFunction(lcToken) ||
+ isFunction(lcToken, nextToken, functionRegistry ) ||
dialect.getKeywords().contains(lcToken) ||
FUNCTION_KEYWORDS.contains(lcToken);
}
+ private static boolean isFunction(String lcToken, String nextToken, SQLFunctionRegistry functionRegistry) {
+ // checking for "(" is currently redundant because it is checked before getting here;
+ // doing the check anyhow, in case that earlier check goes away;
+ if ( "(".equals( nextToken ) ) {
+ return true;
+ }
+ SQLFunction function = functionRegistry.findSQLFunction(lcToken);
+ if ( function == null ) {
+ // lcToken does not refer to a function
+ return false;
+ }
+ // if function.hasArguments() and function.hasParenthesesIfNoArguments() is true,
+ // then assume that lcToken is not a function, since it is not followed by "(";
+ // can't seem to use function.hasParenthesesIfNoArguments() alone because
+ // function definitions may return true if "()" is optional when there are no arguments.
+ return function.hasArguments() && function.hasParenthesesIfNoArguments() ? false : true;
+ }
+
private static boolean isIdentifier(String token, Dialect dialect) {
return token.charAt(0)=='`' || ( //allow any identifier quoted with backtick
Character.isLetter( token.charAt(0) ) && //only recognizes identifiers beginning with a letter
Added: core/trunk/testsuite/src/test/java/org/hibernate/test/hql/EntityWithArgFunctionAsColumn.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/hql/EntityWithArgFunctionAsColumn.java (rev 0)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/hql/EntityWithArgFunctionAsColumn.java 2010-05-06 19:08:18 UTC (rev 19392)
@@ -0,0 +1,56 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.test.hql;
+
+/**
+ *
+ * @author Gail Badner
+ */
+public class EntityWithArgFunctionAsColumn {
+ private long id;
+ private int lower;
+ private String upper;
+
+ public long getId() {
+ return id;
+ }
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public int getLower() {
+ return lower;
+ }
+ public void setLower(int lower) {
+ this.lower = lower;
+ }
+
+ public String getUpper() {
+ return upper;
+ }
+ public void setUpper(String upper) {
+ this.upper = upper;
+ }
+}
Added: core/trunk/testsuite/src/test/java/org/hibernate/test/hql/EntityWithFunctionAsColumnHolder.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/hql/EntityWithFunctionAsColumnHolder.java (rev 0)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/hql/EntityWithFunctionAsColumnHolder.java 2010-05-06 19:08:18 UTC (rev 19392)
@@ -0,0 +1,67 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.test.hql;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ *
+ * @author Gail Badner
+ */
+public class EntityWithFunctionAsColumnHolder {
+ private long id;
+ private EntityWithFunctionAsColumnHolder nextHolder;
+ private Set entityWithArgFunctionAsColumns = new HashSet();
+ private Set entityWithNoArgFunctionAsColumns = new HashSet();
+
+ public long getId() {
+ return id;
+ }
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public EntityWithFunctionAsColumnHolder getNextHolder() {
+ return nextHolder;
+ }
+ public void setNextHolder(EntityWithFunctionAsColumnHolder nextHolder) {
+ this.nextHolder = nextHolder;
+ }
+
+ public Set getEntityWithArgFunctionAsColumns() {
+ return entityWithArgFunctionAsColumns;
+ }
+ public void setEntityWithArgFunctionAsColumns(Set entityWithArgFunctionAsColumns) {
+ this.entityWithArgFunctionAsColumns = entityWithArgFunctionAsColumns;
+ }
+
+ public Set getEntityWithNoArgFunctionAsColumns() {
+ return entityWithNoArgFunctionAsColumns;
+ }
+ public void setEntityWithNoArgFunctionAsColumns(Set entityWithNoArgFunctionAsColumns) {
+ this.entityWithNoArgFunctionAsColumns = entityWithNoArgFunctionAsColumns;
+ }
+}
\ No newline at end of file
Added: core/trunk/testsuite/src/test/java/org/hibernate/test/hql/EntityWithNoArgFunctionAsColumn.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/hql/EntityWithNoArgFunctionAsColumn.java (rev 0)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/hql/EntityWithNoArgFunctionAsColumn.java 2010-05-06 19:08:18 UTC (rev 19392)
@@ -0,0 +1,56 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.test.hql;
+
+/**
+ *
+ * @author Gail Badner
+ */
+public class EntityWithNoArgFunctionAsColumn {
+ private long id;
+ private String user;
+ private String currentDate;
+
+ public long getId() {
+ return id;
+ }
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public String getUser() {
+ return user;
+ }
+ public void setUser(String user) {
+ this.user = user;
+ }
+
+ public String getCurrentDate() {
+ return currentDate;
+ }
+ public void setCurrentDate(String currentDate) {
+ this.currentDate = currentDate;
+ }
+}
Added: core/trunk/testsuite/src/test/java/org/hibernate/test/hql/FunctionNameAsColumnTest.java
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/hql/FunctionNameAsColumnTest.java (rev 0)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/hql/FunctionNameAsColumnTest.java 2010-05-06 19:08:18 UTC (rev 19392)
@@ -0,0 +1,332 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.test.hql;
+
+import java.util.List;
+
+import junit.framework.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.hibernate.FetchMode;
+import org.hibernate.Hibernate;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.criterion.Restrictions;
+import org.hibernate.junit.functional.FunctionalTestCase;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+
+/**
+ * Tests HQL and Criteria queries using DB columns having the same name as registerd functions.
+ *
+ * @author Gail Badner
+ */
+public class FunctionNameAsColumnTest extends FunctionalTestCase {
+
+ private static final Logger log = LoggerFactory.getLogger( FunctionNameAsColumnTest.class );
+
+ public FunctionNameAsColumnTest(String name) {
+ super( name );
+ }
+
+ public String[] getMappings() {
+ return new String[] {
+ "hql/FunctionNamesAsColumns.hbm.xml"
+ };
+ }
+
+ public void configure(Configuration cfg) {
+ super.configure( cfg );
+ cfg.setProperty( Environment.USE_QUERY_CACHE, "false" );
+ }
+
+ public static Test suite() {
+ return new FunctionalTestClassTestSuite( FunctionNameAsColumnTest.class );
+ }
+
+ public void testGetOneColumnSameNameAsArgFunctionHQL() {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+ EntityWithArgFunctionAsColumn e = new EntityWithArgFunctionAsColumn();
+ e.setLower( 3 );
+ e.setUpper( " abc " );
+ s.persist( e );
+ t.commit();
+ s.close();
+
+ s = openSession();
+ t = s.beginTransaction();
+ e = ( EntityWithArgFunctionAsColumn ) s.createQuery( "from EntityWithArgFunctionAsColumn" ).uniqueResult();
+ assertEquals( 3, e.getLower() );
+ assertEquals( " abc ", e.getUpper() );
+ t.commit();
+ s.close();
+
+ cleanup();
+ }
+
+ public void testGetOneColumnSameNameAsArgFunctionCriteria() {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+ EntityWithArgFunctionAsColumn e = new EntityWithArgFunctionAsColumn();
+ e.setLower( 3 );
+ e.setUpper( " abc " );
+ s.persist( e );
+ t.commit();
+ s.close();
+
+ s = openSession();
+ t = s.beginTransaction();
+ e = ( EntityWithArgFunctionAsColumn ) s.createCriteria( EntityWithArgFunctionAsColumn.class ).uniqueResult();
+ assertEquals( 3, e.getLower() );
+ assertEquals( " abc ", e.getUpper() );
+ t.commit();
+ s.close();
+
+ cleanup();
+ }
+
+ public void testGetMultiColumnSameNameAsArgFunctionHQL() {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+ EntityWithArgFunctionAsColumn e1 = new EntityWithArgFunctionAsColumn();
+ e1.setLower( 3 );
+ e1.setUpper( " abc " );
+ EntityWithArgFunctionAsColumn e2 = new EntityWithArgFunctionAsColumn();
+ e2.setLower( 999 );
+ e2.setUpper( " xyz " );
+ EntityWithFunctionAsColumnHolder holder1 = new EntityWithFunctionAsColumnHolder();
+ holder1.getEntityWithArgFunctionAsColumns().add( e1 );
+ EntityWithFunctionAsColumnHolder holder2 = new EntityWithFunctionAsColumnHolder();
+ holder2.getEntityWithArgFunctionAsColumns().add( e2 );
+ holder1.setNextHolder( holder2 );
+ s.save( holder1 );
+ t.commit();
+ s.close();
+
+ s = openSession();
+ t = s.beginTransaction();
+ holder1 = ( EntityWithFunctionAsColumnHolder ) s.createQuery(
+ "from EntityWithFunctionAsColumnHolder h left join fetch h.entityWithArgFunctionAsColumns " +
+ "left join fetch h.nextHolder left join fetch h.nextHolder.entityWithArgFunctionAsColumns " +
+ "where h.nextHolder is not null" )
+ .uniqueResult();
+ assertTrue( Hibernate.isInitialized( holder1.getEntityWithArgFunctionAsColumns() ) );
+ assertTrue( Hibernate.isInitialized( holder1.getNextHolder() ) );
+ assertTrue( Hibernate.isInitialized( holder1.getNextHolder().getEntityWithArgFunctionAsColumns() ) );
+ assertEquals( 1, holder1.getEntityWithArgFunctionAsColumns().size() );
+ e1 = ( EntityWithArgFunctionAsColumn ) holder1.getEntityWithArgFunctionAsColumns().iterator().next();
+ assertEquals( 3, e1.getLower() );
+ assertEquals( " abc ", e1.getUpper() );
+ assertEquals( 1, holder1.getNextHolder().getEntityWithArgFunctionAsColumns().size() );
+ e2 = ( EntityWithArgFunctionAsColumn ) ( holder1.getNextHolder() ).getEntityWithArgFunctionAsColumns().iterator().next();
+ assertEquals( 999, e2.getLower() );
+ assertEquals( " xyz ", e2.getUpper() );
+ t.commit();
+ s.close();
+
+ cleanup();
+ }
+
+ public void testGetMultiColumnSameNameAsArgFunctionCriteria() {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+ EntityWithArgFunctionAsColumn e1 = new EntityWithArgFunctionAsColumn();
+ e1.setLower( 3 );
+ e1.setUpper( " abc " );
+ EntityWithArgFunctionAsColumn e2 = new EntityWithArgFunctionAsColumn();
+ e2.setLower( 999 );
+ e2.setUpper( " xyz " );
+ EntityWithFunctionAsColumnHolder holder1 = new EntityWithFunctionAsColumnHolder();
+ holder1.getEntityWithArgFunctionAsColumns().add( e1 );
+ EntityWithFunctionAsColumnHolder holder2 = new EntityWithFunctionAsColumnHolder();
+ holder2.getEntityWithArgFunctionAsColumns().add( e2 );
+ holder1.setNextHolder( holder2 );
+ s.save( holder1 );
+ t.commit();
+ s.close();
+
+ s = openSession();
+ t = s.beginTransaction();
+ holder1 = ( EntityWithFunctionAsColumnHolder ) s.createCriteria( EntityWithFunctionAsColumnHolder.class )
+ .add( Restrictions.isNotNull( "nextHolder" ))
+ .setFetchMode( "entityWithArgFunctionAsColumns", FetchMode.JOIN )
+ .setFetchMode( "nextHolder", FetchMode.JOIN )
+ .setFetchMode( "nextHolder.entityWithArgFunctionAsColumns", FetchMode.JOIN )
+ .uniqueResult();
+ assertTrue( Hibernate.isInitialized( holder1.getEntityWithArgFunctionAsColumns() ) );
+ assertTrue( Hibernate.isInitialized( holder1.getNextHolder() ) );
+ assertTrue( Hibernate.isInitialized( holder1.getNextHolder().getEntityWithArgFunctionAsColumns() ) );
+ assertEquals( 1, holder1.getEntityWithArgFunctionAsColumns().size() );
+ e1 = ( EntityWithArgFunctionAsColumn ) holder1.getEntityWithArgFunctionAsColumns().iterator().next();
+ assertEquals( 3, e1.getLower() );
+ assertEquals( " abc ", e1.getUpper() );
+ assertEquals( 1, holder1.getNextHolder().getEntityWithArgFunctionAsColumns().size() );
+ e2 = ( EntityWithArgFunctionAsColumn ) ( holder1.getNextHolder() ).getEntityWithArgFunctionAsColumns().iterator().next();
+ assertEquals( 999, e2.getLower() );
+ assertEquals( " xyz ", e2.getUpper() );
+ t.commit();
+ s.close();
+
+ cleanup();
+ }
+
+ public void testGetMultiColumnSameNameAsNoArgFunctionHQL() throws Exception {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+ EntityWithNoArgFunctionAsColumn e1 = new EntityWithNoArgFunctionAsColumn();
+ e1.setCurrentDate( "blah blah blah" );
+ EntityWithNoArgFunctionAsColumn e2 = new EntityWithNoArgFunctionAsColumn();
+ e2.setCurrentDate( "yadda yadda yadda" );
+ EntityWithFunctionAsColumnHolder holder1 = new EntityWithFunctionAsColumnHolder();
+ holder1.getEntityWithNoArgFunctionAsColumns().add( e1 );
+ EntityWithFunctionAsColumnHolder holder2 = new EntityWithFunctionAsColumnHolder();
+ holder2.getEntityWithNoArgFunctionAsColumns().add( e2 );
+ holder1.setNextHolder( holder2 );
+ s.save( holder1 );
+ t.commit();
+ s.close();
+
+ s = openSession();
+ t = s.beginTransaction();
+ holder1 = ( EntityWithFunctionAsColumnHolder ) s.createQuery(
+ "from EntityWithFunctionAsColumnHolder h left join fetch h.entityWithNoArgFunctionAsColumns " +
+ "left join fetch h.nextHolder left join fetch h.nextHolder.entityWithNoArgFunctionAsColumns " +
+ "where h.nextHolder is not null" )
+ .uniqueResult();
+ assertTrue( Hibernate.isInitialized( holder1.getEntityWithNoArgFunctionAsColumns() ) );
+ assertTrue( Hibernate.isInitialized( holder1.getNextHolder() ) );
+ assertTrue( Hibernate.isInitialized( holder1.getNextHolder().getEntityWithNoArgFunctionAsColumns() ) );
+ assertEquals( 1, holder1.getEntityWithNoArgFunctionAsColumns().size() );
+ t.commit();
+ s.close();
+
+ e1 = ( EntityWithNoArgFunctionAsColumn ) holder1.getEntityWithNoArgFunctionAsColumns().iterator().next();
+ assertEquals( "blah blah blah", e1.getCurrentDate() );
+ assertEquals( 1, holder1.getNextHolder().getEntityWithNoArgFunctionAsColumns().size() );
+ e2 = ( EntityWithNoArgFunctionAsColumn ) ( holder1.getNextHolder() ).getEntityWithNoArgFunctionAsColumns().iterator().next();
+ assertEquals( "yadda yadda yadda", e2.getCurrentDate() );
+
+ cleanup();
+ }
+
+ public void testGetMultiColumnSameNameAsNoArgFunctionCriteria() {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+ EntityWithNoArgFunctionAsColumn e1 = new EntityWithNoArgFunctionAsColumn();
+ e1.setCurrentDate( "blah blah blah" );
+ EntityWithNoArgFunctionAsColumn e2 = new EntityWithNoArgFunctionAsColumn();
+ e2.setCurrentDate( "yadda yadda yadda" );
+ EntityWithFunctionAsColumnHolder holder1 = new EntityWithFunctionAsColumnHolder();
+ holder1.getEntityWithNoArgFunctionAsColumns().add( e1 );
+ EntityWithFunctionAsColumnHolder holder2 = new EntityWithFunctionAsColumnHolder();
+ holder2.getEntityWithNoArgFunctionAsColumns().add( e2 );
+ holder1.setNextHolder( holder2 );
+ s.save( holder1 );
+ t.commit();
+ s.close();
+
+ s = openSession();
+ t = s.beginTransaction();
+ holder1 = ( EntityWithFunctionAsColumnHolder ) s.createCriteria( EntityWithFunctionAsColumnHolder.class )
+ .add( Restrictions.isNotNull( "nextHolder" ))
+ .setFetchMode( "entityWithNoArgFunctionAsColumns", FetchMode.JOIN )
+ .setFetchMode( "nextHolder", FetchMode.JOIN )
+ .setFetchMode( "nextHolder.entityWithNoArgFunctionAsColumns", FetchMode.JOIN )
+ .uniqueResult();
+ assertTrue( Hibernate.isInitialized( holder1.getEntityWithNoArgFunctionAsColumns() ) );
+ assertTrue( Hibernate.isInitialized( holder1.getNextHolder() ) );
+ assertTrue( Hibernate.isInitialized( holder1.getNextHolder().getEntityWithNoArgFunctionAsColumns() ) );
+ assertEquals( 1, holder1.getEntityWithNoArgFunctionAsColumns().size() );
+ e1 = ( EntityWithNoArgFunctionAsColumn ) holder1.getEntityWithNoArgFunctionAsColumns().iterator().next();
+ assertEquals( "blah blah blah", e1.getCurrentDate() );
+ assertEquals( 1, holder1.getNextHolder().getEntityWithNoArgFunctionAsColumns().size() );
+ e2 = ( EntityWithNoArgFunctionAsColumn ) ( holder1.getNextHolder() ).getEntityWithNoArgFunctionAsColumns().iterator().next();
+ assertEquals( "yadda yadda yadda", e2.getCurrentDate() );
+ t.commit();
+ s.close();
+
+ cleanup();
+ }
+
+ public void testNoArgFcnAndColumnSameNameAsNoArgFunctionHQL() {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+ EntityWithNoArgFunctionAsColumn e1 = new EntityWithNoArgFunctionAsColumn();
+ e1.setCurrentDate( "blah blah blah" );
+ EntityWithNoArgFunctionAsColumn e2 = new EntityWithNoArgFunctionAsColumn();
+ e2.setCurrentDate( "yadda yadda yadda" );
+ EntityWithFunctionAsColumnHolder holder1 = new EntityWithFunctionAsColumnHolder();
+ holder1.getEntityWithNoArgFunctionAsColumns().add( e1 );
+ EntityWithFunctionAsColumnHolder holder2 = new EntityWithFunctionAsColumnHolder();
+ holder2.getEntityWithNoArgFunctionAsColumns().add( e2 );
+ holder1.setNextHolder( holder2 );
+ s.save( holder1 );
+ t.commit();
+ s.close();
+
+ s = openSession();
+ t = s.beginTransaction();
+ List results = s.createQuery(
+ "select str(current_date), currentDate from EntityWithNoArgFunctionAsColumn"
+ ).list();
+ assertEquals( 2, results.size() );
+ assertEquals( ( ( Object[] ) results.get( 0 ) )[ 0 ], ( ( Object[] ) results.get( 1 ) )[ 0 ] );
+ assertTrue( ! ( ( Object[] ) results.get( 0 ) )[ 0 ].equals( ( ( Object[] ) results.get( 0 ) )[ 1 ] ) );
+ assertTrue( ! ( ( Object[] ) results.get( 1 ) )[ 0 ].equals( ( ( Object[] ) results.get( 1 ) )[ 1 ] ) );
+ assertTrue( ( ( Object[] ) results.get( 0 ) )[ 1 ].equals( e1.getCurrentDate() ) ||
+ ( ( Object[] ) results.get( 0 ) )[ 1 ].equals( e2.getCurrentDate() ) );
+ assertTrue( ( ( Object[] ) results.get( 1 ) )[ 1 ].equals( e1.getCurrentDate() ) ||
+ ( ( Object[] ) results.get( 1 ) )[ 1 ].equals( e2.getCurrentDate() ) );
+ assertFalse( ( ( Object[] ) results.get( 0 ) )[ 1 ].equals( ( ( Object[] ) results.get( 1 ) )[ 1 ] ) );
+ t.commit();
+ s.close();
+
+ cleanup();
+ }
+
+ private void cleanup() {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+ s.createQuery( "delete from EntityWithArgFunctionAsColumn" ).executeUpdate();
+ t.commit();
+ s.close();
+
+ s = openSession();
+ t = s.beginTransaction();
+ s.createQuery( "delete from EntityWithNoArgFunctionAsColumn" ).executeUpdate();
+ t.commit();
+ s.close();
+
+ s = openSession();
+ t = s.beginTransaction();
+ s.createQuery( "delete from EntityWithFunctionAsColumnHolder where nextHolder is not null" ).executeUpdate();
+ s.createQuery( "delete from EntityWithFunctionAsColumnHolder" ).executeUpdate();
+ t.commit();
+ s.close();
+ }
+}
Added: core/trunk/testsuite/src/test/java/org/hibernate/test/hql/FunctionNamesAsColumns.hbm.xml
===================================================================
--- core/trunk/testsuite/src/test/java/org/hibernate/test/hql/FunctionNamesAsColumns.hbm.xml (rev 0)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/hql/FunctionNamesAsColumns.hbm.xml 2010-05-06 19:08:18 UTC (rev 19392)
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
+
+<hibernate-mapping package="org.hibernate.test.hql">
+
+ <class name="EntityWithFunctionAsColumnHolder" table="ENTITY_WITH_FN_AS_COL_HOLDER">
+ <id name="id" column="ID" type="long">
+ <generator class="increment"/>
+ </id>
+ <many-to-one name="nextHolder" cascade="all"/>
+ <set name="entityWithArgFunctionAsColumns" inverse="false" lazy="true" cascade="all-delete-orphan">
+ <key column="HOLDER_ID"/>
+ <one-to-many class="EntityWithArgFunctionAsColumn"/>
+ </set>
+ <set name="entityWithNoArgFunctionAsColumns" inverse="false" lazy="true" cascade="all-delete-orphan">
+ <key column="HOLDER_ID"/>
+ <one-to-many class="EntityWithNoArgFunctionAsColumn"/>
+ </set>
+ </class>
+
+ <class name="EntityWithArgFunctionAsColumn" table="ENTITY_WITH_ARG_FN_AS_COL">
+ <id name="id" column="ID" type="long">
+ <generator class="increment"/>
+ </id>
+ <property name="lower" column="lower" type="int"/>
+ <property name="upper" column="upper" type="string"/>
+ </class>
+
+ <class name="EntityWithNoArgFunctionAsColumn" table="ENTITY_WITH_NOARG_FN_AS_COL">
+ <id name="id" column="ID" type="long">
+ <generator class="increment"/>
+ </id>
+ <property name="currentDate" column="`current_date`" type="string"/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
14 years, 7 months
Hibernate SVN: r19391 - core/trunk/jmx/src/main/java/org/hibernate/jmx.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-05-06 13:41:24 -0400 (Thu, 06 May 2010)
New Revision: 19391
Modified:
core/trunk/jmx/src/main/java/org/hibernate/jmx/SessionFactoryStub.java
Log:
HHH-5182 - Inject SessionFactory into "non-basic" Types
Modified: core/trunk/jmx/src/main/java/org/hibernate/jmx/SessionFactoryStub.java
===================================================================
--- core/trunk/jmx/src/main/java/org/hibernate/jmx/SessionFactoryStub.java 2010-05-06 17:13:29 UTC (rev 19390)
+++ core/trunk/jmx/src/main/java/org/hibernate/jmx/SessionFactoryStub.java 2010-05-06 17:41:24 UTC (rev 19391)
@@ -20,6 +20,7 @@
import org.hibernate.SessionFactory;
import org.hibernate.StatelessSession;
import org.hibernate.Cache;
+import org.hibernate.TypeHelper;
import org.hibernate.engine.FilterDefinition;
import org.hibernate.id.IdentifierGenerator;
import org.hibernate.id.UUIDHexGenerator;
@@ -207,4 +208,8 @@
public boolean containsFetchProfileDefinition(String name) {
return getImpl().containsFetchProfileDefinition( name );
}
+
+ public TypeHelper getTypeHelper() {
+ return getImpl().getTypeHelper();
+ }
}
14 years, 7 months
Hibernate SVN: r19390 - in core/branches/Branch_3_5: testsuite/src/test/java/org/hibernate/test/hql and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: gbadner
Date: 2010-05-06 13:13:29 -0400 (Thu, 06 May 2010)
New Revision: 19390
Added:
core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/EntityWithArgFunctionAsColumn.java
core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/EntityWithFunctionAsColumnHolder.java
core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/EntityWithNoArgFunctionAsColumn.java
core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/FunctionNameAsColumnTest.java
core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/FunctionNamesAsColumns.hbm.xml
Modified:
core/branches/Branch_3_5/core/src/main/java/org/hibernate/sql/Template.java
Log:
HHH-5135 : 'Ambiguous column' with columns having the same name as a registered function
Modified: core/branches/Branch_3_5/core/src/main/java/org/hibernate/sql/Template.java
===================================================================
--- core/branches/Branch_3_5/core/src/main/java/org/hibernate/sql/Template.java 2010-05-06 16:23:13 UTC (rev 19389)
+++ core/branches/Branch_3_5/core/src/main/java/org/hibernate/sql/Template.java 2010-05-06 17:13:29 UTC (rev 19390)
@@ -28,6 +28,7 @@
import java.util.StringTokenizer;
import org.hibernate.dialect.Dialect;
+import org.hibernate.dialect.function.SQLFunction;
import org.hibernate.dialect.function.SQLFunctionRegistry;
import org.hibernate.util.StringHelper;
import org.hibernate.sql.ordering.antlr.ColumnMapper;
@@ -317,11 +318,29 @@
private static boolean isFunctionOrKeyword(String lcToken, String nextToken, Dialect dialect, SQLFunctionRegistry functionRegistry) {
return "(".equals(nextToken) ||
KEYWORDS.contains(lcToken) ||
- functionRegistry.hasFunction(lcToken) ||
+ isFunction(lcToken, nextToken, functionRegistry ) ||
dialect.getKeywords().contains(lcToken) ||
FUNCTION_KEYWORDS.contains(lcToken);
}
+ private static boolean isFunction(String lcToken, String nextToken, SQLFunctionRegistry functionRegistry) {
+ // checking for "(" is currently redundant because it is checked before getting here;
+ // doing the check anyhow, in case that earlier check goes away;
+ if ( "(".equals( nextToken ) ) {
+ return true;
+ }
+ SQLFunction function = functionRegistry.findSQLFunction(lcToken);
+ if ( function == null ) {
+ // lcToken does not refer to a function
+ return false;
+ }
+ // if function.hasArguments() and function.hasParenthesesIfNoArguments() is true,
+ // then assume that lcToken is not a function, since it is not followed by "(";
+ // can't seem to use function.hasParenthesesIfNoArguments() alone because
+ // function definitions may return true if "()" is optional when there are no arguments.
+ return function.hasArguments() && function.hasParenthesesIfNoArguments() ? false : true;
+ }
+
private static boolean isIdentifier(String token, Dialect dialect) {
return token.charAt(0)=='`' || ( //allow any identifier quoted with backtick
Character.isLetter( token.charAt(0) ) && //only recognizes identifiers beginning with a letter
Added: core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/EntityWithArgFunctionAsColumn.java
===================================================================
--- core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/EntityWithArgFunctionAsColumn.java (rev 0)
+++ core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/EntityWithArgFunctionAsColumn.java 2010-05-06 17:13:29 UTC (rev 19390)
@@ -0,0 +1,56 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.test.hql;
+
+/**
+ *
+ * @author Gail Badner
+ */
+public class EntityWithArgFunctionAsColumn {
+ private long id;
+ private int lower;
+ private String upper;
+
+ public long getId() {
+ return id;
+ }
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public int getLower() {
+ return lower;
+ }
+ public void setLower(int lower) {
+ this.lower = lower;
+ }
+
+ public String getUpper() {
+ return upper;
+ }
+ public void setUpper(String upper) {
+ this.upper = upper;
+ }
+}
Added: core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/EntityWithFunctionAsColumnHolder.java
===================================================================
--- core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/EntityWithFunctionAsColumnHolder.java (rev 0)
+++ core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/EntityWithFunctionAsColumnHolder.java 2010-05-06 17:13:29 UTC (rev 19390)
@@ -0,0 +1,67 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.test.hql;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ *
+ * @author Gail Badner
+ */
+public class EntityWithFunctionAsColumnHolder {
+ private long id;
+ private EntityWithFunctionAsColumnHolder nextHolder;
+ private Set entityWithArgFunctionAsColumns = new HashSet();
+ private Set entityWithNoArgFunctionAsColumns = new HashSet();
+
+ public long getId() {
+ return id;
+ }
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public EntityWithFunctionAsColumnHolder getNextHolder() {
+ return nextHolder;
+ }
+ public void setNextHolder(EntityWithFunctionAsColumnHolder nextHolder) {
+ this.nextHolder = nextHolder;
+ }
+
+ public Set getEntityWithArgFunctionAsColumns() {
+ return entityWithArgFunctionAsColumns;
+ }
+ public void setEntityWithArgFunctionAsColumns(Set entityWithArgFunctionAsColumns) {
+ this.entityWithArgFunctionAsColumns = entityWithArgFunctionAsColumns;
+ }
+
+ public Set getEntityWithNoArgFunctionAsColumns() {
+ return entityWithNoArgFunctionAsColumns;
+ }
+ public void setEntityWithNoArgFunctionAsColumns(Set entityWithNoArgFunctionAsColumns) {
+ this.entityWithNoArgFunctionAsColumns = entityWithNoArgFunctionAsColumns;
+ }
+}
\ No newline at end of file
Added: core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/EntityWithNoArgFunctionAsColumn.java
===================================================================
--- core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/EntityWithNoArgFunctionAsColumn.java (rev 0)
+++ core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/EntityWithNoArgFunctionAsColumn.java 2010-05-06 17:13:29 UTC (rev 19390)
@@ -0,0 +1,56 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.test.hql;
+
+/**
+ *
+ * @author Gail Badner
+ */
+public class EntityWithNoArgFunctionAsColumn {
+ private long id;
+ private String user;
+ private String currentDate;
+
+ public long getId() {
+ return id;
+ }
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public String getUser() {
+ return user;
+ }
+ public void setUser(String user) {
+ this.user = user;
+ }
+
+ public String getCurrentDate() {
+ return currentDate;
+ }
+ public void setCurrentDate(String currentDate) {
+ this.currentDate = currentDate;
+ }
+}
Added: core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/FunctionNameAsColumnTest.java
===================================================================
--- core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/FunctionNameAsColumnTest.java (rev 0)
+++ core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/FunctionNameAsColumnTest.java 2010-05-06 17:13:29 UTC (rev 19390)
@@ -0,0 +1,332 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2010, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ *
+ */
+package org.hibernate.test.hql;
+
+import java.util.List;
+
+import junit.framework.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.hibernate.FetchMode;
+import org.hibernate.Hibernate;
+import org.hibernate.Session;
+import org.hibernate.Transaction;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.criterion.Restrictions;
+import org.hibernate.junit.functional.FunctionalTestCase;
+import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
+
+/**
+ * Tests HQL and Criteria queries using DB columns having the same name as registerd functions.
+ *
+ * @author Gail Badner
+ */
+public class FunctionNameAsColumnTest extends FunctionalTestCase {
+
+ private static final Logger log = LoggerFactory.getLogger( FunctionNameAsColumnTest.class );
+
+ public FunctionNameAsColumnTest(String name) {
+ super( name );
+ }
+
+ public String[] getMappings() {
+ return new String[] {
+ "hql/FunctionNamesAsColumns.hbm.xml"
+ };
+ }
+
+ public void configure(Configuration cfg) {
+ super.configure( cfg );
+ cfg.setProperty( Environment.USE_QUERY_CACHE, "false" );
+ }
+
+ public static Test suite() {
+ return new FunctionalTestClassTestSuite( FunctionNameAsColumnTest.class );
+ }
+
+ public void testGetOneColumnSameNameAsArgFunctionHQL() {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+ EntityWithArgFunctionAsColumn e = new EntityWithArgFunctionAsColumn();
+ e.setLower( 3 );
+ e.setUpper( " abc " );
+ s.persist( e );
+ t.commit();
+ s.close();
+
+ s = openSession();
+ t = s.beginTransaction();
+ e = ( EntityWithArgFunctionAsColumn ) s.createQuery( "from EntityWithArgFunctionAsColumn" ).uniqueResult();
+ assertEquals( 3, e.getLower() );
+ assertEquals( " abc ", e.getUpper() );
+ t.commit();
+ s.close();
+
+ cleanup();
+ }
+
+ public void testGetOneColumnSameNameAsArgFunctionCriteria() {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+ EntityWithArgFunctionAsColumn e = new EntityWithArgFunctionAsColumn();
+ e.setLower( 3 );
+ e.setUpper( " abc " );
+ s.persist( e );
+ t.commit();
+ s.close();
+
+ s = openSession();
+ t = s.beginTransaction();
+ e = ( EntityWithArgFunctionAsColumn ) s.createCriteria( EntityWithArgFunctionAsColumn.class ).uniqueResult();
+ assertEquals( 3, e.getLower() );
+ assertEquals( " abc ", e.getUpper() );
+ t.commit();
+ s.close();
+
+ cleanup();
+ }
+
+ public void testGetMultiColumnSameNameAsArgFunctionHQL() {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+ EntityWithArgFunctionAsColumn e1 = new EntityWithArgFunctionAsColumn();
+ e1.setLower( 3 );
+ e1.setUpper( " abc " );
+ EntityWithArgFunctionAsColumn e2 = new EntityWithArgFunctionAsColumn();
+ e2.setLower( 999 );
+ e2.setUpper( " xyz " );
+ EntityWithFunctionAsColumnHolder holder1 = new EntityWithFunctionAsColumnHolder();
+ holder1.getEntityWithArgFunctionAsColumns().add( e1 );
+ EntityWithFunctionAsColumnHolder holder2 = new EntityWithFunctionAsColumnHolder();
+ holder2.getEntityWithArgFunctionAsColumns().add( e2 );
+ holder1.setNextHolder( holder2 );
+ s.save( holder1 );
+ t.commit();
+ s.close();
+
+ s = openSession();
+ t = s.beginTransaction();
+ holder1 = ( EntityWithFunctionAsColumnHolder ) s.createQuery(
+ "from EntityWithFunctionAsColumnHolder h left join fetch h.entityWithArgFunctionAsColumns " +
+ "left join fetch h.nextHolder left join fetch h.nextHolder.entityWithArgFunctionAsColumns " +
+ "where h.nextHolder is not null" )
+ .uniqueResult();
+ assertTrue( Hibernate.isInitialized( holder1.getEntityWithArgFunctionAsColumns() ) );
+ assertTrue( Hibernate.isInitialized( holder1.getNextHolder() ) );
+ assertTrue( Hibernate.isInitialized( holder1.getNextHolder().getEntityWithArgFunctionAsColumns() ) );
+ assertEquals( 1, holder1.getEntityWithArgFunctionAsColumns().size() );
+ e1 = ( EntityWithArgFunctionAsColumn ) holder1.getEntityWithArgFunctionAsColumns().iterator().next();
+ assertEquals( 3, e1.getLower() );
+ assertEquals( " abc ", e1.getUpper() );
+ assertEquals( 1, holder1.getNextHolder().getEntityWithArgFunctionAsColumns().size() );
+ e2 = ( EntityWithArgFunctionAsColumn ) ( holder1.getNextHolder() ).getEntityWithArgFunctionAsColumns().iterator().next();
+ assertEquals( 999, e2.getLower() );
+ assertEquals( " xyz ", e2.getUpper() );
+ t.commit();
+ s.close();
+
+ cleanup();
+ }
+
+ public void testGetMultiColumnSameNameAsArgFunctionCriteria() {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+ EntityWithArgFunctionAsColumn e1 = new EntityWithArgFunctionAsColumn();
+ e1.setLower( 3 );
+ e1.setUpper( " abc " );
+ EntityWithArgFunctionAsColumn e2 = new EntityWithArgFunctionAsColumn();
+ e2.setLower( 999 );
+ e2.setUpper( " xyz " );
+ EntityWithFunctionAsColumnHolder holder1 = new EntityWithFunctionAsColumnHolder();
+ holder1.getEntityWithArgFunctionAsColumns().add( e1 );
+ EntityWithFunctionAsColumnHolder holder2 = new EntityWithFunctionAsColumnHolder();
+ holder2.getEntityWithArgFunctionAsColumns().add( e2 );
+ holder1.setNextHolder( holder2 );
+ s.save( holder1 );
+ t.commit();
+ s.close();
+
+ s = openSession();
+ t = s.beginTransaction();
+ holder1 = ( EntityWithFunctionAsColumnHolder ) s.createCriteria( EntityWithFunctionAsColumnHolder.class )
+ .add( Restrictions.isNotNull( "nextHolder" ))
+ .setFetchMode( "entityWithArgFunctionAsColumns", FetchMode.JOIN )
+ .setFetchMode( "nextHolder", FetchMode.JOIN )
+ .setFetchMode( "nextHolder.entityWithArgFunctionAsColumns", FetchMode.JOIN )
+ .uniqueResult();
+ assertTrue( Hibernate.isInitialized( holder1.getEntityWithArgFunctionAsColumns() ) );
+ assertTrue( Hibernate.isInitialized( holder1.getNextHolder() ) );
+ assertTrue( Hibernate.isInitialized( holder1.getNextHolder().getEntityWithArgFunctionAsColumns() ) );
+ assertEquals( 1, holder1.getEntityWithArgFunctionAsColumns().size() );
+ e1 = ( EntityWithArgFunctionAsColumn ) holder1.getEntityWithArgFunctionAsColumns().iterator().next();
+ assertEquals( 3, e1.getLower() );
+ assertEquals( " abc ", e1.getUpper() );
+ assertEquals( 1, holder1.getNextHolder().getEntityWithArgFunctionAsColumns().size() );
+ e2 = ( EntityWithArgFunctionAsColumn ) ( holder1.getNextHolder() ).getEntityWithArgFunctionAsColumns().iterator().next();
+ assertEquals( 999, e2.getLower() );
+ assertEquals( " xyz ", e2.getUpper() );
+ t.commit();
+ s.close();
+
+ cleanup();
+ }
+
+ public void testGetMultiColumnSameNameAsNoArgFunctionHQL() throws Exception {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+ EntityWithNoArgFunctionAsColumn e1 = new EntityWithNoArgFunctionAsColumn();
+ e1.setCurrentDate( "blah blah blah" );
+ EntityWithNoArgFunctionAsColumn e2 = new EntityWithNoArgFunctionAsColumn();
+ e2.setCurrentDate( "yadda yadda yadda" );
+ EntityWithFunctionAsColumnHolder holder1 = new EntityWithFunctionAsColumnHolder();
+ holder1.getEntityWithNoArgFunctionAsColumns().add( e1 );
+ EntityWithFunctionAsColumnHolder holder2 = new EntityWithFunctionAsColumnHolder();
+ holder2.getEntityWithNoArgFunctionAsColumns().add( e2 );
+ holder1.setNextHolder( holder2 );
+ s.save( holder1 );
+ t.commit();
+ s.close();
+
+ s = openSession();
+ t = s.beginTransaction();
+ holder1 = ( EntityWithFunctionAsColumnHolder ) s.createQuery(
+ "from EntityWithFunctionAsColumnHolder h left join fetch h.entityWithNoArgFunctionAsColumns " +
+ "left join fetch h.nextHolder left join fetch h.nextHolder.entityWithNoArgFunctionAsColumns " +
+ "where h.nextHolder is not null" )
+ .uniqueResult();
+ assertTrue( Hibernate.isInitialized( holder1.getEntityWithNoArgFunctionAsColumns() ) );
+ assertTrue( Hibernate.isInitialized( holder1.getNextHolder() ) );
+ assertTrue( Hibernate.isInitialized( holder1.getNextHolder().getEntityWithNoArgFunctionAsColumns() ) );
+ assertEquals( 1, holder1.getEntityWithNoArgFunctionAsColumns().size() );
+ t.commit();
+ s.close();
+
+ e1 = ( EntityWithNoArgFunctionAsColumn ) holder1.getEntityWithNoArgFunctionAsColumns().iterator().next();
+ assertEquals( "blah blah blah", e1.getCurrentDate() );
+ assertEquals( 1, holder1.getNextHolder().getEntityWithNoArgFunctionAsColumns().size() );
+ e2 = ( EntityWithNoArgFunctionAsColumn ) ( holder1.getNextHolder() ).getEntityWithNoArgFunctionAsColumns().iterator().next();
+ assertEquals( "yadda yadda yadda", e2.getCurrentDate() );
+
+ cleanup();
+ }
+
+ public void testGetMultiColumnSameNameAsNoArgFunctionCriteria() {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+ EntityWithNoArgFunctionAsColumn e1 = new EntityWithNoArgFunctionAsColumn();
+ e1.setCurrentDate( "blah blah blah" );
+ EntityWithNoArgFunctionAsColumn e2 = new EntityWithNoArgFunctionAsColumn();
+ e2.setCurrentDate( "yadda yadda yadda" );
+ EntityWithFunctionAsColumnHolder holder1 = new EntityWithFunctionAsColumnHolder();
+ holder1.getEntityWithNoArgFunctionAsColumns().add( e1 );
+ EntityWithFunctionAsColumnHolder holder2 = new EntityWithFunctionAsColumnHolder();
+ holder2.getEntityWithNoArgFunctionAsColumns().add( e2 );
+ holder1.setNextHolder( holder2 );
+ s.save( holder1 );
+ t.commit();
+ s.close();
+
+ s = openSession();
+ t = s.beginTransaction();
+ holder1 = ( EntityWithFunctionAsColumnHolder ) s.createCriteria( EntityWithFunctionAsColumnHolder.class )
+ .add( Restrictions.isNotNull( "nextHolder" ))
+ .setFetchMode( "entityWithNoArgFunctionAsColumns", FetchMode.JOIN )
+ .setFetchMode( "nextHolder", FetchMode.JOIN )
+ .setFetchMode( "nextHolder.entityWithNoArgFunctionAsColumns", FetchMode.JOIN )
+ .uniqueResult();
+ assertTrue( Hibernate.isInitialized( holder1.getEntityWithNoArgFunctionAsColumns() ) );
+ assertTrue( Hibernate.isInitialized( holder1.getNextHolder() ) );
+ assertTrue( Hibernate.isInitialized( holder1.getNextHolder().getEntityWithNoArgFunctionAsColumns() ) );
+ assertEquals( 1, holder1.getEntityWithNoArgFunctionAsColumns().size() );
+ e1 = ( EntityWithNoArgFunctionAsColumn ) holder1.getEntityWithNoArgFunctionAsColumns().iterator().next();
+ assertEquals( "blah blah blah", e1.getCurrentDate() );
+ assertEquals( 1, holder1.getNextHolder().getEntityWithNoArgFunctionAsColumns().size() );
+ e2 = ( EntityWithNoArgFunctionAsColumn ) ( holder1.getNextHolder() ).getEntityWithNoArgFunctionAsColumns().iterator().next();
+ assertEquals( "yadda yadda yadda", e2.getCurrentDate() );
+ t.commit();
+ s.close();
+
+ cleanup();
+ }
+
+ public void testNoArgFcnAndColumnSameNameAsNoArgFunctionHQL() {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+ EntityWithNoArgFunctionAsColumn e1 = new EntityWithNoArgFunctionAsColumn();
+ e1.setCurrentDate( "blah blah blah" );
+ EntityWithNoArgFunctionAsColumn e2 = new EntityWithNoArgFunctionAsColumn();
+ e2.setCurrentDate( "yadda yadda yadda" );
+ EntityWithFunctionAsColumnHolder holder1 = new EntityWithFunctionAsColumnHolder();
+ holder1.getEntityWithNoArgFunctionAsColumns().add( e1 );
+ EntityWithFunctionAsColumnHolder holder2 = new EntityWithFunctionAsColumnHolder();
+ holder2.getEntityWithNoArgFunctionAsColumns().add( e2 );
+ holder1.setNextHolder( holder2 );
+ s.save( holder1 );
+ t.commit();
+ s.close();
+
+ s = openSession();
+ t = s.beginTransaction();
+ List results = s.createQuery(
+ "select str(current_date), currentDate from EntityWithNoArgFunctionAsColumn"
+ ).list();
+ assertEquals( 2, results.size() );
+ assertEquals( ( ( Object[] ) results.get( 0 ) )[ 0 ], ( ( Object[] ) results.get( 1 ) )[ 0 ] );
+ assertTrue( ! ( ( Object[] ) results.get( 0 ) )[ 0 ].equals( ( ( Object[] ) results.get( 0 ) )[ 1 ] ) );
+ assertTrue( ! ( ( Object[] ) results.get( 1 ) )[ 0 ].equals( ( ( Object[] ) results.get( 1 ) )[ 1 ] ) );
+ assertTrue( ( ( Object[] ) results.get( 0 ) )[ 1 ].equals( e1.getCurrentDate() ) ||
+ ( ( Object[] ) results.get( 0 ) )[ 1 ].equals( e2.getCurrentDate() ) );
+ assertTrue( ( ( Object[] ) results.get( 1 ) )[ 1 ].equals( e1.getCurrentDate() ) ||
+ ( ( Object[] ) results.get( 1 ) )[ 1 ].equals( e2.getCurrentDate() ) );
+ assertFalse( ( ( Object[] ) results.get( 0 ) )[ 1 ].equals( ( ( Object[] ) results.get( 1 ) )[ 1 ] ) );
+ t.commit();
+ s.close();
+
+ cleanup();
+ }
+
+ private void cleanup() {
+ Session s = openSession();
+ Transaction t = s.beginTransaction();
+ s.createQuery( "delete from EntityWithArgFunctionAsColumn" ).executeUpdate();
+ t.commit();
+ s.close();
+
+ s = openSession();
+ t = s.beginTransaction();
+ s.createQuery( "delete from EntityWithNoArgFunctionAsColumn" ).executeUpdate();
+ t.commit();
+ s.close();
+
+ s = openSession();
+ t = s.beginTransaction();
+ s.createQuery( "delete from EntityWithFunctionAsColumnHolder where nextHolder is not null" ).executeUpdate();
+ s.createQuery( "delete from EntityWithFunctionAsColumnHolder" ).executeUpdate();
+ t.commit();
+ s.close();
+ }
+}
Copied: core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/FunctionNamesAsColumns.hbm.xml (from rev 19326, core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/CrazyIdFieldNames.hbm.xml)
===================================================================
--- core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/FunctionNamesAsColumns.hbm.xml (rev 0)
+++ core/branches/Branch_3_5/testsuite/src/test/java/org/hibernate/test/hql/FunctionNamesAsColumns.hbm.xml 2010-05-06 17:13:29 UTC (rev 19390)
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE hibernate-mapping SYSTEM "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
+
+<hibernate-mapping package="org.hibernate.test.hql">
+
+ <class name="EntityWithFunctionAsColumnHolder" table="ENTITY_WITH_FN_AS_COL_HOLDER">
+ <id name="id" column="ID" type="long">
+ <generator class="increment"/>
+ </id>
+ <many-to-one name="nextHolder" cascade="all"/>
+ <set name="entityWithArgFunctionAsColumns" inverse="false" lazy="true" cascade="all-delete-orphan">
+ <key column="HOLDER_ID"/>
+ <one-to-many class="EntityWithArgFunctionAsColumn"/>
+ </set>
+ <set name="entityWithNoArgFunctionAsColumns" inverse="false" lazy="true" cascade="all-delete-orphan">
+ <key column="HOLDER_ID"/>
+ <one-to-many class="EntityWithNoArgFunctionAsColumn"/>
+ </set>
+ </class>
+
+ <class name="EntityWithArgFunctionAsColumn" table="ENTITY_WITH_ARG_FN_AS_COL">
+ <id name="id" column="ID" type="long">
+ <generator class="increment"/>
+ </id>
+ <property name="lower" column="lower" type="int"/>
+ <property name="upper" column="upper" type="string"/>
+ </class>
+
+ <class name="EntityWithNoArgFunctionAsColumn" table="ENTITY_WITH_NOARG_FN_AS_COL">
+ <id name="id" column="ID" type="long">
+ <generator class="increment"/>
+ </id>
+ <property name="currentDate" column="`current_date`" type="string"/>
+ </class>
+
+</hibernate-mapping>
\ No newline at end of file
14 years, 7 months
Hibernate SVN: r19389 - core/trunk/core/src/main/java/org/hibernate/type.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-05-06 12:23:13 -0400 (Thu, 06 May 2010)
New Revision: 19389
Modified:
core/trunk/core/src/main/java/org/hibernate/type/CalendarDateType.java
Log:
HHH-5138 - Redesign types + introduce TypeRegistry & TypeResolver
Modified: core/trunk/core/src/main/java/org/hibernate/type/CalendarDateType.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/type/CalendarDateType.java 2010-05-06 16:12:24 UTC (rev 19388)
+++ core/trunk/core/src/main/java/org/hibernate/type/CalendarDateType.java 2010-05-06 16:23:13 UTC (rev 19389)
@@ -25,7 +25,7 @@
import java.util.Calendar;
-import org.hibernate.type.descriptor.java.CalendarTypeDescriptor;
+import org.hibernate.type.descriptor.java.CalendarDateTypeDescriptor;
import org.hibernate.type.descriptor.sql.DateTypeDescriptor;
/**
@@ -38,7 +38,7 @@
public static final CalendarDateType INSTANCE = new CalendarDateType();
public CalendarDateType() {
- super( DateTypeDescriptor.INSTANCE, CalendarTypeDescriptor.INSTANCE );
+ super( DateTypeDescriptor.INSTANCE, CalendarDateTypeDescriptor.INSTANCE );
}
public String getName() {
14 years, 7 months
Hibernate SVN: r19388 - core/trunk/parent.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-05-06 12:12:24 -0400 (Thu, 06 May 2010)
New Revision: 19388
Modified:
core/trunk/parent/pom.xml
Log:
HHH-5200 - Prepare to use H2 as the default testing datbase
Modified: core/trunk/parent/pom.xml
===================================================================
--- core/trunk/parent/pom.xml 2010-05-06 14:53:09 UTC (rev 19387)
+++ core/trunk/parent/pom.xml 2010-05-06 16:12:24 UTC (rev 19388)
@@ -598,7 +598,7 @@
<properties>
<db.dialect>org.hibernate.dialect.H2Dialect</db.dialect>
<jdbc.driver>org.h2.Driver</jdbc.driver>
- <jdbc.url>jdbc:h2:mem:db1</jdbc.url>
+ <jdbc.url>jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1</jdbc.url>
<jdbc.user>sa</jdbc.user>
<jdbc.pass />
<jdbc.isolation />
14 years, 7 months
Hibernate SVN: r19387 - core/trunk/core/src/main/java/org/hibernate/dialect.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-05-06 10:53:09 -0400 (Thu, 06 May 2010)
New Revision: 19387
Modified:
core/trunk/core/src/main/java/org/hibernate/dialect/H2Dialect.java
Log:
HHH-3377 - Update H2Dialect to use DECIMAL SQL type instead of NUMERIC
Modified: core/trunk/core/src/main/java/org/hibernate/dialect/H2Dialect.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/dialect/H2Dialect.java 2010-05-06 14:51:19 UTC (rev 19386)
+++ core/trunk/core/src/main/java/org/hibernate/dialect/H2Dialect.java 2010-05-06 14:53:09 UTC (rev 19387)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -68,6 +68,7 @@
registerColumnType( Types.CHAR, "char($l)" );
registerColumnType( Types.DATE, "date" );
registerColumnType( Types.DECIMAL, "decimal($p,$s)" );
+ registerColumnType( Types.NUMERIC, "decimal($p,$s)" );
registerColumnType( Types.DOUBLE, "double" );
registerColumnType( Types.FLOAT, "float" );
registerColumnType( Types.INTEGER, "integer" );
@@ -80,7 +81,6 @@
registerColumnType( Types.TIMESTAMP, "timestamp" );
registerColumnType( Types.VARCHAR, "varchar($l)" );
registerColumnType( Types.VARBINARY, "binary($l)" );
- registerColumnType( Types.NUMERIC, "numeric" );
registerColumnType( Types.BLOB, "blob" );
registerColumnType( Types.CLOB, "clob" );
14 years, 7 months
Hibernate SVN: r19386 - core/branches/Branch_3_5/core/src/main/java/org/hibernate/dialect.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-05-06 10:51:19 -0400 (Thu, 06 May 2010)
New Revision: 19386
Modified:
core/branches/Branch_3_5/core/src/main/java/org/hibernate/dialect/H2Dialect.java
Log:
HHH-3377 - Update H2Dialect to use DECIMAL SQL type instead of NUMERIC
Modified: core/branches/Branch_3_5/core/src/main/java/org/hibernate/dialect/H2Dialect.java
===================================================================
--- core/branches/Branch_3_5/core/src/main/java/org/hibernate/dialect/H2Dialect.java 2010-05-06 13:34:06 UTC (rev 19385)
+++ core/branches/Branch_3_5/core/src/main/java/org/hibernate/dialect/H2Dialect.java 2010-05-06 14:51:19 UTC (rev 19386)
@@ -1,10 +1,10 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * Copyright (c) 2010, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
+ * distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
@@ -68,6 +68,7 @@
registerColumnType( Types.CHAR, "char($l)" );
registerColumnType( Types.DATE, "date" );
registerColumnType( Types.DECIMAL, "decimal($p,$s)" );
+ registerColumnType( Types.NUMERIC, "decimal($p,$s)" );
registerColumnType( Types.DOUBLE, "double" );
registerColumnType( Types.FLOAT, "float" );
registerColumnType( Types.INTEGER, "integer" );
@@ -80,7 +81,6 @@
registerColumnType( Types.TIMESTAMP, "timestamp" );
registerColumnType( Types.VARCHAR, "varchar($l)" );
registerColumnType( Types.VARBINARY, "binary($l)" );
- registerColumnType( Types.NUMERIC, "numeric" );
registerColumnType( Types.BLOB, "blob" );
registerColumnType( Types.CLOB, "clob" );
14 years, 7 months
Hibernate SVN: r19385 - core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-05-06 09:34:06 -0400 (Thu, 06 May 2010)
New Revision: 19385
Modified:
core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/ArrayBinder.java
core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java
core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/IdBagBinder.java
core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/ListBinder.java
core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/MapBinder.java
core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/PrimitiveArrayBinder.java
core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/SetBinder.java
Log:
HHH-5182 - Inject SessionFactory into "non-basic" Types
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/ArrayBinder.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/ArrayBinder.java 2010-05-06 13:16:48 UTC (rev 19384)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/ArrayBinder.java 2010-05-06 13:34:06 UTC (rev 19385)
@@ -38,6 +38,6 @@
}
protected Collection createCollection(PersistentClass persistentClass) {
- return new Array( persistentClass );
+ return new Array( getMappings(), persistentClass );
}
}
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java 2010-05-06 13:16:48 UTC (rev 19384)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java 2010-05-06 13:34:06 UTC (rev 19385)
@@ -225,7 +225,9 @@
public void setSqlOrderBy(OrderBy orderByAnn) {
if ( orderByAnn != null ) {
- if ( !BinderHelper.isDefault( orderByAnn.clause() ) ) orderBy = orderByAnn.clause();
+ if ( !BinderHelper.isDefault( orderByAnn.clause() ) ) {
+ orderBy = orderByAnn.clause();
+ }
}
}
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/IdBagBinder.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/IdBagBinder.java 2010-05-06 13:16:48 UTC (rev 19384)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/IdBagBinder.java 2010-05-06 13:34:06 UTC (rev 19385)
@@ -50,7 +50,7 @@
*/
public class IdBagBinder extends BagBinder {
protected Collection createCollection(PersistentClass persistentClass) {
- return new org.hibernate.mapping.IdentifierBag( persistentClass );
+ return new org.hibernate.mapping.IdentifierBag( getMappings(), persistentClass );
}
@Override
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/ListBinder.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/ListBinder.java 2010-05-06 13:16:48 UTC (rev 19384)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/ListBinder.java 2010-05-06 13:34:06 UTC (rev 19385)
@@ -63,7 +63,7 @@
}
protected Collection createCollection(PersistentClass persistentClass) {
- return new org.hibernate.mapping.List( persistentClass );
+ return new org.hibernate.mapping.List( getMappings(), persistentClass );
}
public void setSqlOrderBy(OrderBy orderByAnn) {
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/MapBinder.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/MapBinder.java 2010-05-06 13:16:48 UTC (rev 19384)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/MapBinder.java 2010-05-06 13:34:06 UTC (rev 19385)
@@ -88,7 +88,7 @@
}
protected Collection createCollection(PersistentClass persistentClass) {
- return new org.hibernate.mapping.Map( persistentClass );
+ return new org.hibernate.mapping.Map( getMappings(), persistentClass );
}
@Override
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/PrimitiveArrayBinder.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/PrimitiveArrayBinder.java 2010-05-06 13:16:48 UTC (rev 19384)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/PrimitiveArrayBinder.java 2010-05-06 13:34:06 UTC (rev 19385)
@@ -33,6 +33,6 @@
public class PrimitiveArrayBinder extends ArrayBinder {
@Override
protected Collection createCollection(PersistentClass persistentClass) {
- return new PrimitiveArray( persistentClass );
+ return new PrimitiveArray( getMappings(), persistentClass );
}
}
Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/SetBinder.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/SetBinder.java 2010-05-06 13:16:48 UTC (rev 19384)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/annotations/SetBinder.java 2010-05-06 13:34:06 UTC (rev 19385)
@@ -46,10 +46,11 @@
}
protected Collection createCollection(PersistentClass persistentClass) {
- return new org.hibernate.mapping.Set( persistentClass );
+ return new org.hibernate.mapping.Set( getMappings(), persistentClass );
}
public void setSqlOrderBy(OrderBy orderByAnn) {
+ // *annotation* binder, jdk 1.5, ... am i missing something?
if ( orderByAnn != null ) {
if ( Environment.jvmSupportsLinkedHashCollections() ) {
super.setSqlOrderBy( orderByAnn );
14 years, 7 months
Hibernate SVN: r19384 - in core/branches/Branch_3_5/core/src/main/java/org/hibernate: type and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-05-06 09:16:48 -0400 (Thu, 06 May 2010)
New Revision: 19384
Modified:
core/branches/Branch_3_5/core/src/main/java/org/hibernate/Hibernate.java
core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/AbstractBynaryType.java
core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/AbstractCharArrayType.java
core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/AbstractLongBinaryType.java
core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/AbstractLongStringType.java
core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/CharBooleanType.java
core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/ImmutableType.java
core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/MutableType.java
core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/NullableType.java
core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/TypeFactory.java
Log:
HHH-5196 - Deprecate Type methods on org.hibernate.Hibernate
Modified: core/branches/Branch_3_5/core/src/main/java/org/hibernate/Hibernate.java
===================================================================
--- core/branches/Branch_3_5/core/src/main/java/org/hibernate/Hibernate.java 2010-05-06 12:23:42 UTC (rev 19383)
+++ core/branches/Branch_3_5/core/src/main/java/org/hibernate/Hibernate.java 2010-05-06 13:16:48 UTC (rev 19384)
@@ -104,138 +104,206 @@
/**
* Hibernate <tt>long</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType LONG = new LongType();
/**
* Hibernate <tt>short</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType SHORT = new ShortType();
/**
* Hibernate <tt>integer</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType INTEGER = new IntegerType();
/**
* Hibernate <tt>byte</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType BYTE = new ByteType();
/**
* Hibernate <tt>float</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType FLOAT = new FloatType();
/**
* Hibernate <tt>double</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType DOUBLE = new DoubleType();
/**
* Hibernate <tt>character</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType CHARACTER = new CharacterType();
/**
* Hibernate <tt>string</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType STRING = new StringType();
/**
* Hibernate <tt>time</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType TIME = new TimeType();
/**
* Hibernate <tt>date</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType DATE = new DateType();
/**
* Hibernate <tt>timestamp</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType TIMESTAMP = new TimestampType();
/**
* Hibernate <tt>boolean</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType BOOLEAN = new BooleanType();
/**
* Hibernate <tt>true_false</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType TRUE_FALSE = new TrueFalseType();
/**
* Hibernate <tt>yes_no</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType YES_NO = new YesNoType();
/**
* Hibernate <tt>big_decimal</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType BIG_DECIMAL = new BigDecimalType();
/**
* Hibernate <tt>big_integer</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType BIG_INTEGER = new BigIntegerType();
/**
* Hibernate <tt>binary</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType BINARY = new BinaryType();
/**
* Hibernate <tt>wrapper-binary</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType WRAPPER_BINARY = new WrapperBinaryType();
/**
* Hibernate char[] type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType CHAR_ARRAY = new CharArrayType();
/**
* Hibernate Character[] type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType CHARACTER_ARRAY = new CharacterArrayType();
/**
* Hibernate <tt>image</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType IMAGE = new ImageType();
/**
* Hibernate <tt>text</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType TEXT = new TextType();
/**
* Hibernate <tt>materialized_blob</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType MATERIALIZED_BLOB = new MaterializedBlobType();
/**
* Hibernate <tt>materialized_clob</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType MATERIALIZED_CLOB = new MaterializedClobType();
/**
* Hibernate <tt>blob</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final Type BLOB = new BlobType();
/**
* Hibernate <tt>clob</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final Type CLOB = new ClobType();
/**
* Hibernate <tt>calendar</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType CALENDAR = new CalendarType();
/**
* Hibernate <tt>calendar_date</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType CALENDAR_DATE = new CalendarDateType();
/**
* Hibernate <tt>locale</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType LOCALE = new LocaleType();
/**
* Hibernate <tt>currency</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType CURRENCY = new CurrencyType();
/**
* Hibernate <tt>timezone</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType TIMEZONE = new TimeZoneType();
/**
* Hibernate <tt>class</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType CLASS = new ClassType();
/**
* Hibernate <tt>serializable</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final NullableType SERIALIZABLE = new SerializableType( Serializable.class );
/**
* Hibernate <tt>object</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static final Type OBJECT = new AnyType();
@@ -249,6 +317,8 @@
/**
* A Hibernate <tt>serializable</tt> type.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static Type serializable(Class serializableClass) {
return new SerializableType( serializableClass );
@@ -260,6 +330,8 @@
* @param metaType a type mapping <tt>java.lang.Class</tt> to a single column
* @param identifierType the entity identifier type
* @return the Type
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5182
*/
public static Type any(Type metaType, Type identifierType) {
return new AnyType( metaType, identifierType );
@@ -269,6 +341,8 @@
* A Hibernate persistent object (entity) type.
*
* @param persistentClass a mapped entity class
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5182
*/
public static Type entity(Class persistentClass) {
// not really a many-to-one association *necessarily*
@@ -279,6 +353,8 @@
* A Hibernate persistent object (entity) type.
*
* @param entityName a mapped entity class
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5182
*/
public static Type entity(String entityName) {
// not really a many-to-one association *necessarily*
@@ -289,6 +365,8 @@
* A Hibernate custom type.
*
* @param userTypeClass a class that implements <tt>UserType</tt>
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5182
*/
public static Type custom(Class userTypeClass) throws HibernateException {
return custom( userTypeClass, null );
@@ -301,6 +379,8 @@
* @param parameterNames the names of the parameters passed to the type
* @param parameterValues the values of the parameters passed to the type. They must match
* up with the order and length of the parameterNames array.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5182
*/
public static Type custom(Class userTypeClass, String[] parameterNames, String[] parameterValues)
throws HibernateException {
@@ -316,6 +396,8 @@
*
* @param userTypeClass a class that implements <tt>UserType and ParameterizableType</tt>
* @param parameters the parameters as a collection of name/value pairs
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5182
*/
public static Type custom(Class userTypeClass, Properties parameters)
throws HibernateException {
Modified: core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/AbstractBynaryType.java
===================================================================
--- core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/AbstractBynaryType.java 2010-05-06 12:23:42 UTC (rev 19383)
+++ core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/AbstractBynaryType.java 2010-05-06 13:16:48 UTC (rev 19384)
@@ -44,6 +44,8 @@
*
* @author Gavin King
* @author Emmanuel Bernard
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public abstract class AbstractBynaryType extends MutableType implements VersionType, Comparator {
Modified: core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/AbstractCharArrayType.java
===================================================================
--- core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/AbstractCharArrayType.java 2010-05-06 12:23:42 UTC (rev 19383)
+++ core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/AbstractCharArrayType.java 2010-05-06 13:16:48 UTC (rev 19384)
@@ -40,6 +40,8 @@
* Logic to bind stream of char into a VARCHAR
*
* @author Emmanuel Bernard
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public abstract class AbstractCharArrayType extends MutableType {
Modified: core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/AbstractLongBinaryType.java
===================================================================
--- core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/AbstractLongBinaryType.java 2010-05-06 12:23:42 UTC (rev 19383)
+++ core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/AbstractLongBinaryType.java 2010-05-06 13:16:48 UTC (rev 19384)
@@ -29,6 +29,8 @@
* An abstract type for mapping long binary SQL types to Java byte[].
*
* @author Gail Badner
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public abstract class AbstractLongBinaryType extends AbstractBynaryType {
Modified: core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/AbstractLongStringType.java
===================================================================
--- core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/AbstractLongStringType.java 2010-05-06 12:23:42 UTC (rev 19383)
+++ core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/AbstractLongStringType.java 2010-05-06 13:16:48 UTC (rev 19384)
@@ -37,6 +37,8 @@
/**
* An abstract type for mapping long string SQL types to a Java String.
* @author Gavin King, Bertrand Renuart (from TextType)
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public abstract class AbstractLongStringType extends ImmutableType {
Modified: core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/CharBooleanType.java
===================================================================
--- core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/CharBooleanType.java 2010-05-06 12:23:42 UTC (rev 19383)
+++ core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/CharBooleanType.java 2010-05-06 13:16:48 UTC (rev 19384)
@@ -36,6 +36,8 @@
/**
* Superclass for types that map Java boolean to SQL CHAR(1).
* @author Gavin King
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public abstract class CharBooleanType extends BooleanType {
Modified: core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/ImmutableType.java
===================================================================
--- core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/ImmutableType.java 2010-05-06 12:23:42 UTC (rev 19383)
+++ core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/ImmutableType.java 2010-05-06 13:16:48 UTC (rev 19384)
@@ -34,6 +34,8 @@
/**
* Superclass of nullable immutable types.
* @author Gavin King
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public abstract class ImmutableType extends NullableType {
Modified: core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/MutableType.java
===================================================================
--- core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/MutableType.java 2010-05-06 12:23:42 UTC (rev 19383)
+++ core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/MutableType.java 2010-05-06 13:16:48 UTC (rev 19384)
@@ -34,6 +34,8 @@
/**
* Superclass for mutable nullable types
* @author Gavin King
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public abstract class MutableType extends NullableType {
Modified: core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/NullableType.java
===================================================================
--- core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/NullableType.java 2010-05-06 12:23:42 UTC (rev 19383)
+++ core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/NullableType.java 2010-05-06 13:16:48 UTC (rev 19384)
@@ -45,6 +45,8 @@
* Superclass of single-column nullable types.
*
* @author Gavin King
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public abstract class NullableType extends AbstractType {
Modified: core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/TypeFactory.java
===================================================================
--- core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/TypeFactory.java 2010-05-06 12:23:42 UTC (rev 19383)
+++ core/branches/Branch_3_5/core/src/main/java/org/hibernate/type/TypeFactory.java 2010-05-06 13:16:48 UTC (rev 19384)
@@ -247,6 +247,8 @@
/**
* Given the name of a Hibernate basic type, return an instance of
* <tt>org.hibernate.type.Type</tt>.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static Type basic(String name) {
return (Type) BASIC_TYPES.get( name );
@@ -255,6 +257,8 @@
/**
* Uses heuristics to deduce a Hibernate type given a string naming the type or Java class.
* Return an instance of <tt>org.hibernate.type.Type</tt>.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static Type heuristicType(String typeName) throws MappingException {
return heuristicType( typeName, null );
@@ -263,6 +267,8 @@
/**
* Uses heuristics to deduce a Hibernate type given a string naming the type or Java class.
* Return an instance of <tt>org.hibernate.type.Type</tt>.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static Type heuristicType(String typeName, Properties parameters)
throws MappingException {
@@ -407,6 +413,8 @@
* @param copy an array indicating which values to include in the copy
* @param target The array into which to copy the values
* @param session The orginating session
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static void deepCopy(
final Object[] values,
@@ -434,6 +442,8 @@
* @param row The values
* @param types The value types
* @param session The orginating session
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static void beforeAssemble(
final Serializable[] row,
@@ -455,6 +465,8 @@
* @param session The orginating session
* @param owner The entity "owning" the values
* @return The assembled state
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static Object[] assemble(
final Serializable[] row,
@@ -482,6 +494,8 @@
* @param session The orginating session
* @param owner The entity "owning" the values
* @return The disassembled state
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static Serializable[] disassemble(
final Object[] row,
@@ -514,6 +528,8 @@
* @param owner The entity "owning" the values
* @param copyCache A map representing a cache of already replaced state
* @return The replaced state
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static Object[] replace(
final Object[] original,
@@ -546,6 +562,8 @@
* @param copyCache A map representing a cache of already replaced state
* @param foreignKeyDirection FK directionality to be applied to the replacement
* @return The replaced state
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static Object[] replace(
final Object[] original,
@@ -583,6 +601,8 @@
* @param copyCache A map representing a cache of already replaced state
* @param foreignKeyDirection FK directionality to be applied to the replacement
* @return The replaced state
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static Object[] replaceAssociations(
final Object[] original,
@@ -630,6 +650,8 @@
* @param anyUninitializedProperties Does the entity currently hold any uninitialized property values?
* @param session The session from which the dirty check request originated.
* @return Array containing indices of the dirty properties, or null if no properties considered dirty.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static int[] findDirty(
final StandardProperty[] properties,
@@ -677,6 +699,8 @@
* @param anyUninitializedProperties Does the entity currently hold any uninitialized property values?
* @param session The session from which the dirty check request originated.
* @return Array containing indices of the modified properties, or null if no properties considered modified.
+ *
+ * @deprecated see http://opensource.atlassian.com/projects/hibernate/browse/HHH-5138
*/
public static int[] findModified(
final StandardProperty[] properties,
14 years, 7 months
Hibernate SVN: r19383 - validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2010-05-06 08:23:42 -0400 (Thu, 06 May 2010)
New Revision: 19383
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Book.java
Log:
HV-305 fixed test
Modified: validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Book.java
===================================================================
--- validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Book.java 2010-05-06 11:21:23 UTC (rev 19382)
+++ validator/trunk/hibernate-validator/src/test/java/org/hibernate/validator/engine/traversableresolver/Book.java 2010-05-06 12:23:42 UTC (rev 19383)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
/*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual contributors
@@ -20,7 +20,6 @@
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
-import javax.validation.constraints.NotNull;
/**
* @author Hardy Ferentschik
@@ -32,7 +31,6 @@
public Long id;
@ManyToOne
- @NotNull
public Author author;
}
14 years, 7 months