In the meantime I found a way to solve the problem for substring function missing on Oracle by this approach. It saves this architecture for me. I created a hbm file that contains this content: <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd" > <hibernate-mapping package="org.generic"> <database-object> <create> CREATE OR REPLACE FUNCTION substring (strIn clob, StartPos integer, Len integer) RETURN varchar2 IS BEGIN RETURN substr( strin, startpos, len ); EXCEPTION WHEN OTHERS THEN RETURN NULL; END substring; </create> <drop></drop> <dialect-scope name="org.hibernate.dialect.Oracle10gDialect" /> <dialect-scope name="org.hibernate.dialect.Oracle12cDialect" /> </database-object> </hibernate-mapping> So at setup time a function only on oracle is created that maps to the substr function available on Oracle.It works fine so far. However for the sake of maintainability a @formula annotation that allows to specify the database dependend string would be much better. Currently you cannot see the dependency to the database specific function looking at the annotation code. Imho a hint like this at the javadoc of the @formula annotation could help to make use of it. |