HHH-5135 : 'Ambiguous column' with columns having the same name as a registered function

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@19392 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Gail Badner 2010-05-06 19:08:18 +00:00
parent 60c280441b
commit 0884b16946
6 changed files with 568 additions and 1 deletions

View File

@ -28,6 +28,7 @@ import java.util.HashSet;
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 @@ public final class Template {
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

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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();
}
}

View File

@ -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>